]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/postcommand.cpp
Fix Windows build and a few more problems
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / postcommand.cpp
index 45b3608c6dc19f74b31145fa0ee6fe66b9a9b5f5..b36cfec20721ea27625237caf2b861ae3e84e54f 100644 (file)
 #include "utils.h"
 #include "treeserver.h"
 
-/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h */
-
 void ModuleSpanningTree::OnPostCommand(Command* command, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line)
 {
        if (result == CMD_SUCCESS)
                Utils->RouteCommand(NULL, command, parameters, user);
 }
 
-void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, const parameterlist& parameters, User* user)
+void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscmd, const parameterlist& parameters, User* user)
 {
        const std::string& command = thiscmd->name;
        RouteDescriptor routing = thiscmd->GetRouting(user, parameters);
@@ -93,27 +91,13 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, c
                        Channel* c = ServerInstance->FindChan(dest);
                        if (!c)
                                return;
-                       TreeServerList list;
                        // TODO OnBuildExemptList hook was here
-                       GetListOfServersForChannel(c,list,pfx, CUList());
-                       std::string data = ":" + user->uuid + " " + sent_cmd;
-                       for (unsigned int x = 0; x < params.size(); x++)
-                               data += " " + params[x];
-                       for (TreeServerList::iterator i = list.begin(); i != list.end(); i++)
-                       {
-                               TreeSocket* Sock = (*i)->GetSocket();
-                               if (origin && origin->GetSocket() == Sock)
-                                       continue;
-                               if (Sock)
-                                       Sock->WriteLine(data);
-                       }
+                       CUList exempts;
+                       SendChannelMessage(user->uuid, c, parameters[1], pfx, exempts, sent_cmd.c_str(), origin ? origin->GetSocket() : NULL);
                }
                else if (dest[0] == '$')
                {
-                       if (origin)
-                               DoOneToAllButSender(user->uuid, sent_cmd, params, origin->GetName());
-                       else
-                               DoOneToMany(user->uuid, sent_cmd, params);
+                       DoOneToAllButSender(user->uuid, sent_cmd, params, origin);
                }
                else
                {
@@ -130,10 +114,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, c
        }
        else if (routing.type == ROUTE_TYPE_BROADCAST || routing.type == ROUTE_TYPE_OPT_BCAST)
        {
-               if (origin)
-                       DoOneToAllButSender(user->uuid, sent_cmd, params, origin->GetName());
-               else
-                       DoOneToMany(user->uuid, sent_cmd, params);
+               DoOneToAllButSender(user->uuid, sent_cmd, params, origin);
        }
        else if (routing.type == ROUTE_TYPE_UNICAST || routing.type == ROUTE_TYPE_OPT_UCAST)
        {