1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 20:43:12 +02:00

Also defer channel deletion when processing sjoins

This commit is contained in:
Adam
2016-03-19 16:21:40 -04:00
parent 72127e1b00
commit 79e7c3f98a
3 changed files with 10 additions and 3 deletions
+2
View File
@@ -302,6 +302,8 @@ class CoreExport Channel : public Base, public Extensible
*/
static Channel *FindOrCreate(const Anope::string &name, bool &created, time_t ts = Anope::CurTime);
void QueueForDeletion();
static void DeleteChannels();
};
+7 -2
View File
@@ -168,8 +168,7 @@ void Channel::DeleteUser(User *user)
Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent channel " << this->name << " from " << user->nick << "'s channel list";
delete cu;
if (std::find(deleting.begin(), deleting.end(), this) == deleting.end())
deleting.push_back(this);
QueueForDeletion();
}
ChanUserContainer *Channel::FindUser(User *u) const
@@ -938,6 +937,12 @@ Channel *Channel::FindOrCreate(const Anope::string &name, bool &created, time_t
return chan;
}
void Channel::QueueForDeletion()
{
if (std::find(deleting.begin(), deleting.end(), this) == deleting.end())
deleting.push_back(this);
}
void Channel::DeleteChannels()
{
for (unsigned int i = 0; i < deleting.size(); ++i)
+1 -1
View File
@@ -162,7 +162,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
c->Sync();
if (c->CheckDelete())
delete c;
c->QueueForDeletion();
}
}
}