]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_remove Manually forward all REMOVE messages, turn FPART into REMOVE
authorAttila Molnar <attilamolnar@hush.com>
Mon, 9 Jun 2014 15:40:22 +0000 (17:40 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 9 Jun 2014 15:40:22 +0000 (17:40 +0200)
src/modules/m_remove.cpp

index ed9b6ce253876f7e3ebb8969431cda6b613288a3..2530f3ef16909e85796fec026decc6eeaef3ba14 100644 (file)
@@ -100,9 +100,20 @@ class RemoveBase : public Command
                         */
                        if ((!IS_LOCAL(user)) || ((ulevel > VOICE_VALUE) && (ulevel >= tlevel) && (tlevel != 50000)))
                        {
-                               // REMOVE/FPART will be sent to the target's server and it will reply with a PART (or do nothing if it doesn't understand the command)
+                               // REMOVE will be sent to the target's server and it will reply with a PART (or do nothing if it doesn't understand the command)
                                if (!IS_LOCAL(target))
+                               {
+                                       // Send an ENCAP REMOVE with parameters being in the old <user> <chan> order which is
+                                       // compatible with both 2.0 and 2.2. This also turns FPART into REMOVE.
+                                       std::vector<std::string> p;
+                                       p.push_back(target->uuid);
+                                       p.push_back(channel->name);
+                                       if (parameters.size() > 2)
+                                               p.push_back(":" + parameters[2]);
+                                       ServerInstance->PI->SendEncapsulatedData(target->server->GetName(), "REMOVE", p, user);
+
                                        return CMD_SUCCESS;
+                               }
 
                                std::string reasonparam;
 
@@ -135,7 +146,6 @@ class RemoveBase : public Command
 
                return CMD_SUCCESS;
        }
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) = 0;
 };
 
 /** Handle /REMOVE
@@ -154,14 +164,6 @@ class CommandRemove : public RemoveBase
        {
                return HandleRMB(parameters, user, false);
        }
-
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
-       {
-               User* dest = ServerInstance->FindNick(parameters[0]);
-               if (dest)
-                       return ROUTE_OPT_UCAST(dest->server);
-               return ROUTE_LOCALONLY;
-       }
 };
 
 /** Handle /FPART
@@ -180,14 +182,6 @@ class CommandFpart : public RemoveBase
        {
                return HandleRMB(parameters, user, true);
        }
-
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
-       {
-               User* dest = ServerInstance->FindNick(parameters[1]);
-               if (dest)
-                       return ROUTE_OPT_UCAST(dest->server);
-               return ROUTE_LOCALONLY;
-       }
 };
 
 class ModuleRemove : public Module