aboutsummaryrefslogtreecommitdiffstats
path: root/irc_send.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_send.c')
-rw-r--r--irc_send.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/irc_send.c b/irc_send.c
index 954c5322..4511d667 100644
--- a/irc_send.c
+++ b/irc_send.c
@@ -207,6 +207,7 @@ void irc_send_names(irc_channel_t *ic)
{
GSList *l;
GString *namelist = g_string_sized_new(IRC_NAMES_LEN);
+ gboolean uhnames = (ic->irc->caps & CAP_USERHOST_IN_NAMES);
/* RFCs say there is no error reply allowed on NAMES, so when the
channel is invalid, just give an empty reply. */
@@ -216,6 +217,10 @@ void irc_send_names(irc_channel_t *ic)
size_t extra_len = strlen(iu->nick);
char prefix;
+ if (uhnames) {
+ extra_len += strlen(iu->user) + strlen(iu->host) + 2;
+ }
+
if (namelist->len + extra_len > IRC_NAMES_LEN - 4) {
irc_send_num(ic->irc, 353, "= %s :%s", ic->name, namelist->str);
g_string_truncate(namelist, 0);
@@ -225,8 +230,12 @@ void irc_send_names(irc_channel_t *ic)
g_string_append_c(namelist, prefix);
}
- g_string_append(namelist, iu->nick);
- g_string_append_c(namelist, ' ');
+ if (uhnames) {
+ g_string_append_printf(namelist, "%s!%s@%s ", iu->nick, iu->user, iu->host);
+ } else {
+ g_string_append(namelist, iu->nick);
+ g_string_append_c(namelist, ' ');
+ }
}
if (namelist->len) {