mirror of
https://github.com/anope/anope.git
synced 2026-07-07 17:03:13 +02:00
Patch from DukePyrolator to include an OnUserNickChange() event to replace EVENT_CHANGE_NICK, also patch from me to have the ratbox protocol module send account data on login and logout.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2254 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+7
-1
@@ -506,6 +506,12 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnServerConnect(Server *s) { }
|
||||
|
||||
/** Called after a user changed the nick
|
||||
* @param u The user.
|
||||
* @param oldnick the old nick of the user
|
||||
*/
|
||||
virtual void OnUserNickChange(User *u, const char *oldnick) { }
|
||||
|
||||
/** Called before a command is due to be executed.
|
||||
* @param u The user executing the command
|
||||
* @param service The service the command is associated with
|
||||
@@ -542,7 +548,7 @@ enum Implementation
|
||||
{
|
||||
I_BEGIN,
|
||||
I_OnUserKicked, I_OnReload, I_OnBotAssign, I_OnBotUnAssign, I_OnUserConnect, I_OnServerConnect,
|
||||
I_OnPreCommand, I_OnPostCommand,
|
||||
I_OnPreCommand, I_OnPostCommand, I_OnUserNickChange,
|
||||
I_OnSaveDatabase, I_OnBackupDatabase,
|
||||
I_END
|
||||
};
|
||||
|
||||
@@ -699,13 +699,12 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
}
|
||||
|
||||
void SendAccountLogin(User *u, NickCore *account)
|
||||
void SendAccountLogin(User *u, NickCore *account)
|
||||
{
|
||||
send_cmd(TS6SID, "METADATA %s accountname :%s", u->GetUID().c_str(), account->display);
|
||||
|
||||
}
|
||||
|
||||
void SendAccountLogout(User *u, NickCore *account)
|
||||
void SendAccountLogout(User *u, NickCore *account)
|
||||
{
|
||||
send_cmd(TS6SID, "METADATA %s accountname :", u->GetUID().c_str());
|
||||
}
|
||||
|
||||
@@ -663,6 +663,16 @@ class RatboxProto : public IRCDTS6Proto
|
||||
send_cmd(source->uid, "INVITE %s %s", u ? u->GetUID().c_str(): nick, chan);
|
||||
}
|
||||
|
||||
void SendAccountLogin(User *u, NickCore *account)
|
||||
{
|
||||
send_cmd(TS6SID, "ENCAP * SU %s %s", u->GetUID().c_str(), account->display);
|
||||
}
|
||||
|
||||
void SendAccountLogout(User *u, NickCore *account)
|
||||
{
|
||||
send_cmd(TS6SID, "ENCAP * SU %s", u->GetUID().c_str());
|
||||
}
|
||||
|
||||
int IsNickValid(const char *nick)
|
||||
{
|
||||
/* TS6 Save extension -Certus */
|
||||
|
||||
+5
-2
@@ -687,7 +687,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const
|
||||
}
|
||||
|
||||
user->SetNewNick(nick);
|
||||
send_event(EVENT_CHANGE_NICK, 1, nick);
|
||||
FOREACH_MOD(I_OnUserNickChange, OnUserNickChange(user, source));
|
||||
|
||||
if ((old_na ? old_na->nc : NULL) == user->nc)
|
||||
nc_changed = 0;
|
||||
@@ -700,7 +700,10 @@ User *do_nick(const char *source, const char *nick, const char *username, const
|
||||
}
|
||||
else
|
||||
{
|
||||
ircdproto->SendUnregisteredNick(user);
|
||||
if (!nick_identified(user) || !nick_recognized(user))
|
||||
{
|
||||
ircdproto->SendUnregisteredNick(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user