1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __CMD_WHOWAS_H__
15 #define __CMD_WHOWAS_H__
18 // include the common header files
23 /* list of available internal commands */
32 /* Forward ref for timer */
33 class WhoWasMaintainTimer;
35 /* Forward ref for typedefs */
38 /** InspTimer that is used to maintain the whowas list, called once an hour
40 extern WhoWasMaintainTimer* timer;
42 /** A group of users related by nickname
44 typedef std::deque<WhoWasGroup*> whowas_set;
46 /** Sets of users in the whowas system
48 typedef std::map<irc::string,whowas_set*> whowas_users;
50 /** Sets of time and users in whowas list
52 typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
54 /** Handle /WHOWAS. These command handlers can be reloaded by the core,
55 * and handle basic RFC1459 commands. Commands within modules work
56 * the same way, however, they can be fully unloaded, where these
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);
77 * @param parameters The parameters to the comamnd
78 * @param pcnt The number of parameters passed to teh command
79 * @param user The user issuing the command
80 * @return A value from CmdResult to indicate command success or failure.
82 CmdResult Handle(const char** parameters, int pcnt, userrec *user);
84 * @param parameters The parameters to the comamnd
85 * @param pcnt The number of parameters passed to teh command
86 * @param user The user issuing the command
87 * @return A value from CmdResult to indicate command success or failure.
89 CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> ¶meters);
90 void AddToWhoWas(userrec* user);
91 void GetStats(Extensible* ext);
92 void PruneWhoWas(time_t t);
93 void MaintainWhoWas(time_t t);
94 virtual ~cmd_whowas();
97 /** Used to hold WHOWAS information
99 class WhoWasGroup : public classbase
121 /** Initialize this WhoQasFroup with a user
123 WhoWasGroup(userrec* user);
129 class WhoWasMaintainTimer : public InspTimer
132 InspIRCd* ServerInstance;
134 WhoWasMaintainTimer(InspIRCd* Instance, long interval)
135 : InspTimer(interval, Instance->Time(), true), ServerInstance(Instance)
138 virtual void Tick(time_t TIME);