diff options
-rw-r--r-- | include/u_listmode.h | 10 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 13 |
2 files changed, 19 insertions, 4 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h index f2abf70ca..2d973f40d 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -301,13 +301,21 @@ class ListModeBase : public ModeHandler { modelist* list; chan->GetExt(infokey, list); + irc::modestacker modestack(true); + std::deque<std::string> stackresult; if (list) { for (modelist::iterator it = list->begin(); it != list->end(); it++) { - proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, "+" + std::string(1, mode) + " " + it->mask); + modestack.Push(std::string(1, mode)[0], it->mask); } } + while (modestack.GetStackedLine(stackresult)) + { + irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1); + std::string line = mode_join.GetJoined(); + proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan, line); + } } virtual void DoCleanup(int target_type, void* item) diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 880e7c20d..89be44788 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -466,18 +466,25 @@ class ModuleChanProtect : public Module string_list commands; std::string founder = "cm_founder_"+std::string(chan->name); std::string protect = "cm_protect_"+std::string(chan->name); + irc::modestacker modestack(true); + std::deque<std::string> stackresult; for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { if (i->second->GetExt(founder,dummyptr)) { - proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+q "+std::string(i->second->nick)); + modestack.Push('q',i->second->nick); } if (i->second->GetExt(protect,dummyptr)) { - proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan,"+a "+std::string(i->second->nick)); - + modestack.Push('a',i->second->nick); } } + while (modestack.GetStackedLine(stackresult)) + { + irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1); + std::string line = mode_join.GetJoined(); + proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan, line); + } } } |