m_names: honour userhost-in-names for global NAMES

This commit is contained in:
Ed Kellett 2020-10-18 12:47:27 +01:00
parent 507bdac642
commit 54c7ead605

View file

@ -172,14 +172,31 @@ names_global(struct Client *source_p)
if(dont_show)
continue;
if((cur_len + NICKLEN + 2) > (BUFSIZE - 3))
if (IsCapable(source_p, CLICAP_USERHOST_IN_NAMES))
{
sendto_one(source_p, "%s", buf);
cur_len = mlen;
t = buf + mlen;
if (cur_len + strlen(target_p->name) + strlen(target_p->username) + strlen(target_p->host) + strlen(" !@") >= BUFSIZE - strlen("\r\n"))
{
*(t - 1) = '\0';
sendto_one(source_p, "%s", buf);
cur_len = mlen;
t = buf + mlen;
}
tlen = sprintf(t, "%s!%s@%s ", target_p->name, target_p->username, target_p->host);
}
else
{
if(cur_len + strlen(target_p->name) + strlen(" ") >= BUFSIZE - strlen("\r\n"))
{
*(t - 1) = '\0';
sendto_one(source_p, "%s", buf);
cur_len = mlen;
t = buf + mlen;
}
tlen = sprintf(t, "%s ", target_p->name);
}
tlen = sprintf(t, "%s ", target_p->name);
cur_len += tlen;
t += tlen;
}