+ if (!Aliases[i].requires.empty())
+ {
+ u = ServerInstance->FindNick(Aliases[i].requires);
+ if (!u)
+ {
+ user->WriteNumeric(401, ""+std::string(user->nick)+" "+Aliases[i].requires+" :is currently unavailable. Please try again later.");
+ return 1;
+ }
+ }
+ if ((u != NULL) && (!Aliases[i].requires.empty()) && (Aliases[i].uline))
+ {
+ if (!ServerInstance->ULine(u->server))
+ {
+ ServerInstance->SNO->WriteToSnoMask('A', "NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!");
+ user->WriteNumeric(401, ""+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible.");
+ return 1;
+ }
+ }
+
+ /* Now, search and replace in a copy of the original_line, replacing $1 through $9 and $1- etc */
+
+ std::string::size_type crlf = Aliases[i].replace_with.find('\n');
+
+ if (crlf == std::string::npos)
+ {
+ DoCommand(Aliases[i].replace_with, user, safe);
+ return 1;
+ }
+ else
+ {
+ irc::sepstream commands(Aliases[i].replace_with, '\n');
+ std::string scommand;
+ while (commands.GetToken(scommand))
+ {
+ DoCommand(scommand, user, safe);
+ }
+ return 1;
+ }
+ }