]> jfr.im git - irc/freenode/ircd-seven.git/commitdiff
src/channel: add support for IRCv3.2 userhost-in-names
authorMax Teufel <redacted>
Sat, 28 Feb 2015 07:06:38 +0000 (01:06 -0600)
committerWilliam Pitcock <redacted>
Sat, 28 Feb 2015 07:06:38 +0000 (01:06 -0600)
include/client.h
modules/m_cap.c
src/channel.c

index ec61d1922e73efc68ac5d41b557e4e0ae6b00d0f..2e69b17a0c6128020ed1c25f7e1d8823145432eb 100644 (file)
@@ -442,12 +442,13 @@ struct ListClient
                              UMODE_WALLOP | UMODE_LOCOPS)
 #define DEFAULT_OPER_SNOMASK SNO_GENERAL
 
-#define CLICAP_MULTI_PREFIX    0x0001
-#define CLICAP_SASL            0x0002
-#define CLICAP_ACCOUNT_NOTIFY  0x0004
-#define CLICAP_EXTENDED_JOIN   0x0008
-#define CLICAP_AWAY_NOTIFY     0x0010
-#define CLICAP_TLS             0x0020
+#define CLICAP_MULTI_PREFIX            0x0001
+#define CLICAP_SASL                    0x0002
+#define CLICAP_ACCOUNT_NOTIFY          0x0004
+#define CLICAP_EXTENDED_JOIN           0x0008
+#define CLICAP_AWAY_NOTIFY             0x0010
+#define CLICAP_TLS                     0x0020
+#define CLICAP_USERHOST_IN_NAMES       0x0040
 
 /*
  * flags macros.
index 76370f20c9e521dfcd0209dfeb8b51fbff1ddcd3..93830cf3b8b360dd7e41a4b3d02db40f892272c6 100644 (file)
@@ -76,6 +76,7 @@ static struct clicap
        _CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0, 0),
        _CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 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))
index a9412e9b3ee35cb41143dbb22d7293d78ae61f1e..bbb09a3d008bab10566369ea997a8debbd60514d 100644 (file)
@@ -465,17 +465,34 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
                        if(IsInvisible(target_p) && !is_member)
                                continue;
 
-                       /* space, possible "@+" prefix */
-                       if(cur_len + strlen(target_p->name) + 3 >= BUFSIZE - 3)
+                       if (IsCapable(client_p, CLICAP_USERHOST_IN_NAMES))
                        {
-                               *(t - 1) = '\0';
-                               sendto_one(client_p, "%s", lbuf);
-                               cur_len = mlen;
-                               t = lbuf + mlen;
+                               /* space, possible "@+" prefix */
+                               if (cur_len + strlen(target_p->name) + strlen(target_p->username) + strlen(target_p->host) + 5 >= BUFSIZE - 5)
+                               {
+                                       *(t - 1) = '\0';
+                                       sendto_one(client_p, "%s", lbuf);
+                                       cur_len = mlen;
+                                       t = lbuf + mlen;
+                               }
+
+                               tlen = rb_sprintf(t, "%s%s!%s@%s ", find_channel_status(msptr, stack),
+                                                 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);
+                               tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack),
+                                                 target_p->name);
+                       }
 
                        cur_len += tlen;
                        t += tlen;