Changeset c54bb11


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

IRCv3 userhost-in-names capability

Easiest part of ircv3.2

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    rf4396c4 rc54bb11  
    7272        CAP_EXTENDED_JOIN = (1 << 2),
    7373        CAP_AWAY_NOTIFY = (1 << 3),
     74        CAP_USERHOST_IN_NAMES = (1 << 4),
    7475} irc_cap_flag_t;
    7576
  • irc_cap.c

    rf4396c4 rc54bb11  
    4242        {"extended-join", CAP_EXTENDED_JOIN},
    4343        {"away-notify", CAP_AWAY_NOTIFY},
     44        {"userhost-in-names", CAP_USERHOST_IN_NAMES},
    4445        {NULL},
    4546};
  • 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.