diff options
| author | Adam <Adam@drink-coca-cola.info> | 2010-05-14 20:35:38 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-06-18 21:01:53 -0400 |
| commit | f049124905bd9f53439293e873003cb027a17b91 (patch) | |
| tree | 352ed9251fd47055dd770aa2d5eabb20247e4b43 /src/hostserv.c | |
| parent | 81a45520a773732c9f46785f27aa1956150775d7 (diff) | |
Rewrote the hashing system to use std::tr1::unordered_map
Diffstat (limited to 'src/hostserv.c')
| -rw-r--r-- | src/hostserv.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/hostserv.c b/src/hostserv.c index b34b272a3..e43da5c05 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -15,8 +15,6 @@ #include "services.h" #include "pseudo.h" -#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31)) - E int do_hs_sync(NickCore * nc, char *vIdent, char *hostmask, char *creator, time_t time); @@ -40,21 +38,20 @@ void get_hostserv_stats(long *nrec, long *memuse) { long count = 0, mem = 0; - for (int i = 0; i < 1024; ++i) + for (nickalias_map::const_iterator it = NickAliasList.begin(); it != NickAliasList.end(); ++it) { - for (NickAlias *na = nalists[i]; na; na = na->next) - { - if (!na->hostinfo.HasVhost()) - continue; - - if (!na->hostinfo.GetIdent().empty()) - mem += na->hostinfo.GetIdent().size(); - if (!na->hostinfo.GetHost().empty()) - mem += na->hostinfo.GetHost().size(); - if (!na->hostinfo.GetCreator().empty()) - mem += na->hostinfo.GetCreator().size(); - ++count; - } + NickAlias *na = it->second; + + if (!na->hostinfo.HasVhost()) + continue; + + if (!na->hostinfo.GetIdent().empty()) + mem += na->hostinfo.GetIdent().size(); + if (!na->hostinfo.GetHost().empty()) + mem += na->hostinfo.GetHost().size(); + if (!na->hostinfo.GetCreator().empty()) + mem += na->hostinfo.GetCreator().size(); + ++count; } *nrec = count; @@ -94,10 +91,10 @@ void hostserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - ircdproto->SendCTCP(findbot(Config.s_HostServ), u->nick.c_str(), "PING %s", s); + ircdproto->SendCTCP(HostServ, u->nick.c_str(), "PING %s", s); } else { if (ircd->vhost) { - mod_run_cmd(Config.s_HostServ, u, HOSTSERV, cmd); + mod_run_cmd(HostServ, u, cmd); } else { notice_lang(Config.s_HostServ, u, SERVICE_OFFLINE, Config.s_HostServ); } |
