aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-05-26 23:23:47 +0200
committerGravatar attilamolnar2013-05-27 01:07:29 +0200
commit9bb24d3f458274b7485554bc95f1274900a69ec2 (patch)
tree33ab45d74813198ba1377eab83b6a9904a91801e /src/modules
parentClean up the FileReader class and all of the modules that use it. (diff)
Deduplicate RemoveMode() implementations
The default (core) implementation can now remove prefix modes The modestacker parameter is now mandatory
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_customprefix.cpp30
-rw-r--r--src/modules/m_ojoin.cpp30
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp2
3 files changed, 1 insertions, 61 deletions
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index 48a04d078..6f9f4da28 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -53,36 +53,6 @@ class CustomPrefixMode : public ModeHandler
return MOD_RES_PASSTHRU;
}
- void RemoveMode(Channel* channel, irc::modestacker* stack)
- {
- const UserMembList* cl = channel->GetUsers();
- std::vector<std::string> mode_junk;
- mode_junk.push_back(channel->name);
- irc::modestacker modestack(false);
- std::vector<std::string> stackresult;
-
- for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
- {
- if (i->second->hasMode(mode))
- {
- if (stack)
- stack->Push(this->GetModeChar(), i->first->nick);
- else
- modestack.Push(this->GetModeChar(), i->first->nick);
- }
- }
-
- if (stack)
- return;
-
- while (modestack.GetStackedLine(stackresult))
- {
- mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
- ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
- mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
- }
- }
-
void RemoveMode(User* user, irc::modestacker* stack)
{
}
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 35d90b23e..5b6335580 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -112,36 +112,6 @@ class NetworkPrefix : public ModeHandler
m_paramtype = TR_NICK;
}
- void RemoveMode(Channel* channel, irc::modestacker* stack)
- {
- const UserMembList* cl = channel->GetUsers();
- std::vector<std::string> mode_junk;
- mode_junk.push_back(channel->name);
- irc::modestacker modestack(false);
- std::vector<std::string> stackresult;
-
- for (UserMembCIter i = cl->begin(); i != cl->end(); i++)
- {
- if (i->second->hasMode('Y'))
- {
- if (stack)
- stack->Push(this->GetModeChar(), i->first->nick);
- else
- modestack.Push(this->GetModeChar(), i->first->nick);
- }
- }
-
- if (stack)
- return;
-
- while (modestack.GetStackedLine(stackresult))
- {
- mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
- ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
- mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
- }
- }
-
unsigned int GetPrefixRank()
{
return NETWORK_VALUE;
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index f84c101e0..b25444cda 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -209,7 +209,7 @@ void CommandFJoin::RemoveStatus(Channel* c)
* for this function we require tidyness instead. Fixes bug #493
*/
if (mh)
- mh->RemoveMode(c, &stack);
+ mh->RemoveMode(c, stack);
}
ApplyModeStack(ServerInstance->FakeClient, c, stack);