]> jfr.im git - irc/evilnet/mod.chanfix.git/blob - CHECKCommand.cc
Fixed missing include, corebug fix was already applied here.
[irc/evilnet/mod.chanfix.git] / CHECKCommand.cc
1 /**
2 * CHECKCommand.cc
3 *
4 * 07/19/2005 - Reed Loden <reed@reedloden.com>
5 * Initial Version
6 *
7 * Shows the number of ops and total clients in <channel>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 * USA.
23 *
24 * $Id$
25 */
26
27 #include "gnuworld_config.h"
28 #include "Network.h"
29
30 #include "chanfix.h"
31 #include "responses.h"
32 #include "StringTokenizer.h"
33
34 RCSTAG("$Id$");
35
36 namespace gnuworld
37 {
38 namespace cf
39 {
40
41 void CHECKCommand::Exec(iClient* theClient, sqlcfUser* theUser, const std::string& Message)
42 {
43 StringTokenizer st(Message);
44
45 Channel* netChan = Network->findChannel(st[1]);
46 if (!netChan) {
47 bot->SendTo(theClient,
48 bot->getResponse(theUser,
49 language::no_such_channel,
50 std::string("No such channel %s.")).c_str());
51 return;
52 }
53
54 /* Reports ops and total clients. */
55
56 bot->SendTo(theClient,
57 bot->getResponse(theUser,
58 language::check_results,
59 std::string("I see %d opped out of %d total clients in %s.")).c_str(),
60 bot->countChanOps(netChan), netChan->size(),
61 netChan->getName().c_str());
62
63 bot->logAdminMessage("%s (%s) CHECK %s",
64 theUser ? theUser->getUserName().c_str() : "!NOT-LOGGED-IN!",
65 theClient->getRealNickUserHost().c_str(),
66 netChan->getName().c_str());
67
68 bot->logLastComMessage(theClient, Message);
69
70 return;
71 }
72
73 } // namespace cf
74 } // namespace gnuworld