summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example.conf5
-rw-r--r--data/nickserv.example.conf41
-rw-r--r--include/config.h2
-rw-r--r--include/services.h20
-rw-r--r--modules/commands/ns_ghost.cpp2
-rw-r--r--modules/commands/ns_group.cpp8
-rw-r--r--modules/commands/ns_logout.cpp6
-rw-r--r--modules/commands/ns_recover.cpp7
-rw-r--r--modules/commands/ns_register.cpp12
-rw-r--r--modules/commands/ns_release.cpp2
-rw-r--r--modules/commands/ns_saset.cpp43
-rw-r--r--modules/commands/ns_set.cpp38
-rw-r--r--modules/commands/ns_set_display.cpp99
-rw-r--r--modules/commands/ns_set_kill.cpp2
-rw-r--r--modules/protocol/bahamut.cpp29
-rw-r--r--modules/protocol/inspircd-ts6.h9
-rw-r--r--modules/protocol/inspircd11.cpp8
-rw-r--r--modules/protocol/inspircd12.cpp2
-rw-r--r--modules/protocol/inspircd20.cpp2
-rw-r--r--modules/protocol/plexus.cpp11
-rw-r--r--modules/protocol/ratbox.cpp13
-rw-r--r--modules/protocol/unreal.cpp14
-rw-r--r--modules/pseudoclients/nickserv.cpp30
-rw-r--r--src/config.cpp1
-rw-r--r--src/users.cpp6
25 files changed, 231 insertions, 181 deletions
diff --git a/data/example.conf b/data/example.conf
index 04a237023..5d6e342ad 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -508,6 +508,11 @@ options
* from HELP output.
*/
hideprivilegedcommands = no
+
+ /*
+ * If set, Services do not allow ownership of nick names, only ownership of accounts.
+ */
+ nonicknameownership = no
}
/*
diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf
index 5c60c60d8..089bc86c8 100644
--- a/data/nickserv.example.conf
+++ b/data/nickserv.example.conf
@@ -440,25 +440,33 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas
/*
* ns_saset
*
- * Provides commands nickserv/saset, nickserv/saset/display, and nickserv/saset/password.
+ * Provides commands nickserv/saset, nickserv/saset/password.
*
- * Used as a help wrapper for SASET commands, and used to force change users display name or password.
+ * Used as a help wrapper for SASET commands, and used to force change users password.
*/
module { name = "ns_saset" }
command { service = "NickServ"; name = "SASET"; command = "nickserv/saset"; }
-command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; }
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; }
/*
+ * ns_saset_noexpire
+ *
+ * Provides the command nickserv/saset/noexpire.
+ *
+ * Used for configuring noexpire, which prevents nicks from expiring.
+ */
+module { name = "ns_saset_noexpire" }
+command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire" }
+
+/*
* ns_set
*
- * Provides the commands nickserv/set, nickserv/set/display, and nickserv/set/password.
+ * Provides the commands nickserv/set, nickserv/set/password.
*
- * Used as a help wrapper for SET commands, and used for users to change their display name or password.
+ * Used as a help wrapper for SET commands, and used for users to change their password.
*/
module { name = "ns_set" }
command { service = "NickServ"; name = "SET"; command = "nickserv/set"; }
-command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
/*
@@ -473,6 +481,17 @@ command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/aut
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
/*
+ * ns_set_display
+ *
+ * Provides the commands nickserv/set/display and nickserv/saset/display.
+ *
+ * Used for setting users display names.
+ */
+module { name = "ns_set_display" }
+command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
+command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; permission = "nickserv/saset/display"; }
+
+/*
* ns_set_email
*
* Provides the commands nickserv/set/email and nickserv/saset/email.
@@ -561,16 +580,6 @@ command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/sec
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
/*
- * ns_saset_noexpire
- *
- * Provides the command nickserv/saset/noexpire.
- *
- * Used for configuring noexpire, which prevents nicks from expiring.
- */
-module { name = "ns_saset_noexpire" }
-command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire" }
-
-/*
* ns_sendpass
*
* Provides the command nickserv/sendpass.
diff --git a/include/config.h b/include/config.h
index 47b4c36e1..e333a06fd 100644
--- a/include/config.h
+++ b/include/config.h
@@ -423,6 +423,8 @@ class CoreExport ServerConfig
int RetryWait;
/* If services should hide unprivileged commands */
bool HidePrivilegedCommands;
+ /* If set, nicks cant be owned/everything is entirely account based */
+ bool NoNicknameOwnership;
/* A vector of our logfile options */
std::vector<LogInfo *> LogInfos;
diff --git a/include/services.h b/include/services.h
index e863ab8d1..59f088d61 100644
--- a/include/services.h
+++ b/include/services.h
@@ -836,7 +836,6 @@ class CoreExport IRCDProto
virtual void SendSZLineDel(const XLine *) { }
virtual void SendSZLine(User *u, const XLine *) { }
virtual void SendSGLine(User *, const XLine *) { }
- virtual void SendUnregisteredNick(const User *) { }
virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendSVSJoin(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendSWhois(const Anope::string &, const Anope::string &, const Anope::string &) { }
@@ -846,23 +845,8 @@ class CoreExport IRCDProto
virtual bool IsNickValid(const Anope::string &) { return true; }
virtual bool IsChannelValid(const Anope::string &);
virtual void SendNumeric(const Anope::string &source, int numeric, const Anope::string &dest, const char *fmt, ...);
-
- /** Sends a message logging a user into an account, where ircds support such a feature.
- * @param u The user logging in
- * @param account The account the user is logging into
- */
- virtual void SendAccountLogin(const User *u, const NickCore *account) { }
-
- /** Sends a message logging a user out of an account, where ircds support such a feature.
- * @param u The user logging out
- * @param account The account the user is logging out of
- */
- virtual void SendAccountLogout(const User *u, const NickCore *account) { }
-
- /** Set a users auto identification token
- * @param u The user
- */
- virtual void SetAutoIdentificationToken(User *u) { }
+ virtual void SendLogin(User *u) = 0;
+ virtual void SendLogout(User *u) = 0;
/** Send a channel creation message to the uplink.
* On most TS6 IRCds this is a SJOIN with no nick
diff --git a/modules/commands/ns_ghost.cpp b/modules/commands/ns_ghost.cpp
index db4ff1dcd..a03ca9a3f 100644
--- a/modules/commands/ns_ghost.cpp
+++ b/modules/commands/ns_ghost.cpp
@@ -115,6 +115,8 @@ class NSGhost : public Module
{
this->SetAuthor("Anope");
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp
index b41cad09d..6a83f4f46 100644
--- a/modules/commands/ns_group.cpp
+++ b/modules/commands/ns_group.cpp
@@ -109,10 +109,10 @@ class CommandNSGroup : public Command
na->time_registered = na->last_seen = Anope::CurTime;
u->Login(na->nc);
+ ircdproto->SendLogin(u);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target));
- if (target->nc->HasFlag(NI_UNCONFIRMED) == false)
- ircdproto->SendAccountLogin(u, u->Account());
- ircdproto->SetAutoIdentificationToken(u);
Log(LOG_COMMAND, u, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
source.Reply(_("You are now in the group of \002%s\002."), target->nick.c_str());
@@ -296,6 +296,8 @@ class NSGroup : public Module
{
this->SetAuthor("Anope");
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/commands/ns_logout.cpp b/modules/commands/ns_logout.cpp
index 63798cdcb..fb958fd90 100644
--- a/modules/commands/ns_logout.cpp
+++ b/modules/commands/ns_logout.cpp
@@ -51,10 +51,8 @@ class CommandNSLogout : public Command
else
source.Reply(_("Your nick has been logged out."));
- ircdproto->SendAccountLogout(u2, u2->Account());
- u2->RemoveMode(source.owner, UMODE_REGISTERED);
- ircdproto->SendUnregisteredNick(u2);
-
+ ircdproto->SendLogout(u2);
+ u2->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED);
u2->Logout();
/* Send out an event */
diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp
index f1a22129d..a6761db51 100644
--- a/modules/commands/ns_recover.cpp
+++ b/modules/commands/ns_recover.cpp
@@ -23,9 +23,8 @@ class CommandNSRecover : public Command
if (u->Account() == na->nc)
{
- ircdproto->SendAccountLogout(u, u->Account());
- u->RemoveMode(source.owner, UMODE_REGISTERED);
- ircdproto->SendUnregisteredNick(u);
+ ircdproto->SendLogout(u);
+ u->RemoveMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
u->Collide(na);
@@ -133,6 +132,8 @@ class NSRecover : public Module
{
this->SetAuthor("Anope");
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index acfcd2acd..303321551 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -53,9 +53,10 @@ class CommandNSConfirm : public Command
Log(LOG_COMMAND, u, this) << "to confirm their email";
source.Reply(_("Your email address of \002%s\002 has been confirmed."), u->Account()->email.c_str());
u->Account()->UnsetFlag(NI_UNCONFIRMED);
- ircdproto->SendAccountLogin(u, u->Account());
+
+ ircdproto->SendLogin(u);
NickAlias *na = findnick(u->nick);
- if (na && na->nc == u->Account())
+ if (!Config->NoNicknameOwnership && na != NULL && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
else
@@ -199,8 +200,11 @@ class CommandNSRegister : public Command
}
}
else
- ircdproto->SendAccountLogin(u, u->Account());
- ircdproto->SetAutoIdentificationToken(u);
+ {
+ ircdproto->SendLogin(u);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
+ }
u->lastnickreg = Anope::CurTime;
}
diff --git a/modules/commands/ns_release.cpp b/modules/commands/ns_release.cpp
index eb8a42729..0fdc2517c 100644
--- a/modules/commands/ns_release.cpp
+++ b/modules/commands/ns_release.cpp
@@ -103,6 +103,8 @@ class NSRelease : public Module
{
this->SetAuthor("Anope");
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/commands/ns_saset.cpp b/modules/commands/ns_saset.cpp
index d8305e43a..481b8655e 100644
--- a/modules/commands/ns_saset.cpp
+++ b/modules/commands/ns_saset.cpp
@@ -55,46 +55,6 @@ class CommandNSSASet : public Command
}
};
-class CommandNSSASetDisplay : public Command
-{
- public:
- CommandNSSASetDisplay(Module *creator) : Command(creator, "nickserv/saset/display", 2, 2)
- {
- this->SetDesc(_("Set the display of the group in Services"));
- this->SetSyntax(_("\037nickname\037 \037new-display\037"));
- }
-
- void Execute(CommandSource &source, const std::vector<Anope::string> &params)
- {
- NickAlias *setter_na = findnick(params[0]);
- if (setter_na == NULL)
- {
- source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
- return;
- }
- NickCore *nc = setter_na->nc;
-
- NickAlias *na = findnick(params[1]);
- if (!na || na->nc != nc)
- {
- source.Reply(_("The new display for \002%s\002 MUST be a nickname of the nickname group!"), nc->display.c_str());
- return;
- }
-
- change_core_display(nc, params[1]);
- source.Reply(NICK_SET_DISPLAY_CHANGED, nc->display.c_str());
- return;
- }
-
- bool OnHelp(CommandSource &source, const Anope::string &)
- {
- this->SendSyntax(source);
- source.Reply(_("Changes the display used to refer to the nickname group in \n"
- "Services. The new display MUST be a nick of the group."));
- return true;
- }
-};
-
class CommandNSSASetPassword : public Command
{
public:
@@ -155,12 +115,11 @@ class CommandNSSASetPassword : public Command
class NSSASet : public Module
{
CommandNSSASet commandnssaset;
- CommandNSSASetDisplay commandnssasetdisplay;
CommandNSSASetPassword commandnssasetpassword;
public:
NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandnssaset(this), commandnssasetdisplay(this), commandnssasetpassword(this)
+ commandnssaset(this), commandnssasetpassword(this)
{
this->SetAuthor("Anope");
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 11334565f..a3f2a1950 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -55,41 +55,6 @@ class CommandNSSet : public Command
}
};
-class CommandNSSetDisplay : public Command
-{
- public:
- CommandNSSetDisplay(Module *creator) : Command(creator, "nickserv/set/display", 1)
- {
- this->SetDesc(_("Set the display of your group in Services"));
- this->SetSyntax(_("\037new-display\037"));
- }
-
- void Execute(CommandSource &source, const std::vector<Anope::string> &params)
- {
- User *u = source.u;
- NickAlias *na = findnick(params[1]);
-
- if (!na || na->nc != u->Account())
- {
- source.Reply(_("The new display MUST be a nickname of your nickname group!"));
- return;
- }
-
- change_core_display(u->Account(), params[1]);
- source.Reply(NICK_SET_DISPLAY_CHANGED, u->Account()->display.c_str());
- return;
- }
-
- bool OnHelp(CommandSource &source, const Anope::string &)
- {
- this->SendSyntax(source);
- source.Reply(" ");
- source.Reply(_("Changes the display used to refer to your nickname group in \n"
- "Services. The new display MUST be a nick of your group."));
- return true;
- }
-};
-
class CommandNSSetPassword : public Command
{
public:
@@ -140,12 +105,11 @@ class CommandNSSetPassword : public Command
class NSSet : public Module
{
CommandNSSet commandnsset;
- CommandNSSetDisplay commandnssetdisplay;
CommandNSSetPassword commandnssetpassword;
public:
NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandnsset(this), commandnssetdisplay(this), commandnssetpassword(this)
+ commandnsset(this), commandnssetpassword(this)
{
this->SetAuthor("Anope");
diff --git a/modules/commands/ns_set_display.cpp b/modules/commands/ns_set_display.cpp
new file mode 100644
index 000000000..a2328247c
--- /dev/null
+++ b/modules/commands/ns_set_display.cpp
@@ -0,0 +1,99 @@
+/* NickServ core functions
+ *
+ * (C) 2003-2011 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ */
+
+/*************************************************************************/
+
+#include "module.h"
+
+class CommandNSSetDisplay : public Command
+{
+ public:
+ CommandNSSetDisplay(Module *creator, const Anope::string &sname = "nickserv/set/display", size_t min = 1) : Command(creator, sname, min, min + 1)
+ {
+ this->SetDesc(_("Set the display of your group in Services"));
+ this->SetSyntax(_("\037new-display\037"));
+ }
+
+ void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
+ {
+ NickAlias *user_na = findnick(user), *na = findnick(param);
+
+ if (user_na == NULL)
+ {
+ source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
+ return;
+ }
+ else if (!na || na->nc != user_na->nc)
+ {
+ source.Reply(_("The new display MUST be a nickname of the nickname group %s"), user_na->nc->display.c_str());
+ return;
+ }
+
+ change_core_display(user_na->nc, na->nick);
+ source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str());
+ }
+
+ void Execute(CommandSource &source, const std::vector<Anope::string> &params)
+ {
+ this->Run(source, source.u->Account()->display, params[0]);
+ }
+
+ bool OnHelp(CommandSource &source, const Anope::string &)
+ {
+ this->SendSyntax(source);
+ source.Reply(" ");
+ source.Reply(_("Changes the display used to refer to your nickname group in \n"
+ "Services. The new display MUST be a nick of your group."));
+ return true;
+ }
+};
+
+class CommandNSSASetDisplay : public CommandNSSetDisplay
+{
+ public:
+ CommandNSSASetDisplay(Module *creator) : CommandNSSetDisplay(creator, "nickserv/saset/display", 2)
+ {
+ this->ClearSyntax();
+ this->SetSyntax(_("\037nickname\037 \037new-display\037"));
+ }
+
+ void Execute(CommandSource &source, const std::vector<Anope::string> &params)
+ {
+ this->Run(source, params[0], params[1]);
+ }
+
+ bool OnHelp(CommandSource &source, const Anope::string &)
+ {
+ this->SendSyntax(source);
+ source.Reply(" ");
+ source.Reply(_("Changes the display used to refer to the nickname group in \n"
+ "Services. The new display MUST be a nick of your group."));
+ return true;
+ }
+};
+
+class NSSetDisplay : public Module
+{
+ CommandNSSetDisplay commandnssetdisplay;
+ CommandNSSASetDisplay commandnssasetdisplay;
+
+ public:
+ NSSetDisplay(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
+ commandnssetdisplay(this), commandnssasetdisplay(this)
+ {
+ this->SetAuthor("Anope");
+
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
+ }
+};
+
+MODULE_INIT(NSSetDisplay)
diff --git a/modules/commands/ns_set_kill.cpp b/modules/commands/ns_set_kill.cpp
index ed15d57f4..33a8a2531 100644
--- a/modules/commands/ns_set_kill.cpp
+++ b/modules/commands/ns_set_kill.cpp
@@ -141,6 +141,8 @@ class NSSetKill : public Module
{
this->SetAuthor("Anope");
+ if (Config->NoNicknameOwnership)
+ throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 2ae061009..7b9f1495c 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -218,13 +218,6 @@ class BahamutIRCdProto : public IRCDProto
send_cmd("", "NICK %s 1 %ld %s %s %s %s 0 0 :%s", u->nick.c_str(), static_cast<long>(u->timestamp), modes.c_str(), u->GetIdent().c_str(), u->host.c_str(), u->server->GetName().c_str(), u->realname.c_str());
}
- /* SVSMODE +d */
- /* nc_change was = 1, and there is no na->status */
- void SendUnregisteredNick(const User *u)
- {
- ircdproto->SendMode(findbot(Config->NickServ), u, "+d 1");
- }
-
/* SERVER */
void SendServer(const Server *server)
{
@@ -240,14 +233,6 @@ class BahamutIRCdProto : public IRCDProto
bahamut_cmd_burst();
}
- void SetAutoIdentificationToken(User *u)
- {
- if (!u->Account())
- return;
-
- ircdproto->SendMode(findbot(Config->NickServ), u, "+d %d", u->timestamp);
- }
-
void SendChannel(Channel *c)
{
Anope::string modes = c->GetModes(true, true);
@@ -255,6 +240,18 @@ class BahamutIRCdProto : public IRCDProto
modes = "+";
send_cmd("", "SJOIN %ld %s %s :", static_cast<long>(c->creation_time), c->name.c_str(), modes.c_str());
}
+
+ void SendLogin(User *u)
+ {
+ BotInfo *ns = findbot(Config->NickServ);
+ ircdproto->SendMode(ns, u, "+d %d", u->timestamp);
+ }
+
+ void SendLogout(User *u)
+ {
+ BotInfo *ns = findbot(Config->NickServ);
+ ircdproto->SendMode(ns, u, "+d 1");
+ }
};
class BahamutIRCdMessage : public IRCdMessage
@@ -303,7 +300,7 @@ class BahamutIRCdMessage : public IRCdMessage
if (user->timestamp == convertTo<time_t>(params[7]) && (na = findnick(user->nick)))
{
user->Login(na->nc);
- if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
else
diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h
index 2eab151cf..f8e64e935 100644
--- a/modules/protocol/inspircd-ts6.h
+++ b/modules/protocol/inspircd-ts6.h
@@ -239,12 +239,15 @@ class InspIRCdTS6Proto : public IRCDProto
send_cmd(source ? source->GetUID() : Config->Numeric, "SNONOTICE A :%s", buf.c_str());
}
- void SendAccountLogin(const User *u, const NickCore *account)
+ void SendLogin(User *u)
{
- send_cmd(Config->Numeric, "METADATA %s accountname :%s", u->GetUID().c_str(), account->display.c_str());
+ if (!u->Account() || u->Account()->HasFlag(NI_UNCONFIRMED))
+ return;
+
+ send_cmd(Config->Numeric, "METADATA %s accountname :%s", u->GetUID().c_str(), u->Account()->display.c_str());
}
- void SendAccountLogout(const User *u, const NickCore *account)
+ void SendLogout(User *u)
{
send_cmd(Config->Numeric, "METADATA %s accountname :", u->GetUID().c_str());
}
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 062ad92f0..88371759b 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -261,16 +261,18 @@ class InspIRCdProto : public IRCDProto
send_cmd("", "ENDBURST");
}
- void SetAutoIdentificationToken(User *u)
+ void SendLogin(User *u)
{
if (!u->Account())
return;
Anope::string svidbuf = stringify(u->timestamp);
-
u->Account()->Extend("authenticationtoken", new ExtensibleString(svidbuf));
}
+ void SendLogout(User *u)
+ {
+ }
};
class ChannelModeFlood : public ChannelModeParam
@@ -324,7 +326,7 @@ class InspircdIRCdMessage : public IRCdMessage
if (na && svidbuf && *svidbuf == params[0])
{
user->Login(na->nc);
- if (na->nc->HasFlag(NI_UNCONFIRMED))
+ if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
else if (nickserv)
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 6175e2f52..80a40311c 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -269,7 +269,7 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
u->Login(nc);
NickAlias *user_na = findnick(u->nick);
- if (nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ if (!Config->NoNicknameOwnership && nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
}
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 852f0c4e0..6586044aa 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -280,7 +280,7 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
u->Login(nc);
NickAlias *user_na = findnick(u->nick);
- if (nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ if (!Config->NoNicknameOwnership && nickserv && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
}
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 3b108b470..df03ce940 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -226,12 +226,15 @@ class PlexusProto : public IRCDProto
send_cmd(source->GetUID(), "INVITE %s %s", u ? u->GetUID().c_str() : nick.c_str(), chan.c_str());
}
- void SendAccountLogin(const User *u, const NickCore *account)
+ void SendLogin(User *u)
{
- send_cmd(Config->Numeric, "ENCAP * SU %s %s", u->GetUID().c_str(), account->display.c_str());
+ if (!u->Account())
+ return;
+
+ send_cmd(Config->Numeric, "ENCAP * SU %s %s", u->GetUID().c_str(), u->Account()->display.c_str());
}
- void SendAccountLogout(const User *u, const NickCore *account)
+ void SendLogout(User *u)
{
send_cmd(Config->Numeric, "ENCAP * SU %s", u->GetUID().c_str());
}
@@ -558,7 +561,7 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
if (u && nc)
{
u->Login(nc);
- if (user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
}
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 2a135287b..e5f7a759a 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -207,12 +207,15 @@ class RatboxProto : public IRCDProto
send_cmd(source->GetUID(), "INVITE %s %s", u ? u->GetUID().c_str() : nick.c_str(), chan.c_str());
}
- void SendAccountLogin(const User *u, const NickCore *account)
+ void SendLogin(User *u)
{
- send_cmd(Config->Numeric, "ENCAP * SU %s %s", u->GetUID().c_str(), account->display.c_str());
+ if (!u->Account())
+ return;
+
+ send_cmd(Config->Numeric, "ENCAP * SU %s %s", u->GetUID().c_str(), u->Account()->display.c_str());
}
- void SendAccountLogout(const User *u, const NickCore *account)
+ void SendLogout(User *u)
{
send_cmd(Config->Numeric, "ENCAP * SU %s", u->GetUID().c_str());
}
@@ -479,6 +482,10 @@ bool event_encap(const Anope::string &source, const std::vector<Anope::string> &
if (!u || !nc)
return true;
u->Login(nc);
+
+ NickAlias *user_na = findnick(u->nick);
+ if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
return true;
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index d3d0ba1dd..aa806fe21 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -318,17 +318,19 @@ class UnrealIRCdProto : public IRCDProto
return true;
}
- void SetAutoIdentificationToken(User *u)
+ void SendLogin(User *u)
{
if (!u->Account())
return;
- ircdproto->SendMode(findbot(Config->NickServ), u, "+d %d", u->timestamp);
+ BotInfo *ns = findbot(Config->NickServ);
+ ircdproto->SendMode(ns, u, "+d %d", u->timestamp);
}
- void SendUnregisteredNick(const User *u)
+ void SendLogout(User *u)
{
- ircdproto->SendMode(findbot(Config->NickServ), u, "+d 1");
+ BotInfo *ns = findbot(Config->NickServ);
+ ircdproto->SendMode(ns, u, "+d 1");
}
void SendChannel(Channel *c)
@@ -532,7 +534,7 @@ class Unreal32IRCdMessage : public IRCdMessage
if (na && user->timestamp == convertTo<time_t>(params[6]))
{
user->Login(na->nc);
- if (na->nc->HasFlag(NI_UNCONFIRMED) == false && nickserv)
+ if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false && nickserv)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
else if (nickserv)
@@ -554,7 +556,7 @@ class Unreal32IRCdMessage : public IRCdMessage
if (na && user->timestamp == convertTo<time_t>(params[6]))
{
user->Login(na->nc);
- if (na->nc->HasFlag(NI_UNCONFIRMED) == false && nickserv)
+ if (!Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false && nickserv)
user->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
}
else if (nickserv)
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index 595236bfa..6dded6f24 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -51,6 +51,9 @@ class MyNickServService : public NickServService
return;
}
+ if (Config->NoNicknameOwnership)
+ return;
+
if (u->IsRecognized(false) || !na->nc->HasFlag(NI_KILL_IMMED))
{
if (na->nc->HasFlag(NI_SECURE))
@@ -149,9 +152,8 @@ class NickServCore : public Module
User *u = finduser(na->nick);
if (u && u->Account() == na->nc)
{
+ ircdproto->SendLogout(u);
u->RemoveMode(NickServ, UMODE_REGISTERED);
- ircdproto->SendAccountLogout(u, u->Account());
- ircdproto->SendUnregisteredNick(u);
u->Logout();
}
}
@@ -166,9 +168,8 @@ class NickServCore : public Module
for (std::list<User *>::iterator it = nc->Users.begin(); it != nc->Users.end();)
{
User *user = *it++;
- ircdproto->SendAccountLogout(user, user->Account());
+ ircdproto->SendLogout(user);
user->RemoveMode(NickServ, UMODE_REGISTERED);
- ircdproto->SendUnregisteredNick(user);
user->Logout();
FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
}
@@ -182,9 +183,12 @@ class NickServCore : public Module
void OnNickIdentify(User *u)
{
- NickAlias *this_na = findnick(u->nick);
- if (this_na && this_na->nc == u->Account() && u->Account()->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership)
+ {
+ NickAlias *this_na = findnick(u->nick);
+ if (this_na && this_na->nc == u->Account() && u->Account()->HasFlag(NI_UNCONFIRMED) == false)
+ u->SetMode(NickServ, UMODE_REGISTERED);
+ }
if (Config->NSModeOnID)
for (UChannelList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
@@ -208,7 +212,7 @@ class NickServCore : public Module
if (u->Account()->HasFlag(NI_UNCONFIRMED))
{
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered."));
- this_na = findnick(u->Account()->display);
+ NickAlias *this_na = findnick(u->Account()->display);
time_t time_registered = Anope::CurTime - this_na->time_registered;
if (Config->NSUnconfirmedExpire > time_registered)
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s"), duration(Config->NSUnconfirmedExpire - time_registered).c_str());
@@ -238,18 +242,16 @@ class NickServCore : public Module
/* If the new nick isnt registerd or its registerd and not yours */
if (!na || na->nc != u->Account())
{
+ ircdproto->SendLogout(u);
u->RemoveMode(NickServ, UMODE_REGISTERED);
- ircdproto->SendUnregisteredNick(u);
this->mynickserv.Validate(u);
}
else
{
- if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
- {
- u->SetMode(NickServ, UMODE_REGISTERED);
- ircdproto->SetAutoIdentificationToken(u);
- }
+ ircdproto->SendLogin(u);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
Log(NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
}
}
diff --git a/src/config.cpp b/src/config.cpp
index ebe31cbbc..f9139bf7a 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -1170,6 +1170,7 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"options", "botmodes", "", new ValueContainerString(&conf->BotModes), DT_STRING, NoValidation},
{"options", "retrywait", "60", new ValueContainerInt(&conf->RetryWait), DT_INTEGER, ValidateNotZero},
{"options", "hideprivilegedcommands", "no", new ValueContainerBool(&conf->HidePrivilegedCommands), DT_BOOLEAN, NoValidation},
+ {"options", "nonicknameownership", "no", new ValueContainerBool(&conf->NoNicknameOwnership), DT_BOOLEAN | DT_NORELOAD, NoValidation},
{"nickserv", "name", "", new ValueContainerString(&conf->NickServ), DT_STRING, NoValidation},
{"nickserv", "emailregistration", "no", new ValueContainerBool(&conf->NSEmailReg), DT_BOOLEAN, NoValidation},
{"nickserv", "forceemail", "no", new ValueContainerBool(&conf->NSForceEmail), DT_BOOLEAN, ValidateEmailReg},
diff --git a/src/users.cpp b/src/users.cpp
index e1ed207ec..f09cdeed2 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -361,9 +361,9 @@ void User::Identify(NickAlias *na)
}
this->Login(na->nc);
- if (!na->nc->HasFlag(NI_UNCONFIRMED))
- ircdproto->SendAccountLogin(this, this->Account());
- ircdproto->SetAutoIdentificationToken(this);
+ ircdproto->SendLogin(this);
+ if (!Config->NoNicknameOwnership && na->nc == this->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ this->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(this));