summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-23 12:10:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-23 12:10:58 +0000
commit4a4443c79bad2e5397140a8aea55d6cc6cadd1ab (patch)
treede16e44af9dbec4d202081fbdfeda7c6a2faf6ad /include
parentafdf3e40768ba4c4c33b084b92cdcff335b94bbc (diff)
banexception, chanfilter, inviteexception: use modestacker to stack modes when the module is unloaded.
This results in e.g. one line of -gggggg rather than 6 lines of -g. NEEDS TESTING. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5532 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/u_listmode.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h
index 79f2af924..0e2f05103 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -67,7 +67,7 @@ class ListModeBase : public ModeHandler
: ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag)
{
this->DoRehash();
- infokey = "exceptionbase_mode_" + std::string(1, mode) + "_list";
+ infokey = "listbase_mode_" + std::string(1, mode) + "_list";
}
std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
@@ -109,22 +109,24 @@ class ListModeBase : public ModeHandler
if (el)
{
ServerInstance->Log(DEBUG,"Channel is extended with a list");
- char moderemove[MAXBUF];
+ irc::modestacker modestack(true);
+ std::deque<std::string> stackresult;
+ const char* mode_junk[MAXMODES+1];
userrec* n = new userrec(ServerInstance);
n->SetFd(FD_MAGIC_NUMBER);
- modelist copy;
- /* Make a copy of it, because we cant change the list whilst iterating over it */
for(modelist::iterator it = el->begin(); it != el->end(); it++)
{
- copy.push_back(*it);
+ modestack.Push(this->GetModeChar(), it->mask);
}
- for(modelist::iterator it = copy.begin(); it != copy.end(); it++)
+ while (modestack.GetStackedLine(stackresult))
{
- ServerInstance->Log(DEBUG,"Remove item %s",it->mask.c_str());
- sprintf(moderemove,"-%c",this->GetModeChar());
- const char* parameters[] = { channel->name, moderemove, it->mask.c_str() };
- ServerInstance->SendMode(parameters, 3, n);
+ for (size_t j = 0; j < stackresult.size(); j++)
+ {
+ mode_junk[j+1] = stackresult[j].c_str();
+ }
+ ServerInstance->SendMode(mode_junk, stackresult.size() + 1, n);
}
+
delete n;
}
}