summaryrefslogtreecommitdiff
path: root/include/commands/cmd_whowas.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/commands/cmd_whowas.h')
-rw-r--r--include/commands/cmd_whowas.h66
1 files changed, 19 insertions, 47 deletions
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index d33354122..0a38b44f1 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -19,39 +19,13 @@
*/
-#ifndef CMD_WHOWAS_H
-#define CMD_WHOWAS_H
-#include "modules.h"
-
-struct WhowasRequest : public Request
-{
- /* list of available internal commands */
- enum Internals
- {
- WHOWAS_ADD = 1,
- WHOWAS_STATS = 2,
- WHOWAS_PRUNE = 3,
- WHOWAS_MAINTAIN = 4
- };
-
- const Internals type;
- std::string value;
- User* user;
-
- WhowasRequest(Module* src, Module* whowas, Internals Type) : Request(src, whowas, "WHOWAS"), type(Type)
- {}
-};
+#pragma once
-/* Forward ref for timer */
-class WhoWasMaintainTimer;
+#include "modules.h"
/* Forward ref for typedefs */
class WhoWasGroup;
-/** Timer that is used to maintain the whowas list, called once an hour
- */
-extern WhoWasMaintainTimer* timer;
-
/** A group of users related by nickname
*/
typedef std::deque<WhoWasGroup*> whowas_set;
@@ -72,15 +46,28 @@ typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
class CommandWhowas : public Command
{
private:
- /** Whowas container, contains a map of vectors of users tracked by WHOWAS
+ /** Primary container, links nicknames tracked by WHOWAS to a list of records
*/
whowas_users whowas;
- /** Whowas container, contains a map of time_t to users tracked by WHOWAS
+ /** List of nicknames in the order they were inserted into the map
*/
whowas_users_fifo whowas_fifo;
public:
+ /** Max number of WhoWas entries per user.
+ */
+ unsigned int GroupSize;
+
+ /** Max number of cumulative user-entries in WhoWas.
+ * When max reached and added to, push out oldest entry FIFO style.
+ */
+ unsigned int MaxGroups;
+
+ /** Max seconds a user is kept in WhoWas before being pruned.
+ */
+ unsigned int MaxKeep;
+
CommandWhowas(Module* parent);
/** Handle command.
* @param parameters The parameters to the comamnd
@@ -91,8 +78,8 @@ class CommandWhowas : public Command
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
void AddToWhoWas(User* user);
std::string GetStats();
- void PruneWhoWas(time_t t);
- void MaintainWhoWas(time_t t);
+ void Prune();
+ void Maintain();
~CommandWhowas();
};
@@ -123,19 +110,4 @@ class WhoWasGroup
/** Initialize this WhoWasFroup with a user
*/
WhoWasGroup(User* user);
- /** Destructor
- */
- ~WhoWasGroup();
};
-
-class WhoWasMaintainTimer : public Timer
-{
- public:
- WhoWasMaintainTimer(long interval)
- : Timer(interval, ServerInstance->Time(), true)
- {
- }
- virtual void Tick(time_t TIME);
-};
-
-#endif