diff options
author | dequis <dx@dxzone.com.ar> | 2015-12-05 23:34:12 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-12-05 23:34:12 -0300 |
commit | c54bb115aad74f9f59e67ad7996332aabe64b8f8 (patch) | |
tree | b62d6b7ba4adeeb5a9146838494e178b86b8a415 /irc_send.c | |
parent | f4396c4d16f67cb28effd86a636b9db8fa48821c (diff) |
IRCv3 userhost-in-names capability
Easiest part of ircv3.2
Diffstat (limited to 'irc_send.c')
-rw-r--r-- | irc_send.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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) { |