summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h17
-rw-r--r--modules/commands/cs_set.cpp4
-rw-r--r--modules/pseudoclients/botserv.cpp9
-rw-r--r--src/regchannel.cpp4
4 files changed, 11 insertions, 23 deletions
diff --git a/include/channels.h b/include/channels.h
index 3cf337e65..18ef65a7c 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -30,16 +30,12 @@ struct ChanUserContainer : public Extensible
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
};
-enum ChannelFlag
-{
- /* ChanServ is currently holding the channel */
- CH_INHABIT,
- /* Channel still exists when emptied */
- CH_PERSIST,
- /* If set the channel is syncing users (channel was just created) and it should not be deleted */
- CH_SYNCING
-};
-
+/* Possible flags:
+ *
+ * INHABIT - ChanServ is currently holding the channel
+ * PERSIST - Channel still exists when emptied (IRCd enforced)
+ * SYNCING - Channel is syncing users (channel was just created) and it should not be deleted
+ */
class CoreExport Channel : public Base, public Extensible
{
public:
@@ -56,7 +52,6 @@ class CoreExport Channel : public Base, public Extensible
Serialize::Reference<ChannelInfo> ci;
/* When the channel was created */
time_t creation_time;
- std::set<ChannelFlag> flags;
/* Users in the channel */
typedef std::list<ChanUserContainer *> ChanUserList;
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp
index 730f31deb..97948b0a4 100644
--- a/modules/commands/cs_set.cpp
+++ b/modules/commands/cs_set.cpp
@@ -540,8 +540,6 @@ class CommandCSSetPersist : public Command
if (!ci->HasExt("PERSIST"))
{
ci->ExtendMetadata("PERSIST");
- if (ci->c)
- ci->c->Extend("PERSIST");
/* Channel doesn't exist, create it */
if (!ci->c)
@@ -583,8 +581,6 @@ class CommandCSSetPersist : public Command
if (ci->HasExt("PERSIST"))
{
ci->Shrink("PERSIST");
- if (ci->c)
- ci->c->Shrink("PERSIST");
/* Unset perm mode */
if (cm)
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp
index 2c506876a..2f157b809 100644
--- a/modules/pseudoclients/botserv.cpp
+++ b/modules/pseudoclients/botserv.cpp
@@ -184,7 +184,7 @@ class BotServCore : public Module
void OnLeaveChannel(User *u, Channel *c) anope_override
{
/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
- if (c->HasExt("PERSIST") || (c->ci && c->ci->HasExt("PERSIST")))
+ if (c->ci && c->ci->HasExt("PERSIST"))
return;
/* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly
@@ -197,14 +197,9 @@ class BotServCore : public Module
if (c->HasExt("INHABIT"))
return;
+ /* This is called prior to removing the user from the channnel, so c->users.size() - 1 should be safe */
if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->BSMinUsers && c->FindUser(c->ci->bi))
- {
- bool persist = c->Shrink("PERSIST");
- c->Extend("PERSIST");
c->ci->bi->Part(c->ci->c);
- if (!persist)
- c->Shrink("PERSIST");
- }
}
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index acfe5cf91..c4c02ad0e 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -368,7 +368,9 @@ ChannelInfo::~ChannelInfo()
{
if (this->bi && this->c->FindUser(this->bi))
this->bi->Part(this->c);
- this->c->ci = NULL;
+ /* Parting the service bot can cause the channel to go away */
+ if (this->c)
+ this->c->ci = NULL;
}
RegisteredChannelList->erase(this->name);