From fb551f0d5d412246a5221e8e9e310c191033b317 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 21 Aug 2010 01:40:36 -0400 Subject: Made Anope keep track of channels its clients are in if it splits from its uplink, then burst them back to its uplink once connection is reestablished. Also made Anope use TS enforcement to change persistant channels creation time to the time they were registered. --- modules/core/cs_set_persist.cpp | 4 ++++ modules/core/db_plain.cpp | 38 ++++++++++++++------------------------ modules/core/os_chanlist.cpp | 4 ++-- 3 files changed, 20 insertions(+), 26 deletions(-) (limited to 'modules/core') diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index fe3c84242..955e2082f 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -33,6 +33,8 @@ class CommandCSSetPersist : public Command if (!ci->HasFlag(CI_PERSIST)) { ci->SetFlag(CI_PERSIST); + if (ci->c) + ci->c->SetFlag(CH_PERSIST); /* Channel doesn't exist, create it */ if (!ci->c) @@ -65,6 +67,8 @@ class CommandCSSetPersist : public Command if (ci->HasFlag(CI_PERSIST)) { ci->UnsetFlag(CI_PERSIST); + if (ci->c) + ci->c->UnsetFlag(CH_PERSIST); /* Unset perm mode */ if (cm && ci->c && ci->c->HasMode(CMODE_PERM)) diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 7f90ad6f9..9c47306ca 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -1011,43 +1011,33 @@ class DBPlain : public Module if (ci->GetMLockCount(true)) { db << "MD MLOCK_ON"; - for (std::list::iterator it = ModeManager::Modes.begin(), it_end = ModeManager::Modes.end(); it != it_end; ++it) + for (std::map::iterator it = ModeManager::ChannelModesByChar.begin(), it_end = ModeManager::ChannelModesByChar.end(); it != it_end; ++it) { - if ((*it)->Class == MC_CHANNEL) - { - ChannelMode *cm = debug_cast(*it); - - if (ci->HasMLock(cm->Name, true)) - db << " " << cm->NameAsString; - } + ChannelMode *cm = it->second; + if (ci->HasMLock(cm->Name, true)) + db << " " << cm->NameAsString; } db << endl; } if (ci->GetMLockCount(false)) { db << "MD MLOCK_OFF"; - for (std::list::iterator it = ModeManager::Modes.begin(), it_end = ModeManager::Modes.end(); it != it_end; ++it) - { - if ((*it)->Class == MC_CHANNEL) - { - ChannelMode *cm = debug_cast(*it); - if (ci->HasMLock(cm->Name, false)) - db << " " << cm->NameAsString; - } + for (std::map::iterator it = ModeManager::ChannelModesByChar.begin(), it_end = ModeManager::ChannelModesByChar.end(); it != it_end; ++it) + { + ChannelMode *cm = it->second; + if (ci->HasMLock(cm->Name, false)) + db << " " << cm->NameAsString; } db << endl; } - for (std::list::iterator it = ModeManager::Modes.begin(), it_end = ModeManager::Modes.end(); it != it_end; ++it) + for (std::map::iterator it = ModeManager::ChannelModesByChar.begin(), it_end = ModeManager::ChannelModesByChar.end(); it != it_end; ++it) { - if ((*it)->Class == MC_CHANNEL) - { - ChannelMode *cm = debug_cast(*it); + ChannelMode *cm = it->second; + Anope::string Param; - Anope::string Param; - if (ci->GetParam(cm->Name, Param)) - db << "MD MLP " << cm->NameAsString << " " << Param << endl; - } + if (ci->GetParam(cm->Name, Param)) + db << "MD MLP " << cm->NameAsString << " " << Param << endl; } if (!ci->memos.memos.empty()) { diff --git a/modules/core/os_chanlist.cpp b/modules/core/os_chanlist.cpp index 8fcb1c397..87b3d736d 100644 --- a/modules/core/os_chanlist.cpp +++ b/modules/core/os_chanlist.cpp @@ -46,7 +46,7 @@ class CommandOSChanList : public Command if (!cc->chan->HasMode(*it)) continue; - notice_lang(Config->s_OperServ, u, OPER_CHANLIST_RECORD, cc->chan->name.c_str(), cc->chan->users.size(), chan_get_modes(cc->chan, 1, 1).c_str(), !cc->chan->topic.empty() ? cc->chan->topic.c_str() : ""); + notice_lang(Config->s_OperServ, u, OPER_CHANLIST_RECORD, cc->chan->name.c_str(), cc->chan->users.size(), cc->chan->GetModes(true, true).c_str(), !cc->chan->topic.empty() ? cc->chan->topic.c_str() : ""); } } else @@ -64,7 +64,7 @@ class CommandOSChanList : public Command if (!c->HasMode(*it)) continue; - notice_lang(Config->s_OperServ, u, OPER_CHANLIST_RECORD, c->name.c_str(), c->users.size(), chan_get_modes(c, 1, 1).c_str(), !c->topic.empty() ? c->topic.c_str() : ""); + notice_lang(Config->s_OperServ, u, OPER_CHANLIST_RECORD, c->name.c_str(), c->users.size(), c->GetModes(true, true).c_str(), !c->topic.empty() ? c->topic.c_str() : ""); } } -- cgit