]> jfr.im git - irc/evilnet/mod.chanfix.git/blame - REHASHCommand.cc
Fixed missing include, corebug fix was already applied here.
[irc/evilnet/mod.chanfix.git] / REHASHCommand.cc
CommitLineData
5b224c8a 1/**
2 * REHASHCommand.cc
3 *
4 * 07/22/2005 - Reed Loden <reed@reedloden.com>
5 * Initial Version
6 *
7 * Reload the bot's configuration file
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
5b224c8a 27#include "gnuworld_config.h"
28#include "StringTokenizer.h"
29
30#include "chanfix.h"
91cad274 31#include "responses.h"
5b224c8a 32
33RCSTAG("$Id$");
34
35namespace gnuworld
36{
1d54d2a1 37namespace cf
38{
5b224c8a 39
13a50edb 40void REHASHCommand::Exec(iClient* theClient, sqlcfUser* theUser, const std::string& Message)
5b224c8a 41{
5b224c8a 42StringTokenizer st(Message);
43
c2f14d27 44std::string option;
45if (st.size() > 1)
46 option = string_upper(st[1]);
47
48if (option == "CONFIG" || option.empty()) {
49 bot->readConfigFile(bot->getConfigFileName());
50
51 bot->SendTo(theClient,
52 bot->getResponse(theUser,
53 language::reloaded_conf,
54 std::string("Successfully rehashed configuration file.")).c_str());
20c3e550 55 bot->logDebugMessage("%s (%s) rehashed the chanfix module.",
c2f14d27 56 theUser->getUserName().c_str(),
57 theClient->getRealNickUserHost().c_str());
58 return;
59}
35d3e3d1 60
61if (option == "HELP") {
62 bot->helpTable.clear();
63 bot->loadHelpTable();
d8674157 64
91cad274 65 bot->SendTo(theClient,
66 bot->getResponse(theUser,
67 language::reloaded_help,
716c2822 68 std::string("Successfully reloaded help tables. %i entries in table.", bot->helpTable.size())).c_str());
20c3e550 69 bot->logDebugMessage("%s (%s) rehashed the chanfix help tables.",
35d3e3d1 70 theUser->getUserName().c_str(),
71 theClient->getRealNickUserHost().c_str());
72 return;
73}
5b224c8a 74
91cad274 75if (option == "TRANSLATIONS") {
76 bot->languageTable.clear();
77 bot->translationTable.clear();
78 bot->loadTranslationTable();
d8674157 79
91cad274 80 bot->SendTo(theClient, "Successfully reloaded translation tables. %i entries in table.",
81 bot->translationTable.size());
20c3e550 82 bot->logDebugMessage("%s (%s) rehashed the chanfix translation tables.",
91cad274 83 theUser->getUserName().c_str(),
84 theClient->getRealNickUserHost().c_str());
85 return;
86}
87
8de4dcba 88bot->logAdminMessage("%s (%s) REHASH %s",
87fb1731 89 theUser->getUserName().c_str(),
90 theClient->getRealNickUserHost().c_str(),
91 !option.empty() ? option.c_str() : "");
8de4dcba 92
25f00d30 93bot->logLastComMessage(theClient, Message);
8de4dcba 94
5b224c8a 95return;
96}
97
1d54d2a1 98} // namespace cf
99
5b224c8a 100} // namespace gnuworld