/* +------------------------------------+
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
* InspIRCd is copyright (C) 2002-2007 ChatSpike-Dev.
* E-mail:
* <brain@chatspike.net>
* <Craig@chatspike.net>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/#ifndef __CMD_WHOWAS_H__#define __CMD_WHOWAS_H__// include the common header files
#include"users.h"#include"channels.h"/* list of available internal commands */enumInternals{WHOWAS_ADD=1,WHOWAS_STATS=2,WHOWAS_PRUNE=3,WHOWAS_MAINTAIN=4};/* Forward ref for timer */classWhoWasMaintainTimer;/* Forward ref for typedefs */classWhoWasGroup;/** InspTimer that is used to maintain the whowas list, called once an hour
*/externWhoWasMaintainTimer*timer;/** A group of users related by nickname
*/typedefstd::deque<WhoWasGroup*>whowas_set;/** Sets of users in the whowas system
*/typedefstd::map<irc::string,whowas_set*>whowas_users;/** Sets of time and users in whowas list
*/typedefstd::deque<std::pair<time_t,irc::string>>whowas_users_fifo;/** Handle /WHOWAS. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
* may not.
*/classcmd_whowas:publiccommand_t{private:/** Whowas container, contains a map of vectors of users tracked by WHOWAS
*/whowas_userswhowas;/** Whowas container, contains a map of time_t to users tracked by WHOWAS
*/whowas_users_fifowhowas_fifo;/* String holding stats so it can be collected
*/std::stringstats;public:cmd_whowas(InspIRCd*Instance);/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/CmdResultHandle(constchar**parameters,intpcnt,userrec*user);/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/CmdResultHandleInternal(constunsignedintid,conststd::deque<classbase*>¶meters);voidAddToWhoWas(userrec*user);voidGetStats(Extensible*ext);voidPruneWhoWas(time_tt);voidMaintainWhoWas(time_tt);virtual~cmd_whowas();};/** Used to hold WHOWAS information
*/classWhoWasGroup:publicclassbase{public:/** Real host
*/char*host;/** Displayed host
*/char*dhost;/** Ident
*/char*ident;/** Server name
*/constchar*server;/** Fullname (GECOS)
*/char*gecos;/** Signon time
*/time_tsignon;/** Initialize this WhoQasFroup with a user
*/WhoWasGroup(userrec*user);/** Destructor
*/~WhoWasGroup();};classWhoWasMaintainTimer:publicInspTimer{private:InspIRCd*ServerInstance;public:WhoWasMaintainTimer(InspIRCd*Instance,longinterval):InspTimer(interval,Instance->Time(),true),ServerInstance(Instance){}virtualvoidTick(time_tTIME);};#endif