From 369aef56c68aecccac7c3c30108fd958cfdc62f0 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 4 Apr 2008 18:50:09 +0000 Subject: Allow for custom prefixes as status chars in /notice @#chan etc. Up until now theyve just used a hard coded check on @%+. This slows down writing to a channels users by a small amount, but only when writing to a prefix is happening. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9329 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/privmsg.cpp | 2 +- src/modules/m_spanningtree/utils.cpp | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index 4a266a465..316ad2e5c 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -32,7 +32,7 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string const char* target = params[0].c_str(); std::string text = params[1].c_str(); - if ((*target == '@') || (*target == '%') || (*target == '+')) + if (Instance->Modes->FindPrefix(*target)) { status = *target; target++; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 8181969ac..bc295766f 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -162,25 +162,17 @@ void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &li /* returns a list of DIRECT servernames for a specific channel */ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list) { - CUList *ulist; - switch (status) - { - case '@': - ulist = c->GetOppedUsers(); - break; - case '%': - ulist = c->GetHalfoppedUsers(); - break; - case '+': - ulist = c->GetVoicedUsers(); - break; - default: - ulist = c->GetUsers(); - break; - } + CUList *ulist = c->GetUsers(); + for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { - if ((i->first->GetFd() < 0) && (exempt_list.find(i->first) == exempt_list.end())) + if (IS_LOCAL(i->first)) + continue; + + if (status && !strchr(c->GetAllPrefixChars(i->first), status)) + continue; + + if (exempt_list.find(i->first) == exempt_list.end()) { TreeServer* best = this->BestRouteTo(i->first->server); if (best) @@ -199,7 +191,7 @@ bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, cons if (params.size() >= 2) { /* Prefixes */ - if ((*(params[0].c_str()) == '@') || (*(params[0].c_str()) == '%') || (*(params[0].c_str()) == '+')) + if (ServerInstance->Modes->FindPrefix(params[0][0])) { pfx = params[0][0]; params[0] = params[0].substr(1, params[0].length()-1); -- cgit v1.2.3