From: Michael Poole Date: Thu, 17 Nov 2005 02:23:27 +0000 (+0000) Subject: Add ZANNELS feature; tweak recreate after bogus DESTRUCT. X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=bda2e9431bd766765017057c93970a2272597225 Add ZANNELS feature; tweak recreate after bogus DESTRUCT. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1560 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 79148fc..2b2d7b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-11-17 Carlo Wood + + * 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 * tools/convert-conf.py: Delete obsolete code. diff --git a/include/ircd_features.h b/include/ircd_features.h index e452f62..128d019 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -56,6 +56,7 @@ enum Feature { FEAT_HIDDEN_IP, FEAT_CONNEXIT_NOTICES, FEAT_OPLEVELS, + FEAT_ZANNELS, FEAT_LOCAL_CHANNELS, FEAT_TOPIC_BURST, diff --git a/ircd/channel.c b/ircd/channel.c index a93f676..deda7ea 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -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 */ diff --git a/ircd/convert-conf.c b/ircd/convert-conf.c index f65bd7b..5505b3d 100644 --- a/ircd/convert-conf.c +++ b/ircd/convert-conf.c @@ -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. */ diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index ff4a74a..ab3af00 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -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), diff --git a/ircd/m_destruct.c b/ircd/m_destruct.c index cafbb6e..89bc1fc 100644 --- a/ircd/m_destruct.c +++ b/ircd/m_destruct.c @@ -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;