summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h16
-rw-r--r--include/users.h13
-rw-r--r--include/xline.h12
-rw-r--r--src/channels.cpp8
-rw-r--r--src/commands.cpp5
-rw-r--r--src/dnsqueue.cpp3
-rw-r--r--src/inspircd.cpp10
-rw-r--r--src/modules.cpp3
-rw-r--r--src/xline.cpp23
9 files changed, 43 insertions, 50 deletions
diff --git a/include/channels.h b/include/channels.h
index ac1ee0385..7df2d665e 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -168,22 +168,6 @@ class chanrec : public Extensible
*/
std::string GetModeParameter(char mode);
- /** Increment the channel "user counter"
- * The channel user counter is a reference counter which
- * holds the number of users on the channel. If it decremented
- * to 0 then the channel is removed from the system.
- */
- void IncUserCounter();
-
- /** Decrement the channel "user counter"
- * The channel user counter is a reference counter which
- * holds the number of users on the channel. If it decremented
- * to 0 then the channel is removed from the system.
- * Modules may alter the reference count to hold channels open
- * which have no users and would normally be deleted once empty.
- */
- void DecUserCounter();
-
/** Obtain the channel "user counter"
* This returns the channel reference counter, which is initialized
* to 0 when the channel is created and incremented/decremented
diff --git a/include/users.h b/include/users.h
index 2241a6e28..681f5d4b4 100644
--- a/include/users.h
+++ b/include/users.h
@@ -310,5 +310,18 @@ class userrec : public connection
};
+/** A lightweight userrec used by WHOWAS
+ */
+class WhoWasUser
+{
+ public:
+ char nick[NICKMAX];
+ char ident[16];
+ char dhost[160];
+ char host[160];
+ char fullname[128];
+ char server[256];
+ time_t signon;
+};
#endif
diff --git a/include/xline.h b/include/xline.h
index 5381d525a..d6b4e5cb4 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -45,7 +45,7 @@ class XLine : public classbase
/** Source of the ban. This can be a servername or an oper nickname
*/
- char source[MAXBUF];
+ char source[256];
/** Reason for the ban
*/
@@ -65,7 +65,7 @@ class KLine : public XLine
/** Hostmask (ident@host) to match against
* May contain wildcards.
*/
- char hostmask[MAXBUF];
+ char hostmask[200];
};
/** GLine class
@@ -76,7 +76,7 @@ class GLine : public XLine
/** Hostmask (ident@host) to match against
* May contain wildcards.
*/
- char hostmask[MAXBUF];
+ char hostmask[200];
};
class ELine : public XLine
@@ -85,7 +85,7 @@ class ELine : public XLine
/** Hostmask (ident@host) to match against
* May contain wildcards.
*/
- char hostmask[MAXBUF];
+ char hostmask[200];
};
/** ZLine class
@@ -96,7 +96,7 @@ class ZLine : public XLine
/** IP Address (xx.yy.zz.aa) to match against
* May contain wildcards.
*/
- char ipaddr[MAXBUF];
+ char ipaddr[40];
/** Set if this is a global Z:line
* (e.g. it came from another server)
*/
@@ -111,7 +111,7 @@ class QLine : public XLine
/** Nickname to match against.
* May contain wildcards.
*/
- char nick[MAXBUF];
+ char nick[64];
/** Set if this is a global Z:line
* (e.g. it came from another server)
*/
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<std::string, userrec*, nspace::hash<string>, StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, InAddr_HashComp> address_cache;
+typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, StrHashComp> whowas_hash;
typedef std::deque<command_t> 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<std::string, userrec*, nspace::hash<string>, StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, InAddr_HashComp> address_cache;
+typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, StrHashComp> whowas_hash;
typedef std::deque<command_t> 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<std::string, userrec*, nspace::hash<string>, StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, InAddr_HashComp> address_cache;
+typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, StrHashComp> whowas_hash;
typedef std::deque<command_t> 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<std::string, userrec*, nspace::hash<string>, StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, InAddr_HashComp> address_cache;
+typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, StrHashComp> whowas_hash;
typedef std::deque<command_t> 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<std::string, userrec*, nspace::hash<string>, StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, InAddr_HashComp> address_cache;
+typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, StrHashComp> whowas_hash;
typedef std::deque<command_t> 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);