]> jfr.im git - irc/rizon/plexus4.git/commitdiff
Add nocap flag to sendto_common_channels_local and sendto_channel_local_butone
authorAdam <redacted>
Fri, 17 Jun 2016 16:40:10 +0000 (12:40 -0400)
committerAdam <redacted>
Fri, 17 Jun 2016 18:48:14 +0000 (14:48 -0400)
include/send.h
modules/core/m_join.c
modules/core/m_nick.c
modules/core/m_sjoin.c
modules/m_away.c
modules/m_svsnick.c
src/client.c
src/s_user.c
src/send.c

index 6e2aa48a25ac8bac9c94294b8eb140ee060959f3..539efd7101535121d282a81143ddd88eb1fcd890 100644 (file)
@@ -77,12 +77,12 @@ extern void sendto_channel_butone(struct Client *, struct Client *,
                                   struct Channel *, unsigned int,
                                   int is_ctcp,
                                   const char *, ...) AFP(6,7);
-extern void sendto_common_channels_local(struct Client *, int, unsigned int,
-                                         const char *, ...) AFP(4,5);
+extern void sendto_common_channels_local(struct Client *, int, unsigned int, unsigned int,
+                                         const char *, ...) AFP(5,6);
 extern void sendto_channel_local(unsigned int, int, struct Channel *,
                                  const char *, ...) AFP(4,5);
-extern void sendto_channel_local_butone(struct Client *, unsigned int, unsigned int, struct Channel *,
-                                        const char *, ...) AFP(5,6);
+extern void sendto_channel_local_butone(struct Client *, unsigned int, unsigned int, unsigned int, struct Channel *,
+                                        const char *, ...) AFP(6,7);
 extern void sendto_server(struct Client *,
                           const unsigned int,
                           const unsigned int, const char *, ...) AFP(4,5);
index 47275a47ba479ad04ee5b72d4b62fb60a928e1ea..44a706ee471cbe5dd1c05777e1b1a00ab4543960 100644 (file)
@@ -359,7 +359,7 @@ m_join(struct Client *client_p, struct Client *source_p,
       sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s +nt",
                            me.name, chptr->chname);
       if (source_p->away[0])
-        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr,
+        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, 0, chptr,
                                     ":%s!%s@%s AWAY :%s",
                                     source_p->name, source_p->username,
                                     source_p->host, source_p->away);
@@ -380,7 +380,7 @@ m_join(struct Client *client_p, struct Client *source_p,
                            source_p->host, chptr->chname);
 
       if (source_p->away[0])
-        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr,
+        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, 0, chptr,
                                     ":%s!%s@%s AWAY :%s",
                                     source_p->name, source_p->username,
                                     source_p->host, source_p->away);
@@ -555,7 +555,7 @@ ms_join(struct Client *client_p, struct Client *source_p,
                          source_p->name, source_p->username,
                          source_p->host, chptr->chname);
     if (source_p->away[0])
-      sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr,
+      sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, 0, chptr,
                                   ":%s!%s@%s AWAY :%s",
                                   source_p->name, source_p->username,
                                   source_p->host, source_p->away);
index 9dbad892158148f63ebd5da3e58c494f2a548aa7..66e8272738001eb2ae046f2c044b771e954c140e 100644 (file)
@@ -285,7 +285,7 @@ change_local_nick(struct Client *source_p, const char *nick)
   sendto_snomask(SNO_NCHANGE, L_ALL,
                  "Nick change: From %s to %s [%s@%s]",
                  source_p->name, nick, source_p->username, source_p->realhost);
-  sendto_common_channels_local(source_p, 1, 0, ":%s!%s@%s NICK :%s",
+  sendto_common_channels_local(source_p, 1, 0, 0, ":%s!%s@%s NICK :%s",
                                source_p->name, source_p->username,
                                source_p->host, nick);
   whowas_add_history(source_p, 1);
@@ -378,7 +378,7 @@ nick_from_server(struct Client *client_p, struct Client *source_p, int parc,
                    source_p->name, nick, source_p->username, source_p->realhost);
 #endif
 
-    sendto_common_channels_local(source_p, 1, 0, ":%s!%s@%s NICK :%s",
+    sendto_common_channels_local(source_p, 1, 0, 0, ":%s!%s@%s NICK :%s",
                                  source_p->name, source_p->username,
                                  source_p->host, nick);
 
index 581966af4d19a7edbe0009e35f82aa3327eb9751..2bf4c92de93b9db65d2b55519cbe1c35024da03b 100644 (file)
@@ -451,7 +451,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
                            target_p->name, target_p->username,
                            target_p->host, chptr->chname);
       if (target_p->away[0])
-        sendto_channel_local_butone(target_p, 0, CAP_AWAY_NOTIFY, chptr,
+        sendto_channel_local_butone(target_p, 0, CAP_AWAY_NOTIFY, 0, chptr,
                                     ":%s!%s@%s AWAY :%s",
                                     target_p->name, target_p->username,
                                     target_p->host, target_p->away);
index 394d7a49039ac5b01b05bb9079a8c80f10cbc666..f5c9afce813d06f63dc9fcc9ce5ccd7577808a6d 100644 (file)
@@ -61,7 +61,7 @@ m_away(struct Client *client_p, struct Client *source_p,
                     ":%s AWAY", ID(source_p));
       sendto_server(client_p, NOCAPS, CAP_TS6,
                     ":%s AWAY", source_p->name);
-      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY,
+      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, 0,
                                    ":%s!%s@%s AWAY",
                                    source_p->name, source_p->username,
                                    source_p->host);
@@ -87,7 +87,7 @@ m_away(struct Client *client_p, struct Client *source_p,
 
   strlcpy(source_p->away, parv[1], sizeof(source_p->away));
 
-  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY,
+  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, 0,
                                ":%s!%s@%s AWAY :%s",
                                source_p->name, source_p->username,
                                source_p->host, source_p->away);
@@ -112,7 +112,7 @@ ms_away(struct Client *client_p, struct Client *source_p,
                     ":%s AWAY", ID(source_p));
       sendto_server(client_p, NOCAPS, CAP_TS6,
                     ":%s AWAY", source_p->name);
-      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY,
+      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, 0,
                                    ":%s!%s@%s AWAY",
                                    source_p->name, source_p->username,
                                    source_p->host);
@@ -125,7 +125,7 @@ ms_away(struct Client *client_p, struct Client *source_p,
 
   strlcpy(source_p->away, parv[1], sizeof(source_p->away));
 
-  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY,
+  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, 0,
                                ":%s!%s@%s AWAY :%s",
                                source_p->name, source_p->username,
                                source_p->host, source_p->away);
index eeb35ce19cca4e4211f6620b14c5c2da215dd0e1..02dbd601f856c5e5fb7818c3a701264c18ba93ef 100644 (file)
@@ -118,7 +118,7 @@ me_svsnick(struct Client *client_p, struct Client *source_p,
                  "Nick change: From %s to %s [%s@%s]",
                  target_p->name, parv[3], target_p->username, target_p->realhost);
 
-  sendto_common_channels_local(target_p, 1, 0, ":%s!%s@%s NICK :%s",
+  sendto_common_channels_local(target_p, 1, 0, 0, ":%s!%s@%s NICK :%s",
                                target_p->name, target_p->username,
                                target_p->host, parv[3]);
 
index d46aedf051ae0b2d5804c305efa393eb781f1c4f..7d23d7ab7ec3e07aaec0797513bdbf1d334f437f 100644 (file)
@@ -781,7 +781,7 @@ exit_one_client(struct Client *source_p, const char *quitmsg)
      * that the client can show the "**signoff" message).
      * (Note: The notice is to the local clients *only*)
      */
-    sendto_common_channels_local(source_p, 0, 0, ":%s!%s@%s QUIT :%s",
+    sendto_common_channels_local(source_p, 0, 0, 0, ":%s!%s@%s QUIT :%s",
                                  source_p->name, source_p->username,
                                  source_p->host, quitmsg);
     DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head)
index d76f65b6fde9cbb5e1d65430cb7ca19129f8c3e8..04e6ee09bc683ac86a446227c363ef751f03b554 100644 (file)
@@ -1264,7 +1264,7 @@ user_set_hostmask(struct Client *target_p, const char *username, const char *hos
     return;
 
   if (ConfigFileEntry.cycle_on_host_change)
-    sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
+    sendto_common_channels_local(target_p, 0, 0, CAP_CHGHOST, ":%s!%s@%s QUIT :Changing hostname",
                                  target_p->name, target_p->username, target_p->host);
 
   if (username)
@@ -1322,18 +1322,18 @@ user_set_hostmask(struct Client *target_p, const char *username, const char *hos
 
     *p = '\0';
 
-    sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s!%s@%s JOIN :%s",
+    sendto_channel_local_butone(target_p, 0, 0, CAP_CHGHOST, ms->chptr, ":%s!%s@%s JOIN :%s",
                                 target_p->name, target_p->username, target_p->host,
                                 ms->chptr->chname);
     if (nickbuf[0])
-      sendto_channel_local_butone(target_p, 0, 0, ms->chptr, ":%s MODE %s +%s %s",
+      sendto_channel_local_butone(target_p, 0, 0, CAP_CHGHOST, ms->chptr, ":%s MODE %s +%s %s",
                                   target_p->servptr->name, ms->chptr->chname,
                                   modebuf, nickbuf);
 
   }
 
   if (target_p->away[0])
-    sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY,
+    sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY, CAP_CHGHOST,
                                  ":%s!%s@%s AWAY :%s",
                                  target_p->name, target_p->username,
                                  target_p->host, target_p->away);
index c976a706a9db1a398cdf2352f7bf8422312adb31..d437775b5cc335605247390bf2462b05bc07d8bd 100644 (file)
@@ -471,7 +471,8 @@ sendto_server(struct Client *one,
  *               used by m_nick.c and exit_one_client.
  */
 void
-sendto_common_channels_local(struct Client *user, int touser, unsigned int cap,
+sendto_common_channels_local(struct Client *user, int touser,
+                             unsigned int cap, unsigned int nocap,
                              const char *pattern, ...)
 {
   va_list args;
@@ -505,7 +506,7 @@ sendto_common_channels_local(struct Client *user, int touser, unsigned int cap,
           target_p->localClient->serial == current_serial)
         continue;
 
-      if (HasCap(target_p, cap) != cap)
+      if (HasCap(target_p, cap) != cap || HasCap(target_p, nocap))
         continue;
 
       target_p->localClient->serial = current_serial;
@@ -515,7 +516,7 @@ sendto_common_channels_local(struct Client *user, int touser, unsigned int cap,
 
   if (touser && MyConnect(user) && !IsDead(user) &&
       user->localClient->serial != current_serial)
-    if (HasCap(user, cap) == cap)
+    if (HasCap(user, cap) == cap && !HasCap(user, nocap))
       send_message(user, buffer);
 
   dbuf_ref_free(buffer);
@@ -579,7 +580,8 @@ sendto_channel_local(unsigned int type, int nodeaf, struct Channel *chptr,
  * WARNING - +D clients are omitted
  */
 void
-sendto_channel_local_butone(struct Client *one, unsigned int type, unsigned int cap,
+sendto_channel_local_butone(struct Client *one, unsigned int type,
+                            unsigned int cap, unsigned int nocap,
                             struct Channel *chptr, const char *pattern, ...)
 {
   va_list args;
@@ -607,7 +609,7 @@ sendto_channel_local_butone(struct Client *one, unsigned int type, unsigned int
     if (is_bwsave(chptr, target_p))
       continue;
 
-    if (HasCap(target_p, cap) != cap)
+    if (HasCap(target_p, cap) != cap || HasCap(target_p, nocap))
         continue;
 
     send_message(target_p, buffer);