diff options
| author | Adam <Adam@anope.org> | 2012-02-14 15:13:27 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-02-14 15:13:27 -0500 |
| commit | a9772cde21407c89abd161d51aff45267f87b1fb (patch) | |
| tree | 9e57ba6c121d3843888917d968dd4f5d030b57cf /modules/pseudoclients | |
| parent | 086790d6331357022f4da17c76b26b9fc6e2ad90 (diff) | |
Clean up and reorganize our header files
Diffstat (limited to 'modules/pseudoclients')
| -rw-r--r-- | modules/pseudoclients/hostserv.cpp | 27 | ||||
| -rw-r--r-- | modules/pseudoclients/nickserv.cpp | 54 | ||||
| -rw-r--r-- | modules/pseudoclients/operserv.cpp | 4 |
3 files changed, 66 insertions, 19 deletions
diff --git a/modules/pseudoclients/hostserv.cpp b/modules/pseudoclients/hostserv.cpp index 717b117f3..ecf0ecb47 100644 --- a/modules/pseudoclients/hostserv.cpp +++ b/modules/pseudoclients/hostserv.cpp @@ -33,37 +33,30 @@ class HostServCore : public Module void OnNickIdentify(User *u) { - HostInfo *ho = NULL; NickAlias *na = findnick(u->nick); - if (na && na->hostinfo.HasVhost()) - ho = &na->hostinfo; - else - { + if (!na || !na->HasVhost()) na = findnick(u->Account()->display); - if (na && na->hostinfo.HasVhost()) - ho = &na->hostinfo; - } - if (ho == NULL) + if (!na) return; - if (u->vhost.empty() || !u->vhost.equals_cs(na->hostinfo.GetHost()) || (!na->hostinfo.GetIdent().empty() && !u->GetVIdent().equals_cs(na->hostinfo.GetIdent()))) + if (u->vhost.empty() || !u->vhost.equals_cs(na->GetVhostHost()) || (!na->GetVhostIdent().empty() && !u->GetVIdent().equals_cs(na->GetVhostIdent()))) { - ircdproto->SendVhost(u, na->hostinfo.GetIdent(), na->hostinfo.GetHost()); + ircdproto->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); if (ircd->vhost) { - u->vhost = na->hostinfo.GetHost(); + u->vhost = na->GetVhostHost(); u->UpdateHost(); } - if (ircd->vident && !na->hostinfo.GetIdent().empty()) - u->SetVIdent(na->hostinfo.GetIdent()); + if (ircd->vident && !na->GetVhostIdent().empty()) + u->SetVIdent(na->GetVhostIdent()); BotInfo *bi = findbot(Config->HostServ); if (bi) { - if (!na->hostinfo.GetIdent().empty()) - u->SendMessage(bi, _("Your vhost of \002%s\002@\002%s\002 is now activated."), na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str()); + if (!na->GetVhostIdent().empty()) + u->SendMessage(bi, _("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); else - u->SendMessage(bi, _("Your vhost of \002%s\002 is now activated."), na->hostinfo.GetHost().c_str()); + u->SendMessage(bi, _("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); } } } diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index c486c2e0b..163fcc6af 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -16,6 +16,60 @@ static BotInfo *NickServ; +class NickServCollide; +class NickServRelease; + +typedef std::map<Anope::string, NickServCollide *> nickservcollides_map; +typedef std::map<Anope::string, NickServRelease *> nickservreleases_map; + +static nickservcollides_map NickServCollides; +static nickservreleases_map NickServReleases; + +/** Timer for colliding nicks to force people off of nicknames + */ +class CoreExport NickServCollide : public Timer +{ + dynamic_reference<User> u; + Anope::string nick; + + public: + /** Default constructor + * @param nick The nick we're colliding + * @param delay How long to delay before kicking the user off the nick + */ + NickServCollide(User *user, time_t delay) : Timer(delay), u(user), nick(u->nick) + { + /* Erase the current collide and use the new one */ + nickservcollides_map::iterator nit = NickServCollides.find(user->nick); + if (nit != NickServCollides.end()) + delete nit->second; + + NickServCollides.insert(std::make_pair(nick, this)); + } + + /** Default destructor + */ + virtual ~NickServCollide() + { + NickServCollides.erase(this->nick); + } + + /** Called when the delay is up + * @param t The current time + */ + void Tick(time_t t) + { + if (!u) + return; + /* If they identified or don't exist anymore, don't kill them. */ + NickAlias *na = findnick(u->nick); + if (!na || u->Account() == na->nc || u->my_signon > this->GetSetTime()) + return; + + u->Collide(na); + } +}; + class MyNickServService : public NickServService { public: diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 7dfaf40bb..813d9f098 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -40,7 +40,7 @@ class SGLineManager : public XLineManager throw SocketException("SZLine is not supported"); else if (x->GetUser() != "*") throw SocketException("Can not ZLine a username"); - x->GetIP(); + sockaddrs(x->GetHost()); ircdproto->SendSZLine(u, x); } catch (const SocketException &) @@ -57,7 +57,7 @@ class SGLineManager : public XLineManager throw SocketException("SZLine is not supported"); else if (x->GetUser() != "*") throw SocketException("Can not ZLine a username"); - x->GetIP(); + sockaddrs(x->GetHost()); ircdproto->SendSZLineDel(x); } catch (const SocketException &) |
