1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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 struct WhowasRequest : public Request
20 /* list of available internal commands */
33 WhowasRequest(Module* src, Module* whowas, Internals Type) : Request(src, whowas, "WHOWAS"), type(Type)
37 /* Forward ref for timer */
38 class WhoWasMaintainTimer;
40 /* Forward ref for typedefs */
43 /** Timer that is used to maintain the whowas list, called once an hour
45 extern WhoWasMaintainTimer* timer;
47 /** A group of users related by nickname
49 typedef std::deque<WhoWasGroup*> whowas_set;
51 /** Sets of users in the whowas system
53 typedef std::map<irc::string,whowas_set*> whowas_users;
55 /** Sets of time and users in whowas list
57 typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
59 /** Handle /WHOWAS. These command handlers can be reloaded by the core,
60 * and handle basic RFC1459 commands. Commands within modules work
61 * the same way, however, they can be fully unloaded, where these
64 class CommandWhowas : public Command
67 /** Whowas container, contains a map of vectors of users tracked by WHOWAS
71 /** Whowas container, contains a map of time_t to users tracked by WHOWAS
73 whowas_users_fifo whowas_fifo;
76 CommandWhowas(Module* parent);
78 * @param parameters The parameters to the comamnd
79 * @param pcnt The number of parameters passed to teh command
80 * @param user The user issuing the command
81 * @return A value from CmdResult to indicate command success or failure.
83 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
84 void AddToWhoWas(User* user);
85 std::string GetStats();
86 void PruneWhoWas(time_t t);
87 void MaintainWhoWas(time_t t);
91 /** Used to hold WHOWAS information
115 /** Initialize this WhoWasFroup with a user
117 WhoWasGroup(User* user);
123 class WhoWasMaintainTimer : public Timer
126 WhoWasMaintainTimer(long interval)
127 : Timer(interval, ServerInstance->Time(), true)
130 virtual void Tick(time_t TIME);