Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-07-24 02:00:39 UTC

Modified files:
     ircd/send.c ircd/s_numeric.c ircd/m_wallvoices.c include/msg.h
     ChangeLog

Log message:

Cleanup WALLCHOPS and WALLVOICES handling in preparation for a change
to INVITE announcements.  Add inter-server numeric support for same.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.806 ircu2.10/ChangeLog:1.807
--- ircu2.10/ChangeLog:1.806    Sun Jul 23 17:29:17 2006
+++ ircu2.10/ChangeLog  Sun Jul 23 19:00:29 2006
@@ -1,5 +1,19 @@
 2006-07-23  Michael Poole <[EMAIL PROTECTED]>
 
+       * include/msg.h (CMD_WALLCHOPS): Change to what is actually used.
+       (CMD_WALLVOICES): Likewise.
+
+       * ircd/m_wallvoices.c (ms_wallvoices): Add missing "+ ".
+
+       * ircd/s_numeric.c (do_numeric): Document slightly irregular
+       parv[2].  Allow parv[1] to be of the form @#channel.
+
+       * ircd/send.c (sendcmdto_channel): Do not override "cmd" for local
+       sends.  Do not build serv_mb if servers are skipped.  Remove the
+       SKIP_LOCALS handling, which is about to become unused.
+
+2006-07-23  Michael Poole <[EMAIL PROTECTED]>
+
        * include/s_user.h (del_isupport): Declare.
 
        * ircd/engine_select.c (engine_loop): Fix type of codesize
Index: ircu2.10/include/msg.h
diff -u ircu2.10/include/msg.h:1.18 ircu2.10/include/msg.h:1.19
--- ircu2.10/include/msg.h:1.18 Fri Apr  1 18:50:13 2005
+++ ircu2.10/include/msg.h      Sun Jul 23 19:00:29 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Command and token declarations and structures.
- * @version $Id: msg.h,v 1.18 2005/04/02 02:50:13 entrope Exp $
+ * @version $Id: msg.h,v 1.19 2006/07/24 02:00:29 entrope Exp $
  */
 #ifndef INCLUDED_msg_h
 #define INCLUDED_msg_h
@@ -198,11 +198,11 @@
 
 #define MSG_WALLCHOPS           "WALLCHOPS"     /* WC */
 #define TOK_WALLCHOPS           "WC"
-#define CMD_WALLCHOPS          MSG_WALLCHOPS, TOK_WALLCHOPS
+#define CMD_WALLCHOPS          MSG_NOTICE, TOK_WALLCHOPS
 
 #define MSG_WALLVOICES           "WALLVOICES"     /* WV */
 #define TOK_WALLVOICES           "WV"
-#define CMD_WALLVOICES         MSG_WALLVOICES, TOK_WALLVOICES
+#define CMD_WALLVOICES         MSG_NOTICE, TOK_WALLVOICES
 
 #define MSG_CPRIVMSG            "CPRIVMSG"      /* CPRI */
 #define TOK_CPRIVMSG            "CP"
Index: ircu2.10/ircd/m_wallvoices.c
diff -u ircu2.10/ircd/m_wallvoices.c:1.9 ircu2.10/ircd/m_wallvoices.c:1.10
--- ircu2.10/ircd/m_wallvoices.c:1.9    Sun Jul 23 11:04:22 2006
+++ ircu2.10/ircd/m_wallvoices.c        Sun Jul 23 19:00:29 2006
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_wallvoices.c,v 1.9 2006/07/23 18:04:22 entrope Exp $
+ * $Id: m_wallvoices.c,v 1.10 2006/07/24 02:00:29 entrope Exp $
  */
 
 #include "config.h"
@@ -107,7 +107,7 @@
     if (client_can_send_to_channel(sptr, chptr, 0)) {
       sendcmdto_channel(sptr, CMD_WALLVOICES, chptr, cptr,
                         SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES, 
-                        "%H :%s", chptr, parv[parc - 1]);
+                        "%H :+ %s", chptr, parv[parc - 1]);
     } else
       send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
   }
Index: ircu2.10/ircd/s_numeric.c
diff -u ircu2.10/ircd/s_numeric.c:1.13 ircu2.10/ircd/s_numeric.c:1.14
--- ircu2.10/ircd/s_numeric.c:1.13      Sun Jul 23 11:04:22 2006
+++ ircu2.10/ircd/s_numeric.c   Sun Jul 23 19:00:29 2006
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief Send a numeric message to a client.
- * @version $Id: s_numeric.c,v 1.13 2006/07/23 18:04:22 entrope Exp $
+ * @version $Id: s_numeric.c,v 1.14 2006/07/24 02:00:29 entrope Exp $
  */
 #include "config.h"
 
@@ -47,6 +47,11 @@
  */
 
 /** Forwards a numeric message from a remote server.
+ *
+ * For this function, parv[2] may be special in the sense that it may
+ * actually be multiple parameters.  parse_server() has special case
+ * code to do this when it parses numeric messages.
+ *
  * @param numeric Value of numeric message.
  * @param nnn If non-zero, treat parv[1] as a numnick; else as a client name.
  * @param cptr Client that originated the numeric.
@@ -60,6 +65,7 @@
 {
   struct Client *acptr = 0;
   struct Channel *achptr = 0;
+  int send_flags = SKIP_DEAF | SKIP_BURST;
   char num[4];
 
   /* Avoid trash, we need it to come from a server and have a target  */
@@ -72,7 +78,12 @@
      should never generate numeric replies to non-users anyway
      Ahem... it can be a channel actually, csc bots use it :\ --Nem */
 
-  if (IsChannelName(parv[1]))
+  if (parv[1][0] == '@' && IsChannelName(parv[1] + 1))
+  {
+    send_flags |= SKIP_NONOPS;
+    achptr = FindChannel(parv[1] + 1);
+  }
+  else if (IsChannelName(parv[1]))
     achptr = FindChannel(parv[1]);
   else
     acptr = (nnn) ? (findNUser(parv[1])) : (FindUser(parv[1]));
@@ -99,7 +110,7 @@
                   num, num, acptr, "%C %s", acptr, parv[2]);
   else
     sendcmdto_channel(feature_bool(FEAT_HIS_REWRITE) ? &me : sptr,
-                      num, num, achptr, cptr, SKIP_DEAF | SKIP_BURST,
+                      num, num, achptr, cptr, send_flags,
                       "%H %s", achptr, parv[2]);
   return 0;
 }
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.58 ircu2.10/ircd/send.c:1.59
--- ircu2.10/ircd/send.c:1.58   Sun Jul 23 11:04:22 2006
+++ ircu2.10/ircd/send.c        Sun Jul 23 19:00:28 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Send messages to certain targets.
- * @version $Id: send.c,v 1.58 2006/07/23 18:04:22 entrope Exp $
+ * @version $Id: send.c,v 1.59 2006/07/24 02:00:28 entrope Exp $
  */
 #include "config.h"
 
@@ -528,7 +528,7 @@
  * @param[in] tok Short name of command.
  * @param[in] to Destination channel.
  * @param[in] one Client direction to skip (or NULL).
- * @param[in] skip Bitmask of SKIP_NONOPS, SKIP_NONVOICES, SKIP_DEAF, 
SKIP_BURST.
+ * @param[in] skip Bitmask of SKIP_NONOPS, SKIP_NONVOICES, SKIP_DEAF, 
SKIP_BURST, SKIP_SERVERS.
  * @param[in] pattern Format string for command arguments.
  */
 void sendcmdto_channel(struct Client *from, const char *cmd,
@@ -546,13 +546,19 @@
   /* Build buffer to send to users */
   va_start(vd.vd_args, pattern);
   user_mb = msgq_make(0, skip & (SKIP_NONOPS | SKIP_NONVOICES) ? "%:#C %s @%v" 
: "%:#C %s %v",
-                      from, skip & (SKIP_NONOPS | SKIP_NONVOICES) ? MSG_NOTICE 
: cmd, &vd);
+                      from, cmd, &vd);
   va_end(vd.vd_args);
 
   /* Build buffer to send to servers */
-  va_start(vd.vd_args, pattern);
-  serv_mb = msgq_make(&me, "%C %s %v", from, tok, &vd);
-  va_end(vd.vd_args);
+  if (skip & SKIP_SERVERS)
+    serv_mb = NULL;
+  else
+  {
+    va_start(vd.vd_args, pattern);
+    serv_mb = msgq_make(&me, skip & SKIP_NONOPS ? "%C %s @%v" : "%C %s %v",
+                        from, tok, &vd);
+    va_end(vd.vd_args);
+  }
 
   /* send buffer along! */
   bump_sentalong(one);
@@ -565,19 +571,17 @@
         (skip & SKIP_NONVOICES && !IsChanOp(member) && !HasVoice(member)) ||
         (skip & SKIP_BURST && IsBurstOrBurstAck(cli_from(member->user))) ||
         (skip & SKIP_SERVERS && !MyUser(member->user)) ||
-        (skip & SKIP_LOCALS && MyUser(member->user)) ||
         cli_fd(cli_from(member->user)) < 0)
       continue;
     cli_sentalong(member->user) = sentalong_marker;
 
-    if (MyConnect(member->user)) /* pick right buffer to send */
-      send_buffer(member->user, user_mb, 0);
-    else
-      send_buffer(member->user, serv_mb, 0);
+    /* pick right buffer to send */
+    send_buffer(member->user, MyConnect(member->user) ? user_mb : serv_mb, 0);
   }
 
   msgq_clean(user_mb);
-  msgq_clean(serv_mb);
+  if (serv_mb)
+    msgq_clean(serv_mb);
 }
 
 /** Send a (prefixed) WALL of type \a type to all users except \a one.
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to