1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 09:26:38 +02:00

Added inspircd2.0 protocol module, moved usermode +r unsetting on nick change to the protocol modules to fix inspircd1.2s weird usermode +r behavior

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2997 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Adam-
2010-06-03 19:01:28 +00:00
parent f43f6c3864
commit 9abdb4e2e9
10 changed files with 1454 additions and 26 deletions
+3 -2
View File
@@ -151,12 +151,13 @@ serverinfo
*
* Supported:
* - inspircd11
* - inspircd12 (also supports InspIRCd 2.0)
* - inspircd12
* - inspircd20
* - ratbox
* - bahamut
* - unreal32
*/
type = "inspircd11"
type = "inspircd12"
/*
* What Server ID to use for this connection?
+2 -2
View File
@@ -515,9 +515,9 @@ class CoreExport Module
/** Called after a user changed the nick
* @param u The user.
* @param oldnick the old nick of the user
* @param oldnick The old nick of the user
*/
virtual void OnUserNickChange(User *u, const char *oldnick) { }
virtual void OnUserNickChange(User *u, const std::string &oldnick) { }
/** Called immediatly when a user tries to run a command
* @param service The service
-1
View File
@@ -394,7 +394,6 @@ struct ircdvars_ {
int umode; /* change user modes */
int nickvhost; /* Users vhost sent during NICK */
int chgreal; /* Change RealName */
int check_nick_id; /* On nick change check if they could be identified */
int knock_needs_i; /* Check if we needed +i when setting NOKNOCK */
int token; /* Does Anope support the tokens for the ircd */
int sjb64;
+6 -1
View File
@@ -43,7 +43,6 @@ IRCDVar myIrcd[] = {
1, /* UMODE */
0, /* VHOST ON NICK */
0, /* Change RealName */
1,
1, /* No Knock requires +i */
0, /* We support TOKENS */
0, /* TIME STAMPS are BASE64 */
@@ -828,8 +827,14 @@ class ProtoBahamut : public Module
moduleAddModes();
pmodule_ircd_proto(&ircd_proto);
ModuleManager::Attach(I_OnUserNickChange, this);
}
void OnUserNickChange(User *u, const std::string &)
{
u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
}
};
MODULE_INIT(ProtoBahamut)
+9 -1
View File
@@ -60,7 +60,6 @@ IRCDVar myIrcd[] = {
1, /* UMODE */
1, /* VHOST ON NICK */
0, /* Change RealName */
0,
1, /* No Knock requires +i */
0, /* We support inspircd TOKENS */
0, /* TIME STAMPS are BASE64 */
@@ -325,6 +324,8 @@ class InspIRCdProto : public IRCDProto
u->Account()->Shrink("authenticationtoken");
u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
} ircd_proto;
@@ -1182,6 +1183,13 @@ class ProtoInspIRCd : public Module
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
ModuleManager::Attach(I_OnUserNickChange, this);
}
void OnUserNickChange(User *u, const std::string &)
{
u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
}
};
+12 -3
View File
@@ -34,7 +34,7 @@ int inet_aton(const char *name, struct in_addr *addr)
#endif
IRCDVar myIrcd[] = {
{"InspIRCd 1.2 & 2.0", /* ircd name */
{"InspIRCd 1.2", /* ircd name */
"+I", /* Modes used by pseudoclients */
5, /* Chan Max Symbols */
"+ao", /* Channel Umode used by Botserv bots */
@@ -60,7 +60,6 @@ IRCDVar myIrcd[] = {
1, /* UMODE */
1, /* VHOST ON NICK */
0, /* Change RealName */
0,
1, /* No Knock requires +i */
0, /* We support inspircd TOKENS */
0, /* TIME STAMPS are BASE64 */
@@ -1386,7 +1385,7 @@ class ProtoInspIRCd : public Module
if (Config.Numeric)
TS6SID = sstrdup(Config.Numeric);
pmodule_ircd_version("InspIRCd 1.2 & 2.0");
pmodule_ircd_version("InspIRCd 1.2");
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
@@ -1396,12 +1395,22 @@ class ProtoInspIRCd : public Module
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
ModuleManager::Attach(I_OnUserNickChange, this);
}
~ProtoInspIRCd()
{
delete [] TS6SID;
}
void OnUserNickChange(User *u, const std::string &)
{
/* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later
* this will cancel out this -r, resulting in no mode changes.
*/
u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
};
MODULE_INIT(ProtoInspIRCd)
File diff suppressed because it is too large Load Diff
-3
View File
@@ -41,7 +41,6 @@ IRCDVar myIrcd[] = {
0, /* O:LINE */
0, /* VHOST ON NICK */
0, /* Change RealName */
1, /* On nick change check if they could be identified */
0, /* No Knock requires +i */
0, /* We support TOKENS */
0, /* TIME STAMPS are BASE64 */
@@ -849,7 +848,6 @@ void moduleAddModes()
ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
@@ -904,7 +902,6 @@ class ProtoRatbox : public Module
{
delete [] TS6SID;
}
};
MODULE_INIT(ProtoRatbox)
+7 -2
View File
@@ -43,7 +43,6 @@ IRCDVar myIrcd[] = {
1, /* UMODE */
1, /* VHOST ON NICK */
1, /* Change RealName */
1, /* On nick change check if they could be identified */
1, /* No Knock requires +i */
1, /* We support Unreal TOKENS */
1, /* TIME STAMPS are BASE64 */
@@ -1384,8 +1383,14 @@ class ProtoUnreal : public Module
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
}
ModuleManager::Attach(I_OnUserNickChange, this);
}
void OnUserNickChange(User *u, const std::string &)
{
u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
}
};
MODULE_INIT(ProtoUnreal)
+1 -11
View File
@@ -977,19 +977,9 @@ User *do_nick(const char *source, const char *nick, const char *username, const
if (old_na && (old_na->nc == user->Account() || user->IsRecognized()))
old_na->last_seen = time(NULL);
/* On nick change -r gets set on nick changes but we aren't informed about it, causing SetMode(UMODE_REGISTERED)
* to fail (we think it is already set). Remove it silently like the IRCds
*/
if (ircd->check_nick_id)
{
UserMode *um = ModeManager::FindUserModeByName(UMODE_REGISTERED);
if (um)
user->RemoveModeInternal(um);
}
std::string oldnick = user->nick;
user->SetNewNick(nick);
FOREACH_MOD(I_OnUserNickChange, OnUserNickChange(user, oldnick.c_str()));
FOREACH_MOD(I_OnUserNickChange, OnUserNickChange(user, oldnick));
if (old_na)
old_na->OnCancel(user);