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); }
RouteDescriptor CommandRConnect::GetRouting(User* user, const Params& parameters) { return ROUTE_UNICAST(parameters[0]); }
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) { if (parameters.size() > 0) return ROUTE_UNICAST(parameters[0]); return ROUTE_LOCALONLY; }
RouteDescriptor CommandNum::GetRouting(User* user, const std::vector<std::string>& params) { return ROUTE_UNICAST(params[1]); }
RouteDescriptor CommandRConnect::GetRouting(User* user, const std::vector<std::string>& parameters) { return ROUTE_UNICAST(parameters[0]); }
RouteDescriptor CommandEncap::GetRouting(User* user, const std::vector<std::string>& params) { if (params[0].find_first_of("*?") != std::string::npos) return ROUTE_BROADCAST; return ROUTE_UNICAST(params[0]); }
RouteDescriptor CommandMap::GetRouting(User* user, const std::vector<std::string>& parameters) { if (!parameters.empty()) return ROUTE_UNICAST(parameters[0]); return ROUTE_LOCALONLY; }