- ListAccept(user);
- }
- else if (tok[0] == '-')
- {
- User* whotoremove = ServerInstance->FindNick(tok.substr(1));
- if (whotoremove)
- atleastonechange = RemoveAccept(user, whotoremove, false) || atleastonechange;
- }
- else
- {
- User* whotoadd = ServerInstance->FindNick(tok[0] == '+' ? tok.substr(1) : tok);
- if (whotoadd)
- atleastonechange = AddAccept(user, whotoadd, false) || atleastonechange;
- else
- user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), tok.c_str());
- }
- }
- }
- return atleastonechange ? CMD_FAILURE : CMD_SUCCESS;
+ // The second item in the pair is true if the first char is a '+' (or nothing), false if it's a '-'
+ if (action.second)
+ return (AddAccept(user, action.first) ? CMD_SUCCESS : CMD_FAILURE);
+ else
+ return (RemoveAccept(user, action.first) ? CMD_SUCCESS : CMD_FAILURE);
+ }
+
+ RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ {
+ // There is a list in parameters[0] in two cases:
+ // Either when the source is remote, this happens because 2.0 servers send comma seperated uuid lists,
+ // we don't split those but broadcast them, as before.
+ //
+ // Or if the source is local then LoopCall() runs OnPostCommand() after each entry in the list,
+ // meaning the linking module has sent an ACCEPT already for each entry in the list to the
+ // appropiate server and the ACCEPT with the list of nicks (this) doesn't need to be sent anywhere.
+ if ((!IS_LOCAL(user)) && (parameters[0].find(',') != std::string::npos))
+ return ROUTE_BROADCAST;
+
+ // Find the target
+ std::string targetstring = parameters[0];
+ ACCEPTAction action = GetTargetAndAction(targetstring, user);
+ if (!action.first)
+ // Target is a "*" or source is local and the target is a list of nicks
+ return ROUTE_LOCALONLY;
+
+ // Route to the server of the target
+ return ROUTE_UNICAST(action.first->server);