From 343b92d82b6c9ce0415c26390ad2921c6d54ff67 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 10 Mar 2007 22:06:53 +0000 Subject: This now makes RemoveStatus remove *everything* as pointed out by jilles. This will prevent simplemodes desyncs. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6651 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket2.cpp | 41 ++++-------------------------- 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 464f4e9dc..d287d4724 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -691,8 +691,7 @@ bool TreeSocket::LocalPing(const std::string &prefix, std::deque &p } } -/** TODO: This really should remove *everything* not just status modes (thanks jilles) - * - This means listmodes, simplemodes, etc too. +/** TODO: This creates a total mess of output and needs to really use irc::modestacker. */ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque ¶ms) { @@ -701,41 +700,11 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque chanrec* c = Instance->FindChan(params[0]); if (c) { - irc::modestacker modestack(false); - CUList *ulist = c->GetUsers(); - const char* y[127]; - std::deque stackresult; - std::string x; - for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) + for (char modeletter = 'A'; modeletter <= 'z'; modeletter++) { - std::string modesequence = Instance->Modes->ModeString(i->second, c); - if (modesequence.length()) - { - irc::spacesepstream sep(modesequence); - std::string modeletters = sep.GetToken(); - while (!modeletters.empty()) - { - char mletter = *(modeletters.begin()); - modestack.Push(mletter,sep.GetToken()); - modeletters.erase(modeletters.begin()); - } - } - } - - while (modestack.GetStackedLine(stackresult)) - { - stackresult.push_front(ConvToStr(c->age)); - stackresult.push_front(c->name); - Utils->DoOneToMany(Instance->Config->ServerName, "FMODE", stackresult); - stackresult.erase(stackresult.begin() + 1); - for (size_t z = 0; z < stackresult.size(); z++) - { - y[z] = stackresult[z].c_str(); - } - userrec* n = new userrec(Instance); - n->SetFd(FD_MAGIC_NUMBER); - Instance->SendMode(y, stackresult.size(), n); - delete n; + ModeHandler* mh = Instance->Modes->FindMode(modeletter, MODETYPE_CHANNEL); + if (mh) + mh->RemoveMode(c); } } return true; -- cgit v1.2.3