Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2004-10-23 02:22:32 UTC

Modified files:
     ChangeLog ircd/m_invite.c ircd/send.c

Log message:

Fix forwarding of INVITE when FEAT_ANNOUNCE_INVITES is on.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.499 ircu2.10/ChangeLog:1.500
--- ircu2.10/ChangeLog:1.499    Thu Oct 21 16:14:34 2004
+++ ircu2.10/ChangeLog  Fri Oct 22 19:22:09 2004
@@ -1,3 +1,12 @@
+2004-10-22  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/m_invite.c (m_invite, ms_invite): Fix INVITE forwarding
+       with announcements enabled (do not "announce" to the recipient,
+       and unconditionally send to the recipient).
+
+       * ircd/send.c (sendcmdto_channel_servers_butone): Properly skip
+       the "from" client and implement SKIP_NONOPS and SKIP_NONVOICES.
+
 2004-10-21  Michael Poole <[EMAIL PROTECTED]>
 
        * include/channel.h (Ban): Add fields address, nu_len, addrbits to
Index: ircu2.10/ircd/m_invite.c
diff -u ircu2.10/ircd/m_invite.c:1.15 ircu2.10/ircd/m_invite.c:1.16
--- ircu2.10/ircd/m_invite.c:1.15       Mon May 24 20:10:01 2004
+++ ircu2.10/ircd/m_invite.c    Fri Oct 22 19:22:21 2004
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_invite.c,v 1.15 2004/05/25 03:10:01 entrope Exp $
+ * $Id: m_invite.c,v 1.16 2004/10/23 02:22:21 entrope Exp $
  */
 
 /*
@@ -181,17 +181,17 @@
 
   if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) {
     if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
+      /* Announce to channel operators. */
       sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
                                        NULL, chptr, sptr, SKIP_NONOPS, 
                                        "%H %C %C :%C has been invited by %C",
                                        chptr, acptr, sptr, acptr, sptr);
-      sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0,
+      /* Announce to servers with channel operators, but skip acptr,
+       * since they will be notified below. */
+      sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, 
SKIP_NONOPS,
                                        "%s :%H", cli_name(acptr), chptr);
-      if (MyConnect(acptr))
-        sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
     }
-    else
-      sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
+    sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr);
   }
 
   return 0;
@@ -269,11 +269,14 @@
       add_invite(acptr, chptr);
 
   if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
+    /* Announce to channel operators. */
     sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
-                                     NULL, chptr, sptr, SKIP_NONOPS, 
+                                     NULL, chptr, sptr, SKIP_NONOPS,
                                      "%H %C %C :%C has been invited by %C",
                                      chptr, acptr, sptr, acptr, sptr);
-    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0,
+    /* Announce to servers with channel operators, but skip acptr,
+     * since they will be notified below. */
+    sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, 
SKIP_NONOPS,
                                      "%s :%H", cli_name(acptr), chptr);
   }
 
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.52 ircu2.10/ircd/send.c:1.53
--- ircu2.10/ircd/send.c:1.52   Wed Oct 13 05:29:33 2004
+++ ircu2.10/ircd/send.c        Fri Oct 22 19:22:21 2004
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Send messages to certain targets.
- * @version $Id: send.c,v 1.52 2004/10/13 12:29:33 entrope Exp $
+ * @version $Id: send.c,v 1.53 2004/10/23 02:22:21 entrope Exp $
  */
 #include "config.h"
 
@@ -511,12 +511,13 @@
 }
 
 /** Send a (prefixed) command to all servers with users on \a to.
+ * Skip \a from and \a one plus those indicated in \a skip.
  * @param[in] from Client originating the command.
  * @param[in] cmd Long name of command (ignored).
  * @param[in] tok Short name of command.
  * @param[in] to Destination channel.
  * @param[in] one Client direction to skip (or NULL).
- * @param[in] skip Ignored field.
+ * @param[in] skip Bitmask of SKIP_NONOPS and SKIP_NONVOICES indicating which clients 
to skip.
  * @param[in] pattern Format string for command arguments.
  */
 void sendcmdto_channel_servers_butone(struct Client *from, const char *cmd,
@@ -536,12 +537,14 @@
 
   /* send the buffer to each server */
   bump_sentalong(one);
-  sentalong_marker++;
+  cli_sentalong(from) = sentalong_marker;
   for (member = to->members; member; member = member->next_member) {
     if (MyConnect(member->user)
         || IsZombie(member)
         || cli_fd(cli_from(member->user)) < 0
-        || cli_sentalong(member->user) == sentalong_marker)
+        || cli_sentalong(member->user) == sentalong_marker
+        || (skip & SKIP_NONOPS && !IsChanOp(member))
+        || (skip & SKIP_NONVOICES && !IsChanOp(member) && !HasVoice(member)))
       continue;
     cli_sentalong(member->user) = sentalong_marker;
     send_buffer(member->user, serv_mb, 0);
----------------------- End of diff -----------------------

Reply via email to