diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-05-22 07:40:22 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-05-22 07:40:22 +0000 |
commit | d5f036017510dad134fd9c8d471135f774f1fe17 (patch) | |
tree | ee037c32da9ad223cd660af9f5ed36133a517bec /src/nickalias.cpp | |
parent | fae2710ba7e068edb68baf26f901af564741e5bf (diff) |
Rewrote the nick colliding/releaseing/canceling system, fixes many many bugs on IRCds without svsnick and/or svshold
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2975 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/nickalias.cpp')
-rw-r--r-- | src/nickalias.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/nickalias.cpp b/src/nickalias.cpp index 12e656668..afd40ccd7 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -80,10 +80,6 @@ NickAlias::~NickAlias() { User *u = NULL; - /* First thing to do: remove any timeout belonging to the nick we're deleting */ - NickServCollide::ClearTimers(this); - NickServRelease::ClearTimers(this, true); - FOREACH_MOD(I_OnDelNick, OnDelNick(this)); /* Second thing to do: look for an user using the alias @@ -130,3 +126,49 @@ NickAlias::~NickAlias() delete [] this->last_quit; } +/** Release a nick from being held. This can be called from the core (ns_release) + * or from a timer used when forcing clients off of nicks. Note that if this is called + * from a timer, ircd->svshold is NEVER true + */ +void NickAlias::Release() +{ + if (this->HasFlag(NS_HELD)) + { + if (ircd->svshold) + { + ircdproto->SendSVSHoldDel(this->nick); + } + else + { + ircdproto->SendQuit(this->nick, NULL); + } + + this->UnsetFlag(NS_HELD); + } +} + +/** Called when a user gets off this nick + * See the comment in users.cpp for User::Collide() + * @param u The user + */ +void NickAlias::OnCancel(User *) +{ + if (this->HasFlag(NS_COLLIDED)) + { + this->SetFlag(NS_HELD); + this->UnsetFlag(NS_COLLIDED); + + if (ircd->svshold) + { + ircdproto->SendSVSHold(this->nick); + } + else + { + std::string uid = (ircd->ts6 ? ts6_uid_retrieve() : ""); + + ircdproto->SendClientIntroduction(this->nick, Config.NSEnforcerUser, Config.NSEnforcerHost, "Services Enforcer", "+", uid); + new NickServRelease(this->nick, uid, Config.NSReleaseTimeout); + } + } +} + |