Allows to use user->ident string instead of user->nick for NickServ.

This commit is contained in:
Boleslaw Tokarski 2012-10-08 15:09:09 +02:00
parent bf002b8ee0
commit 428a5e3d0f
2 changed files with 11 additions and 5 deletions

View File

@ -1267,6 +1267,7 @@
# forwardmsg: Message to send to users using a connect password.
# $nick will be the users' nick, $nickrequired will be the nick
# of where the password is going (the nick above).
# You can also use $user for the user ident string.
forwardmsg="NOTICE $nick :*** Forwarding PASS to $nickrequired"
# cmd: Command for the nick to run when it recieves a connect

View File

@ -47,7 +47,7 @@ class ModulePassForward : public Module
forwardcmd = Conf.ReadValue("passforward", "cmd", "PRIVMSG $nickrequired :IDENTIFY $pass", 0);
}
void FormatStr(std::string& result, const std::string& format, const std::string &nick, const std::string &pass)
void FormatStr(std::string& result, const std::string& format, const LocalUser* user)
{
for (unsigned int i = 0; i < format.length(); i++)
{
@ -61,12 +61,17 @@ class ModulePassForward : public Module
}
else if (format.substr(i, 5) == "$nick")
{
result.append(nick);
result.append(user->nick);
i += 4;
}
else if (format.substr(i, 5) == "$user")
{
result.append(user->ident);
i += 4;
}
else if (format.substr(i,5) == "$pass")
{
result.append(pass);
result.append(user->password);
i += 4;
}
else
@ -92,11 +97,11 @@ class ModulePassForward : public Module
}
std::string tmp;
FormatStr(tmp,forwardmsg, user->nick, user->password);
FormatStr(tmp,forwardmsg, user);
user->WriteServ(tmp);
tmp.clear();
FormatStr(tmp,forwardcmd, user->nick, user->password);
FormatStr(tmp,forwardcmd, user);
ServerInstance->Parser->ProcessBuffer(tmp,user);
}
};