1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2007 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #ifndef __CMD_WHOWAS_H__
18 #define __CMD_WHOWAS_H__
21 // include the common header files
26 /* list of available internal commands */
35 /* Forward ref for timer */
36 class WhoWasMaintainTimer;
38 /* Forward ref for typedefs */
41 /** InspTimer that is used to maintain the whowas list, called once an hour
43 extern WhoWasMaintainTimer* timer;
45 /** A group of users related by nickname
47 typedef std::deque<WhoWasGroup*> whowas_set;
49 /** Sets of users in the whowas system
51 typedef std::map<irc::string,whowas_set*> whowas_users;
53 /** Sets of time and users in whowas list
55 typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
59 class cmd_whowas : public command_t
62 /** Whowas container, contains a map of vectors of users tracked by WHOWAS
66 /** Whowas container, contains a map of time_t to users tracked by WHOWAS
68 whowas_users_fifo whowas_fifo;
70 /* String holding stats so it can be collected
75 cmd_whowas(InspIRCd* Instance);
76 CmdResult Handle(const char** parameters, int pcnt, userrec *user);
77 CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> ¶meters);
78 void AddToWhoWas(userrec* user);
79 void GetStats(Extensible* ext);
80 void PruneWhoWas(time_t t);
81 void MaintainWhoWas(time_t t);
82 virtual ~cmd_whowas();
85 /** Used to hold WHOWAS information
87 class WhoWasGroup : public classbase
109 /** Initialize this WhoQasFroup with a user
111 WhoWasGroup(userrec* user);
117 class WhoWasMaintainTimer : public InspTimer
120 InspIRCd* ServerInstance;
122 WhoWasMaintainTimer(InspIRCd* Instance, long interval)
123 : InspTimer(interval, Instance->Time(), true), ServerInstance(Instance)
126 virtual void Tick(time_t TIME);