Fix forwarding of INVITE when FEAT_ANNOUNCE_INVITES is on.
authorMichael Poole <mdpoole@troilus.org>
Sat, 23 Oct 2004 02:22:21 +0000 (02:22 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sat, 23 Oct 2004 02:22:21 +0000 (02:22 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1257 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_invite.c
ircd/send.c

index c57ab562bece243afcfe65201c54e3d6d2568686..0a143e5da7a57ef9b79d2d20d2190468014ef07d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-10-22  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * include/channel.h (Ban): Add fields address, nu_len, addrbits to
index 19a00d3b1a25bb20d87c4c0600bff74d4731206f..4a99cfeeb08bf15822dca45dbb4a80034f7ff5e8 100644 (file)
@@ -181,17 +181,17 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   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 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       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 672f608163fb4cf975d0279dc9461af0feeaa42c..54c38a84ba8e213bee51fa7d1640c698461d6de6 100644 (file)
@@ -511,12 +511,13 @@ void sendcmdto_channel_butserv_butone(struct Client *from, const char *cmd,
 }
 
 /** 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 @@ void sendcmdto_channel_servers_butone(struct Client *from, const char *cmd,
 
   /* 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);