]>
jfr.im git - irc/evilnet/mod.chanfix.git/blob - REHASHCommand.cc
4 * 07/22/2005 - Reed Loden <reed@reedloden.com>
7 * Reload the bot's configuration file
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.
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.
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,
27 #include "gnuworld_config.h"
28 #include "StringTokenizer.h"
31 #include "responses.h"
40 void REHASHCommand::Exec(iClient
* theClient
, sqlcfUser
* theUser
, const std::string
& Message
)
42 StringTokenizer
st(Message
);
46 option
= string_upper(st
[1]);
48 if (option
== "CONFIG" || option
.empty()) {
49 bot
->readConfigFile(bot
->getConfigFileName());
51 bot
->SendTo(theClient
,
52 bot
->getResponse(theUser
,
53 language::reloaded_conf
,
54 std::string("Successfully rehashed configuration file.")).c_str());
55 bot
->logDebugMessage("%s (%s) rehashed the chanfix module.",
56 theUser
->getUserName().c_str(),
57 theClient
->getRealNickUserHost().c_str());
61 if (option
== "HELP") {
62 bot
->helpTable
.clear();
65 bot
->SendTo(theClient
,
66 bot
->getResponse(theUser
,
67 language::reloaded_help
,
68 std::string("Successfully reloaded help tables. %i entries in table.", bot
->helpTable
.size())).c_str());
69 bot
->logDebugMessage("%s (%s) rehashed the chanfix help tables.",
70 theUser
->getUserName().c_str(),
71 theClient
->getRealNickUserHost().c_str());
75 if (option
== "TRANSLATIONS") {
76 bot
->languageTable
.clear();
77 bot
->translationTable
.clear();
78 bot
->loadTranslationTable();
80 bot
->SendTo(theClient
, "Successfully reloaded translation tables. %i entries in table.",
81 bot
->translationTable
.size());
82 bot
->logDebugMessage("%s (%s) rehashed the chanfix translation tables.",
83 theUser
->getUserName().c_str(),
84 theClient
->getRealNickUserHost().c_str());
88 bot
->logAdminMessage("%s (%s) REHASH %s",
89 theUser
->getUserName().c_str(),
90 theClient
->getRealNickUserHost().c_str(),
91 !option
.empty() ? option
.c_str() : "");
93 bot
->logLastComMessage(theClient
, Message
);
100 } // namespace gnuworld