1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 14:13:12 +02:00

Added options:nonicknameownership config option

This commit is contained in:
Adam
2011-10-14 12:20:07 -04:00
parent 53275c362c
commit ddc3c2f38c
25 changed files with 231 additions and 181 deletions
+5
View File
@@ -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
}
/*
+25 -16
View File
@@ -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"; }
/*
@@ -472,6 +480,17 @@ module { name = "ns_set_autoop" }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
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
*
@@ -560,16 +579,6 @@ module { name = "ns_set_secure" }
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
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
*
+2
View File
@@ -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;
+2 -18
View File
@@ -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
+2
View File
@@ -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");
}
};
+5 -3
View File
@@ -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");
}
};
+2 -4
View File
@@ -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 */
+4 -3
View File
@@ -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");
}
};
+8 -4
View File
@@ -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;
}
+2
View File
@@ -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");
}
};
+1 -42
View File
@@ -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");
+1 -37
View File
@@ -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");
+99
View File
@@ -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)
+2
View File
@@ -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");
}
};
+13 -16
View File
@@ -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
+6 -3
View File
@@ -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());
}
+5 -3
View File
@@ -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)
+1 -1
View File
@@ -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);
}
}
+1 -1
View File
@@ -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);
}
}
+7 -4
View File
@@ -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);
}
}
+10 -3
View File
@@ -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;
+8 -6
View File
@@ -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)
+16 -14
View File
@@ -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;
}
}
+1
View File
@@ -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},
+3 -3
View File
@@ -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));