src/channel: add support for IRCv3.2 userhost-in-names

This commit is contained in:
Max Teufel 2015-02-28 01:06:38 -06:00 committed by William Pitcock
parent 6e3d57dc6b
commit 1b54aa5c3b
3 changed files with 34 additions and 15 deletions

View file

@ -442,12 +442,13 @@ struct ListClient
UMODE_WALLOP | UMODE_LOCOPS) UMODE_WALLOP | UMODE_LOCOPS)
#define DEFAULT_OPER_SNOMASK SNO_GENERAL #define DEFAULT_OPER_SNOMASK SNO_GENERAL
#define CLICAP_MULTI_PREFIX 0x0001 #define CLICAP_MULTI_PREFIX 0x0001
#define CLICAP_SASL 0x0002 #define CLICAP_SASL 0x0002
#define CLICAP_ACCOUNT_NOTIFY 0x0004 #define CLICAP_ACCOUNT_NOTIFY 0x0004
#define CLICAP_EXTENDED_JOIN 0x0008 #define CLICAP_EXTENDED_JOIN 0x0008
#define CLICAP_AWAY_NOTIFY 0x0010 #define CLICAP_AWAY_NOTIFY 0x0010
#define CLICAP_TLS 0x0020 #define CLICAP_TLS 0x0020
#define CLICAP_USERHOST_IN_NAMES 0x0040
/* /*
* flags macros. * flags macros.

View file

@ -76,6 +76,7 @@ static struct clicap
_CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0, 0), _CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0, 0),
_CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 0, 0, 0), _CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 0, 0, 0),
_CLICAP("tls", CLICAP_TLS, 0, 0, 0), _CLICAP("tls", CLICAP_TLS, 0, 0, 0),
_CLICAP("userhost-in-names", CLICAP_USERHOST_IN_NAMES, 0, 0, 0),
}; };
#define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap)) #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap))

View file

@ -465,17 +465,34 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
if(IsInvisible(target_p) && !is_member) if(IsInvisible(target_p) && !is_member)
continue; continue;
/* space, possible "@+" prefix */ if (IsCapable(client_p, CLICAP_USERHOST_IN_NAMES))
if(cur_len + strlen(target_p->name) + 3 >= BUFSIZE - 3)
{ {
*(t - 1) = '\0'; /* space, possible "@+" prefix */
sendto_one(client_p, "%s", lbuf); if (cur_len + strlen(target_p->name) + strlen(target_p->username) + strlen(target_p->host) + 5 >= BUFSIZE - 5)
cur_len = mlen; {
t = lbuf + mlen; *(t - 1) = '\0';
} sendto_one(client_p, "%s", lbuf);
cur_len = mlen;
t = lbuf + mlen;
}
tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack), tlen = rb_sprintf(t, "%s%s!%s@%s ", find_channel_status(msptr, stack),
target_p->name); target_p->name, target_p->username, target_p->host);
}
else
{
/* space, possible "@+" prefix */
if(cur_len + strlen(target_p->name) + 3 >= BUFSIZE - 3)
{
*(t - 1) = '\0';
sendto_one(client_p, "%s", lbuf);
cur_len = mlen;
t = lbuf + mlen;
}
tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack),
target_p->name);
}
cur_len += tlen; cur_len += tlen;
t += tlen; t += tlen;