1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 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 */
38 /* Forward ref for typedefs */
41 /** InspTimer that is used to maintain the whowas list, called once an hour
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;
71 cmd_whowas(InspIRCd* Instance);
72 CmdResult Handle(const char** parameters, int pcnt, userrec *user);
73 CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> ¶meters);
74 void AddToWhoWas(userrec* user);
75 void GetStats(Extensible* ext);
76 void PruneWhoWas(time_t t);
77 void MaintainWhoWas(time_t t);
78 virtual ~cmd_whowas();
81 /** Used to hold WHOWAS information
83 class WhoWasGroup : public classbase
105 /** Initialize this WhoQasFroup with a user
107 WhoWasGroup(userrec* user);
113 class MaintainTimer : public InspTimer
116 InspIRCd* ServerInstance;
118 MaintainTimer(InspIRCd* Instance, long interval)
119 : InspTimer(interval, Instance->Time(), true), ServerInstance(Instance)
122 virtual void Tick(time_t TIME);