From 194838af39aa5fc823571afe9d61b2453573a32d Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 12 May 2005 19:09:42 +0000 Subject: Changed the type of struct whowas records are stored in (no need to waste a big heavy userrec) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1369 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 8 -------- src/commands.cpp | 5 +++-- src/dnsqueue.cpp | 3 ++- src/inspircd.cpp | 10 +++++----- src/modules.cpp | 3 ++- src/xline.cpp | 23 ++++++++++++----------- 6 files changed, 24 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 5ba38a9e6..7962665b7 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -199,14 +199,6 @@ std::string chanrec::GetModeParameter(char mode) return ""; } -void chanrec::IncUserCounter() -{ -} - -void chanrec::DecUserCounter() -{ -} - long chanrec::GetUserCounter() { return (this->internal_userlist.size()); diff --git a/src/commands.cpp b/src/commands.cpp index d04a79f4d..18329e9b3 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -201,12 +201,13 @@ struct InAddr_HashComp typedef nspace::hash_map, StrHashComp> user_hash; typedef nspace::hash_map, StrHashComp> chan_hash; typedef nspace::hash_map, InAddr_HashComp> address_cache; +typedef nspace::hash_map, StrHashComp> whowas_hash; typedef std::deque command_table; extern user_hash clientlist; extern chan_hash chanlist; -extern user_hash whowas; +extern whowas_hash whowas; extern command_table cmdlist; extern file_cache MOTD; extern file_cache RULES; @@ -1264,7 +1265,7 @@ void handle_away(char **parameters, int pcnt, userrec *user) void handle_whowas(char **parameters, int pcnt, userrec* user) { - user_hash::iterator i = whowas.find(parameters[0]); + whowas_hash::iterator i = whowas.find(parameters[0]); if (i == whowas.end()) { diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index aca0b07a9..f00c9e25d 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -154,11 +154,12 @@ struct InAddr_HashComp typedef nspace::hash_map, StrHashComp> user_hash; typedef nspace::hash_map, StrHashComp> chan_hash; typedef nspace::hash_map, InAddr_HashComp> address_cache; +typedef nspace::hash_map, StrHashComp> whowas_hash; typedef std::deque command_table; extern user_hash clientlist; extern chan_hash chanlist; -extern user_hash whowas; +extern whowas_hash whowas; extern command_table cmdlist; extern ClassVector Classes; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 635effbeb..1b7e55272 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -183,6 +183,7 @@ struct InAddr_HashComp typedef nspace::hash_map, StrHashComp> user_hash; typedef nspace::hash_map, StrHashComp> chan_hash; typedef nspace::hash_map, InAddr_HashComp> address_cache; +typedef nspace::hash_map, StrHashComp> whowas_hash; typedef std::deque command_table; // This table references users by file descriptor. @@ -198,7 +199,7 @@ FILE *log_file; user_hash clientlist; chan_hash chanlist; -user_hash whowas; +whowas_hash whowas; command_table cmdlist; file_cache MOTD; file_cache RULES; @@ -1796,7 +1797,6 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri user->chans[index].uc_modes = 0; } user->chans[index].channel = Ptr; - Ptr->IncUserCounter(); Ptr->AddUser((char*)user); WriteChannel(Ptr,user,"JOIN :%s",Ptr->name); @@ -2446,8 +2446,8 @@ userrec* ReHashNick(char* Old, char* New) /* adds or updates an entry in the whowas list */ void AddWhoWas(userrec* u) { - user_hash::iterator iter = whowas.find(u->nick); - userrec *a = new userrec(); + whowas_hash::iterator iter = whowas.find(u->nick); + WhoWasUser *a = new WhoWasUser(); strlcpy(a->nick,u->nick,NICKMAX); strlcpy(a->ident,u->ident,15); strlcpy(a->dhost,u->dhost,160); @@ -2465,7 +2465,7 @@ void AddWhoWas(userrec* u) { if (whowas.size() >= WHOWAS_MAX) { - for (user_hash::iterator i = whowas.begin(); i != whowas.end(); i++) + for (whowas_hash::iterator i = whowas.begin(); i != whowas.end(); i++) { // 3600 seconds in an hour ;) if ((i->second->signon)<(TIME-(WHOWAS_STALE*3600))) diff --git a/src/modules.cpp b/src/modules.cpp index e29299d5e..5147e08cc 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -185,12 +185,13 @@ struct InAddr_HashComp typedef nspace::hash_map, StrHashComp> user_hash; typedef nspace::hash_map, StrHashComp> chan_hash; typedef nspace::hash_map, InAddr_HashComp> address_cache; +typedef nspace::hash_map, StrHashComp> whowas_hash; typedef std::deque command_table; extern user_hash clientlist; extern chan_hash chanlist; -extern user_hash whowas; +extern whowas_hash whowas; extern command_table cmdlist; extern file_cache MOTD; extern file_cache RULES; diff --git a/src/xline.cpp b/src/xline.cpp index 921d96045..8f69455df 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -172,12 +172,13 @@ struct InAddr_HashComp typedef nspace::hash_map, StrHashComp> user_hash; typedef nspace::hash_map, StrHashComp> chan_hash; typedef nspace::hash_map, InAddr_HashComp> address_cache; +typedef nspace::hash_map, StrHashComp> whowas_hash; typedef std::deque command_table; extern user_hash clientlist; extern chan_hash chanlist; -extern user_hash whowas; +extern whowas_hash whowas; extern command_table cmdlist; extern file_cache MOTD; extern file_cache RULES; @@ -242,9 +243,9 @@ void add_gline(long duration, const char* source,const char* reason,const char* del_gline(hostmask); GLine item; item.duration = duration; - strlcpy(item.hostmask,hostmask,MAXBUF); + strlcpy(item.hostmask,hostmask,199); strlcpy(item.reason,reason,MAXBUF); - strlcpy(item.source,source,MAXBUF); + strlcpy(item.source,source,255); item.n_matches = 0; item.set_time = TIME; glines.push_back(item); @@ -257,9 +258,9 @@ void add_eline(long duration, const char* source, const char* reason, const char del_eline(hostmask); ELine item; item.duration = duration; - strlcpy(item.hostmask,hostmask,MAXBUF); + strlcpy(item.hostmask,hostmask,199); strlcpy(item.reason,reason,MAXBUF); - strlcpy(item.source,source,MAXBUF); + strlcpy(item.source,source,255); item.n_matches = 0; item.set_time = TIME; elines.push_back(item); @@ -272,9 +273,9 @@ void add_qline(long duration, const char* source, const char* reason, const char del_qline(nickname); QLine item; item.duration = duration; - strlcpy(item.nick,nickname,MAXBUF); + strlcpy(item.nick,nickname,63); strlcpy(item.reason,reason,MAXBUF); - strlcpy(item.source,source,MAXBUF); + strlcpy(item.source,source,255); item.n_matches = 0; item.is_global = false; item.set_time = TIME; @@ -294,9 +295,9 @@ void add_zline(long duration, const char* source, const char* reason, const char ipaddr++; ipaddr++; } - strlcpy(item.ipaddr,ipaddr,MAXBUF); + strlcpy(item.ipaddr,ipaddr,39); strlcpy(item.reason,reason,MAXBUF); - strlcpy(item.source,source,MAXBUF); + strlcpy(item.source,source,255); item.n_matches = 0; item.is_global = false; item.set_time = TIME; @@ -310,9 +311,9 @@ void add_kline(long duration, const char* source, const char* reason, const char del_kline(hostmask); KLine item; item.duration = duration; - strlcpy(item.hostmask,hostmask,MAXBUF); + strlcpy(item.hostmask,hostmask,200); strlcpy(item.reason,reason,MAXBUF); - strlcpy(item.source,source,MAXBUF); + strlcpy(item.source,source,255); item.n_matches = 0; item.set_time = TIME; klines.push_back(item); -- cgit v1.2.3