Add ZANNELS feature; tweak recreate after bogus DESTRUCT.
authorMichael Poole <mdpoole@troilus.org>
Thu, 17 Nov 2005 02:23:27 +0000 (02:23 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 17 Nov 2005 02:23:27 +0000 (02:23 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1560 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/ircd_features.h
ircd/channel.c
ircd/convert-conf.c
ircd/ircd_features.c
ircd/m_destruct.c

index 79148fcbf2f2883f43c1d10d534598958cf1e0fc..2b2d7b3d10e6a2fca69f7fe834f2992a3e8e426a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-11-17  Carlo Wood <run@alinoe.com>
+
+       * include/ircd_features.h (Feature): Add ZANNELS.
+       * ircd/ircd_features.c (FeatureDesc): idem.
+       * ircd/channel.c (sub1_from_channel): Don't keep zannels
+       around when ZANNELS and OPLEVELS are FALSE.
+       * ircd/m_destruct.c (ms_destruct): Use JOIN instead of
+       CREATE to recreate a non-empty channel after DESTRUCT.
+
 2005-11-16  Michael Poole <mdpoole@troilus.org>
 
        * tools/convert-conf.py: Delete obsolete code.
index e452f62da39ea44a1031a2fb5889f89e363c3878..128d019aa4e60a13fcff3d8a85060015f4f18aba 100644 (file)
@@ -56,6 +56,7 @@ enum Feature {
   FEAT_HIDDEN_IP,
   FEAT_CONNEXIT_NOTICES,
   FEAT_OPLEVELS,
+  FEAT_ZANNELS,
   FEAT_LOCAL_CHANNELS,
   FEAT_TOPIC_BURST,
 
index a93f67606f625f1a9675aba467336cd906db320d..deda7eae463b117e7e047970f0f636901e871d26 100644 (file)
@@ -287,6 +287,22 @@ int sub1_from_channel(struct Channel* chptr)
       free_ban(link);
     }
     chptr->banlist = NULL;
+     
+#if 1 /* Temporary code */
+    /* Immediately destruct empty -A channels if ZANNELS is FALSE.
+       When OPLEVELS is true, ZANNELS should be TRUE too. Test for
+       that error. This is done to avoid the DESTRUCT message to
+       occur, which is necessary on a network with mixed versions
+       of 2.10.12.x, with x < 04 *and* 2.10.11 servers. Because
+       servers prior to 2.10.12.04 can cause a BURST message outside
+       the normal net.burst as a result of a DESTRUCT message, and
+       2.10.11 SQUIT servers when they do that. */
+    if (!(feature_bool(FEAT_ZANNELS) || feature_bool(FEAT_OPLEVELS)))
+    {
+      destruct_channel(chptr);
+      return 0;
+    }
+#endif
   }
   if (TStime() - chptr->creationtime < 172800) /* Channel younger than 48 hours? */
     schedule_destruct_event_1m(chptr);         /* Get rid of it in approximately 4-5 minutes */
index f65bd7b7afa4d3750b101ec39798d5bcde39b721..5505b3d26b432e43c02bc871440520011ec3d994 100644 (file)
@@ -310,6 +310,7 @@ static void finish_features(void)
     size_t ii;
 
     fputs("Features {\n\t\"OPLEVELS\" = \"FALSE\";\n", stdout);
+    fputs("Features {\n\t\"ZANNELS\" = \"FALSE\";\n", stdout);
 
     for (feat = features; feat; feat = feat->next) {
         /* See if the feature was remapped to an oper privilege. */
index ff4a74a45f0f440425abcf7a655a3dc1f400e92e..ab3af0074859c064d954b4cf97b67f0074079e56 100644 (file)
@@ -309,6 +309,7 @@ static struct FeatureDesc {
   F_S(HIDDEN_IP, 0, "127.0.0.1", 0),
   F_B(CONNEXIT_NOTICES, 0, 0, 0),
   F_B(OPLEVELS, 0, 1, 0),
+  F_B(ZANNELS, 0, 1, 0),
   F_B(LOCAL_CHANNELS, 0, 1, 0),
   F_B(TOPIC_BURST, 0, 0, 0),
 
index cafbb6e3ba052970b84d948004c4156bc8f77d68..89bc1fc2a5b3d9c8d2d2aefb3fcc3e10685f495a 100644 (file)
@@ -143,30 +143,17 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
      a bug that causes two JOIN's for the same user to
      result in that user being on the channel twice). */
 
-    struct Membership *chanop;
     struct Membership *member;
-    int is_real_chanop;
     struct ModeBuf mbuf;
     struct Ban *link;
 
-    /* First find a channel op, if any. */
-    for (chanop = chptr->members; chanop && !IsChanOp(chanop); chanop = chanop->next_member);
-    /* Now chanop is either a channel op, or NULL. */
-    is_real_chanop = chanop ? 1 : 0;
-
     /* Next, send all PARTs upstream. */
     for (member = chptr->members; member; member = member->next_member)
       sendcmdto_one(member->user, CMD_PART, cptr, "%H", chptr);
 
-    /* Next, send a CREATE. If we don't have a chanop, just use the first member. */
-    if (!chanop)
-      chanop = chptr->members;
-    sendcmdto_one(chanop->user, CMD_CREATE, cptr, "%H %Tu", chptr, chanTS);
-
-    /* Next, send JOINs for possible other members. */
+    /* Next, send JOINs for all members. */
     for (member = chptr->members; member; member = member->next_member)
-      if (member != chanop)
-       sendcmdto_one(member->user, CMD_JOIN, cptr, "%H", chptr);
+      sendcmdto_one(member->user, CMD_JOIN, cptr, "%H", chptr);
 
     /* Build MODE strings. We use MODEBUF_DEST_BOUNCE with MODE_DEL to assure
        that the resulting MODEs are only sent upstream. */
@@ -175,8 +162,8 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
     /* Op/voice the users as appropriate. We use MODE_DEL because we fake a bounce. */
     for (member = chptr->members; member; member = member->next_member)
     {
-      if (IsChanOp(member) && member != chanop)
-       modebuf_mode_client(&mbuf, MODE_DEL | MODE_CHANOP, member->user, OpLevel(member));
+      if (IsChanOp(member))
+        modebuf_mode_client(&mbuf, MODE_DEL | MODE_CHANOP, member->user, OpLevel(member));
       if (HasVoice(member))
         modebuf_mode_client(&mbuf, MODE_DEL | MODE_VOICE, member->user, MAXOPLEVEL + 1);
     }
@@ -194,10 +181,6 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
     for (link = chptr->banlist; link; link = link->next)
       modebuf_mode_string(&mbuf, MODE_DEL | MODE_BAN, link->banstr, 0);
     modebuf_flush(&mbuf);
-
-    /* When chanop wasn't really a chanop, let him deop himself. */
-    if (!is_real_chanop)
-      sendcmdto_one(chanop->user, CMD_MODE, cptr, "%H -o %C", chptr, chanop->user);
 #endif
 
     return 0;