From afdf3e40768ba4c4c33b084b92cdcff335b94bbc Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 23 Oct 2006 09:23:20 +0000 Subject: This needs TESTING: use modestacker when unloading module to group modes. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5531 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_chanprotect.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/modules/m_chanprotect.cpp') diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 89be44788..fff162178 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -77,19 +77,30 @@ class FounderProtectBase { unload_kludge = true; CUList* cl = channel->GetUsers(); - std::string item = extend+std::string(channel->name); - char moderemove[MAXBUF]; + std::string item = extend + std::string(channel->name); + const char* mode_junk[MAXMODES+1]; userrec* n = new userrec(MyInstance); n->SetFd(FD_MAGIC_NUMBER); + mode_junk[0] = channel->name; + irc::modestacker modestack(false); + std::deque stackresult; for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { if (i->second->GetExt(item, dummyptr)) { - sprintf(moderemove,"-%c",mc); - const char* parameters[] = { channel->name, moderemove, i->second->nick }; - MyInstance->SendMode(parameters, 3, n); + modestack.Push(mc, i->second->nick); } } + + while (modestack.GetStackedLine(stackresult)) + { + for (size_t j = 0; j < stackresult.size(); j++) + { + mode_junk[j+1] = stackresult[j].c_str(); + } + MyInstance->SendMode(mode_junk, stackresult.size() + 1, n); + } + delete n; unload_kludge = false; } -- cgit v1.2.3