mirror of
https://github.com/anope/anope.git
synced 2026-07-03 07:13:14 +02:00
Move enforcer checks on nick and logout to nickserv.cpp
This commit is contained in:
+5
-3
@@ -536,10 +536,12 @@ class CoreExport Module : public Extensible
|
||||
*/
|
||||
virtual void OnUserQuit(User *u, const Anope::string &msg) { }
|
||||
|
||||
/** Called when a user disconnects
|
||||
/** Called when a user disconnects, before and after being internally removed from
|
||||
* all lists (channels, user list, etc)
|
||||
* @param u The user
|
||||
*/
|
||||
virtual void OnUserLogoff(User *u) { }
|
||||
virtual void OnPreUserLogoff(User *u) { }
|
||||
virtual void OnPostUserLogoff(User *u) { }
|
||||
|
||||
/** Called when a new bot is made
|
||||
* @param bi The bot
|
||||
@@ -994,7 +996,7 @@ enum Implementation
|
||||
I_OnMemoSend, I_OnMemoDel,
|
||||
|
||||
/* Users */
|
||||
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnUserLogoff, I_OnPreJoinChannel,
|
||||
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnPreUserLogoff, I_OnPostUserLogoff, I_OnPreJoinChannel,
|
||||
I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnLeaveChannel, I_OnFingerprint, I_OnUserAway,
|
||||
|
||||
/* OperServ */
|
||||
|
||||
@@ -661,7 +661,7 @@ class ModuleDNS : public Module
|
||||
{
|
||||
this->SetAuthor("Anope");
|
||||
|
||||
Implementation i[] = { I_OnReload, I_OnNewServer, I_OnServerQuit, I_OnUserConnect, I_OnUserLogoff, I_OnDnsRequest };
|
||||
Implementation i[] = { I_OnReload, I_OnNewServer, I_OnServerQuit, I_OnUserConnect, I_OnPreUserLogoff, I_OnDnsRequest };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
|
||||
this->OnReload();
|
||||
@@ -733,7 +733,7 @@ class ModuleDNS : public Module
|
||||
}
|
||||
}
|
||||
|
||||
void OnUserLogoff(User *u) anope_override
|
||||
void OnPreUserLogoff(User *u) anope_override
|
||||
{
|
||||
if (u && u->server)
|
||||
{
|
||||
|
||||
@@ -713,7 +713,7 @@ class OSSession : public Module
|
||||
{
|
||||
this->SetAuthor("Anope");
|
||||
|
||||
Implementation i[] = { I_OnUserConnect, I_OnUserLogoff };
|
||||
Implementation i[] = { I_OnUserConnect, I_OnPreUserLogoff };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
ModuleManager::SetPriority(this, PRIORITY_FIRST);
|
||||
}
|
||||
@@ -724,7 +724,7 @@ class OSSession : public Module
|
||||
this->AddSession(user, exempt);
|
||||
}
|
||||
|
||||
void OnUserLogoff(User *u) anope_override
|
||||
void OnPreUserLogoff(User *u) anope_override
|
||||
{
|
||||
if (Config->LimitSessions && (!u->server || !u->server->IsULined()))
|
||||
this->DelSession(u);
|
||||
|
||||
@@ -198,7 +198,7 @@ class NickServCore : public Module
|
||||
throw ModuleException("No bot named " + Config->NickServ);
|
||||
|
||||
Implementation i[] = { I_OnBotDelete, I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickIdentify, I_OnNickGroup,
|
||||
I_OnNickUpdate, I_OnUserConnect, I_OnServerSync, I_OnUserNickChange, I_OnPreHelp, I_OnPostHelp };
|
||||
I_OnNickUpdate, I_OnUserConnect, I_OnPostUserLogoff, I_OnServerSync, I_OnUserNickChange, I_OnPreHelp, I_OnPostHelp };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
}
|
||||
|
||||
@@ -315,6 +315,13 @@ class NickServCore : public Module
|
||||
this->mynickserv.Validate(u);
|
||||
}
|
||||
|
||||
void OnPostUserLogoff(User *u) anope_override
|
||||
{
|
||||
NickAlias *na = NickAlias::Find(u->nick);
|
||||
if (na)
|
||||
na->OnCancel(u);
|
||||
}
|
||||
|
||||
void OnServerSync(Server *s) anope_override
|
||||
{
|
||||
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
|
||||
@@ -327,7 +334,7 @@ class NickServCore : public Module
|
||||
|
||||
void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override
|
||||
{
|
||||
const NickAlias *na = NickAlias::Find(u->nick);
|
||||
NickAlias *old_na = NickAlias::Find(oldnick), *na = NickAlias::Find(u->nick);
|
||||
/* If the new nick isnt registerd or its registerd and not yours */
|
||||
if (!na || na->nc != u->Account())
|
||||
{
|
||||
@@ -344,6 +351,9 @@ class NickServCore : public Module
|
||||
u->SetMode(NickServ, UMODE_REGISTERED);
|
||||
Log(NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
|
||||
}
|
||||
|
||||
if (!u->nick.equals_ci(oldnick) && old_na)
|
||||
old_na->OnCancel(u);
|
||||
}
|
||||
|
||||
void OnUserModeSet(User *u, UserModeName Name) anope_override
|
||||
|
||||
+2
-7
@@ -114,9 +114,6 @@ void User::ChangeNick(const Anope::string &newnick, time_t ts)
|
||||
if (na)
|
||||
on_access = na->nc->IsOnAccess(this);
|
||||
|
||||
if (old_na)
|
||||
old_na->OnCancel(this);
|
||||
|
||||
if (na && na->nc == this->Account())
|
||||
{
|
||||
na->last_seen = Anope::CurTime;
|
||||
@@ -237,7 +234,7 @@ User::~User()
|
||||
--this->server->users;
|
||||
}
|
||||
|
||||
FOREACH_MOD(I_OnUserLogoff, OnUserLogoff(this));
|
||||
FOREACH_MOD(I_OnPreUserLogoff, OnPreUserLogoff(this));
|
||||
|
||||
ModeManager::StackerDel(this);
|
||||
this->Logout();
|
||||
@@ -252,9 +249,7 @@ User::~User()
|
||||
if (!this->uid.empty())
|
||||
UserListByUID.erase(this->uid);
|
||||
|
||||
NickAlias *na = NickAlias::Find(this->nick);
|
||||
if (na)
|
||||
na->OnCancel(this);
|
||||
FOREACH_MOD(I_OnPostUserLogoff, OnPostUserLogoff(this));
|
||||
}
|
||||
|
||||
void User::SendMessage(const BotInfo *source, const char *fmt, ...)
|
||||
|
||||
Reference in New Issue
Block a user