Changeset c54bb11 for irc_send.c


Ignore:
Timestamp:
2015-12-06T02:34:12Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
459dec8
Parents:
f4396c4
Message:

IRCv3 userhost-in-names capability

Easiest part of ircv3.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_send.c

    rf4396c4 rc54bb11  
    208208        GSList *l;
    209209        GString *namelist = g_string_sized_new(IRC_NAMES_LEN);
     210        gboolean uhnames = (ic->irc->caps & CAP_USERHOST_IN_NAMES);
    210211
    211212        /* RFCs say there is no error reply allowed on NAMES, so when the
     
    217218                char prefix;
    218219
     220                if (uhnames) {
     221                        extra_len += strlen(iu->user) + strlen(iu->host) + 2;
     222                }
     223
    219224                if (namelist->len + extra_len > IRC_NAMES_LEN - 4) {
    220225                        irc_send_num(ic->irc, 353, "= %s :%s", ic->name, namelist->str);
     
    226231                }
    227232
    228                 g_string_append(namelist, iu->nick);
    229                 g_string_append_c(namelist, ' ');
     233                if (uhnames) {
     234                        g_string_append_printf(namelist, "%s!%s@%s ", iu->nick, iu->user, iu->host);
     235                } else {
     236                        g_string_append(namelist, iu->nick);
     237                        g_string_append_c(namelist, ' ');
     238                }
    230239        }
    231240
Note: See TracChangeset for help on using the changeset viewer.