Permalink
Browse files

NickServ module : Make NickServ nickname configurable.

On some networks, NickServ is named differently and this makes NickServ module unable to auto-ident.
This patch enables configuration of NickServ nickname to make it works on such IRC networks.
  • Loading branch information...
1 parent 3be9c7a commit 73f794c455c905be5529587357d65b6e501a0582 @Jyzee Jyzee committed Sep 13, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 modules/nickserv.cpp
View
@@ -26,6 +26,15 @@ class CNickServ : public CModule {
DelNV("Password");
}
+ void SetNSNameCommand(const CString& sLine) {
+ SetNV("NickServName", sLine.Token(1, true));
+ PutModule("NickServ name set");
+ }
+
+ void ClearNSNameCommand(const CString& sLine) {
+ DelNV("NickServName");
+ }
+
void GhostCommand(const CString& sLine) {
if (sLine.Token(1).empty()) {
PutModule("Syntax: ghost <nickname>");
@@ -92,6 +101,10 @@ class CNickServ : public CModule {
"password");
AddCommand("Clear", static_cast<CModCommand::ModCmdFunc>(&CNickServ::ClearCommand),
"", "Clear your nickserv password");
+ AddCommand("SetNSName", static_cast<CModCommand::ModCmdFunc>(&CNickServ::SetNSNameCommand),
+ "nickname", "Set NickServ name (Useful on networks like EpiKnet, where NickServ is named Themis)");
+ AddCommand("ClearNSName", static_cast<CModCommand::ModCmdFunc>(&CNickServ::ClearNSNameCommand),
+ "", "Reset NickServ name to default (NickServ)");
AddCommand("Ghost", static_cast<CModCommand::ModCmdFunc>(&CNickServ::GhostCommand),
"nickname", "GHOST disconnects an old user session, or somebody attempting to use your nickname without authorization.");
AddCommand("Recover", static_cast<CModCommand::ModCmdFunc>(&CNickServ::RecoverCommand),
@@ -134,8 +147,9 @@ class CNickServ : public CModule {
}
void HandleMessage(CNick& Nick, const CString& sMessage) {
+ CString sNickServName = (!GetNV("NickServName").empty()) ? GetNV("NickServName") : "NickServ";
if (!GetNV("Password").empty()
- && Nick.GetNick().Equals("NickServ")
+ && Nick.GetNick().Equals(sNickServName)
&& (sMessage.find("msg") != CString::npos
|| sMessage.find("authenticate") != CString::npos
|| sMessage.find("choose a different nickname") != CString::npos

0 comments on commit 73f794c

Please sign in to comment.