]> jfr.im git - irc/freenode/solanum.git/commitdiff
m_names: honour userhost-in-names for global NAMES
authorEd Kellett <redacted>
Sun, 18 Oct 2020 11:47:27 +0000 (12:47 +0100)
committerEd Kellett <redacted>
Mon, 19 Oct 2020 10:47:08 +0000 (11:47 +0100)
modules/m_names.c

index b1e4b2792d8c6d3f5d6947d1c5895178f6017dd4..bbebb8a45178858e1deb9b8a1cf2b28288f58b8a 100644 (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;
        }