+ if (!user)
+ printf("\n");
+ }
+
+ if (cmdlist.find("RELOAD") == cmdlist.end())
+ this->CreateCommand(new cmd_reload(ServerInstance));
+}
+
+int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, std::string &dest)
+{
+ userrec* user = NULL;
+ std::string item;
+ int translations = 0;
+
+ switch (to)
+ {
+ case TR_NICK:
+ /* Translate single nickname */
+ ServerInstance->Log(DEBUG,"TR_NICK");
+ user = ServerInstance->FindNick(source);
+ if (user)
+ {
+ ServerInstance->Log(DEBUG,"Managed UUID");
+ dest = user->uuid;
+ translations++;
+ }
+ else
+ {
+ ServerInstance->Log(DEBUG,"Had to use source.. (%s)", source.c_str());
+ dest = source;
+ }
+ break;
+ case TR_NICKLIST:
+ {
+ /* Translate comma seperated list of nicknames */
+ irc::commasepstream items(source);
+ while (items.GetToken(item))
+ {
+ user = ServerInstance->FindNick(item);
+ if (user)
+ {
+ dest.append(user->uuid);
+ translations++;
+ }
+ else
+ dest.append(source);
+ dest.append(",");
+ }
+ if (!dest.empty())
+ dest.erase(dest.end() - 1);
+ }
+ break;
+ case TR_SPACENICKLIST:
+ {
+ /* Translate space seperated list of nicknames */
+ irc::spacesepstream items(source);
+ while (items.GetToken(item))
+ {
+ user = ServerInstance->FindNick(item);
+ if (user)
+ {
+ dest.append(user->uuid);
+ translations++;
+ }
+ else
+ dest.append(source);
+ dest.append(" ");
+ }
+ if (!dest.empty())
+ dest.erase(dest.end() - 1);
+ }
+ break;
+ case TR_END:
+ case TR_TEXT:
+ default:
+ /* Do nothing */
+ dest = source;
+ break;