summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-07 21:14:17 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-07 21:14:17 +0000
commit6b9eaeba4130acb818a63782640194c7e5bcc2fa (patch)
treeb85582342008671b0f56de5acff039956fcf4eb2 /include
parentf9eb4c966f3c20ac5767edc19f4f8803b17e4147 (diff)
Move all /WHOWAS related out of core and into cmd_whowas.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6249 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/commands/cmd_whowas.h92
-rw-r--r--include/inspircd.h8
-rw-r--r--include/users.h63
3 files changed, 90 insertions, 73 deletions
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index 3dc69bfdc..1181b7ae8 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -17,18 +17,106 @@
#ifndef __CMD_WHOWAS_H__
#define __CMD_WHOWAS_H__
+
// include the common header files
#include "users.h"
#include "channels.h"
+class MaintainTimer;
+
+/** InspTimer that is used to maintain the whowas list, called once an hour
+ */
+MaintainTimer* timer;
+
/** Handle /WHOWAS
*/
class cmd_whowas : public command_t
{
+ public:
+ cmd_whowas(InspIRCd* Instance);
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user);
+ CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> &parameters);
+ void AddToWhoWas(userrec* user);
+ void GetStats(Extensible* ext);
+ void PruneWhoWas(time_t t);
+ virtual ~cmd_whowas();
+};
+
+enum Internals
+{
+ WHOWAS_ADD = 1,
+ WHOWAS_STATS = 2,
+ WHOWAS_PRUNE = 3
+};
+
+
+/** Used to hold WHOWAS information
+ */
+class WhoWasGroup : public classbase
+{
public:
- cmd_whowas (InspIRCd* Instance) : command_t(Instance,"WHOWAS",0,1) { syntax = "<nick>{,<nick>}"; }
- CmdResult Handle(const char** parameters, int pcnt, userrec *user);
+ /** Real host
+ */
+ char* host;
+ /** Displayed host
+ */
+ char* dhost;
+ /** Ident
+ */
+ char* ident;
+ /** Server name
+ */
+ const char* server;
+ /** Fullname (GECOS)
+ */
+ char* gecos;
+ /** Signon time
+ */
+ time_t signon;
+
+ /** Initialize this WhoQasFroup with a user
+ */
+ WhoWasGroup(userrec* user);
+ /** Destructor
+ */
+ ~WhoWasGroup();
+};
+
+class MaintainTimer : public InspTimer
+{
+ private:
+ InspIRCd* ServerInstance;
+ public:
+ MaintainTimer(InspIRCd* Instance, long interval)
+ : InspTimer(interval, Instance->Time()), ServerInstance(Instance)
+ {
+ }
+ virtual void Tick(time_t TIME);
};
+/** A group of users related by nickname
+ */
+typedef std::deque<WhoWasGroup*> whowas_set;
+
+/** Sets of users in the whowas system
+ */
+typedef std::map<irc::string,whowas_set*> whowas_users;
+
+/** Sets of time and users in whowas list
+ */
+typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
+
+/** Called every hour by the core to remove expired entries
+ */
+void MaintainWhoWas(InspIRCd* ServerInstance, time_t TIME);
+
+/** Whowas container, contains a map of vectors of users tracked by WHOWAS
+ */
+whowas_users whowas;
+
+/** Whowas container, contains a map of time_t to users tracked by WHOWAS
+ */
+whowas_users_fifo whowas_fifo;
+
#endif
diff --git a/include/inspircd.h b/include/inspircd.h
index 1e5104322..3f6b702f1 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -445,14 +445,6 @@ class InspIRCd : public classbase
clonemap global_clones;
- /** Whowas container, contains a map of vectors of users tracked by WHOWAS
- */
- irc::whowas::whowas_users whowas;
-
- /** Whowas container, contains a map of time_t to users tracked by WHOWAS
- */
- irc::whowas::whowas_users_fifo whowas_fifo;
-
/** DNS class, provides resolver facilities to the core and modules
*/
DNS* Res;
diff --git a/include/users.h b/include/users.h
index c34b60693..749030894 100644
--- a/include/users.h
+++ b/include/users.h
@@ -846,69 +846,6 @@ class userrec : public connection
virtual ~userrec();
};
-
-namespace irc
-{
- /** Holds whowas related functions and classes
- */
- namespace whowas
- {
-
- /** Used to hold WHOWAS information
- */
- class WhoWasGroup : public classbase
- {
- public:
- /** Real host
- */
- char* host;
- /** Displayed host
- */
- char* dhost;
- /** Ident
- */
- char* ident;
- /** Server name
- */
- const char* server;
- /** Fullname (GECOS)
- */
- char* gecos;
- /** Signon time
- */
- time_t signon;
-
- /** Initialize this WhoQasFroup with a user
- */
- WhoWasGroup(userrec* user);
- /** Destructor
- */
- ~WhoWasGroup();
- };
-
- /** A group of users related by nickname
- */
- typedef std::deque<WhoWasGroup*> whowas_set;
-
- /** Sets of users in the whowas system
- */
- typedef std::map<irc::string,whowas_set*> whowas_users;
-
- /** Sets of time and users in whowas list
- */
- typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
-
- /** Called every hour by the core to remove expired entries
- */
- void MaintainWhoWas(InspIRCd* ServerInstance, time_t TIME);
-
- /** Prune for WhoWasGroupSize, WhoWasMaxGroups and
- * WhoWasMaxKeep on rehash
- */
- void PruneWhoWas(InspIRCd* ServerInstance, time_t TIME);
- };
-};
-
/* Configuration callbacks */
class ServerConfig;