diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-02 12:59:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-02 12:59:55 +0000 |
commit | f0e0cb4da6fb8ccd2126ebca7d1105bcf72bc5fd (patch) | |
tree | 405ea54e29dd1bd65b3be7be830099913b21fe00 /src/modules/m_spanningtree.cpp | |
parent | 2164b0de1227882c1748528719bfa7550cf1e170 (diff) |
mmmm dinner break, oh and document and make use of modestacker.
Someone test this, i cant as im at work.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5395 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index d46cd6234..e410c5135 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2616,38 +2616,43 @@ class TreeSocket : public InspSocket if (c) { + irc::modestacker modestack(false); CUList *ulist = c->GetUsers(); + const char* y[127]; + std::deque<std::string> stackresult; + std::string x; + for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { std::string modesequence = Instance->Modes->ModeString(i->second, c); if (modesequence.length()) { - modesequence = "-" + modesequence; - - std::deque<std::string> items; - const char* y[127]; - unsigned int z = 0; - std::string x = "*"; irc::spacesepstream sep(modesequence); + std::string modeletters = sep.GetToken(); - while ((x = sep.GetToken()) != "") + while (!modeletters.empty()) { - if (!z) - { - y[z++] = c->name; - items.push_back(c->name); - items.push_back(ConvToStr(c->age)); - } - items.push_back(x); - y[z++] = (items.end() - 1)->c_str(); + char mletter = *(modeletters.begin()); + modestack.Push(mletter,sep.GetToken()); + modeletters.erase(modeletters.begin()); } + } + } - DoOneToMany(Instance->Config->ServerName, "FMODE", items); - userrec* n = new userrec(Instance); - n->SetFd(FD_MAGIC_NUMBER); - Instance->SendMode(y,z,n); - delete n; + while (modestack.GetStackedLine(stackresult)) + { + stackresult.push_front(ConvToStr(c->age)); + stackresult.push_front(c->name); + 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; } } return true; |