2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
6 * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
8 * This file is part of InspIRCd. InspIRCd is free software: you can
9 * redistribute it and/or modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation, version 2.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 /* Forward ref for typedefs */
29 /** A group of users related by nickname
31 typedef std::deque<WhoWasGroup*> whowas_set;
35 /** Everything known about one nick
39 /** Container where each element has information about one occurrence of this nick
43 /** Destructor, deallocates all elements in the entries container
49 /** Sets of users in the whowas system
51 typedef std::map<irc::string, WhoWas::Nick*> whowas_users;
53 /** Sets of time and users in whowas list
55 typedef std::deque<std::pair<time_t,irc::string> > whowas_users_fifo;
57 /** Handle /WHOWAS. These command handlers can be reloaded by the core,
58 * and handle basic RFC1459 commands. Commands within modules work
59 * the same way, however, they can be fully unloaded, where these
62 class CommandWhowas : public Command
65 /** Primary container, links nicknames tracked by WHOWAS to a list of records
69 /** List of nicknames in the order they were inserted into the map
71 whowas_users_fifo whowas_fifo;
74 /** Max number of WhoWas entries per user.
76 unsigned int GroupSize;
78 /** Max number of cumulative user-entries in WhoWas.
79 * When max reached and added to, push out oldest entry FIFO style.
81 unsigned int MaxGroups;
83 /** Max seconds a user is kept in WhoWas before being pruned.
87 CommandWhowas(Module* parent);
89 * @param parameters The parameters to the comamnd
90 * @param pcnt The number of parameters passed to teh command
91 * @param user The user issuing the command
92 * @return A value from CmdResult to indicate command success or failure.
94 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
95 void AddToWhoWas(User* user);
96 std::string GetStats();
102 /** Used to hold WHOWAS information
126 /** Initialize this WhoWasFroup with a user
128 WhoWasGroup(User* user);