diff options
| author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-21 23:14:28 -0400 |
|---|---|---|
| committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-21 23:14:28 -0400 |
| commit | 1e20877e2f529b61b205a0b1202c32962ee47938 (patch) | |
| tree | 85e4655edf6071d41391362b5d9fcdd0589d63c8 /src | |
| parent | fb16ce72a0b5a3ce336e003327c8d1740f4fdb98 (diff) | |
The next of a few "CBX OCDing over code style" commits, focusing on src/core/bs_* and src/core/cs_*.
Diffstat (limited to 'src')
53 files changed, 586 insertions, 836 deletions
diff --git a/src/core/bs_act.cpp b/src/core/bs_act.cpp index d313fd587..3cf1cb0f9 100644 --- a/src/core/bs_act.cpp +++ b/src/core/bs_act.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" diff --git a/src/core/bs_assign.cpp b/src/core/bs_assign.cpp index d5fa0bdef..b6703c04c 100644 --- a/src/core/bs_assign.cpp +++ b/src/core/bs_assign.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" diff --git a/src/core/bs_badwords.cpp b/src/core/bs_badwords.cpp index 7a9c6ebdf..d4be661bf 100644 --- a/src/core/bs_badwords.cpp +++ b/src/core/bs_badwords.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" @@ -86,16 +85,14 @@ class CommandBSBadwords : public Command CommandReturn DoList(User *u, ChannelInfo *ci, const ci::string &word) { if (!ci->GetBadWordCount()) - { notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name.c_str()); - } else if (!word.empty() && strspn(word.c_str(), "1234567890,-") == word.length()) (new BadwordsListCallback(u, ci, word.c_str()))->Process(); else { bool SentHeader = false; - - for (unsigned i = 0; i < ci->GetBadWordCount(); i++) + + for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i) { BadWord *bw = ci->GetBadWord(i); @@ -145,12 +142,11 @@ class CommandBSBadwords : public Command return MOD_CONT; } - for (unsigned i = 0; i < ci->GetBadWordCount(); ++i) + for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i) { BadWord *bw = ci->GetBadWord(i); - if (!bw->word.empty() && ((Config.BSCaseSensitive && !stricmp(bw->word.c_str(), realword.c_str())) - || (!Config.BSCaseSensitive && bw->word == realword.c_str()))) + if (!bw->word.empty() && ((Config.BSCaseSensitive && !stricmp(bw->word.c_str(), realword.c_str())) || (!Config.BSCaseSensitive && bw->word == realword.c_str()))) { notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS, bw->word.c_str(), ci->name.c_str()); return MOD_CONT; @@ -171,10 +167,10 @@ class CommandBSBadwords : public Command (new BadwordsDelCallback(u, ci, word.c_str()))->Process(); else { - unsigned i; + unsigned i, end; BadWord *badword; - for (i = 0; i < ci->GetBadWordCount(); ++i) + for (i = 0, end = ci->GetBadWordCount(); i < end; ++i) { badword = ci->GetBadWord(i); @@ -182,12 +178,12 @@ class CommandBSBadwords : public Command break; } - if (i == ci->GetBadWordCount()) + if (i == end) { notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NOT_FOUND, word.c_str(), ci->name.c_str()); return MOD_CONT; } - + ci->EraseBadWord(i); notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name.c_str()); diff --git a/src/core/bs_bot.cpp b/src/core/bs_bot.cpp index 1d3103e29..2b7cc5cf4 100644 --- a/src/core/bs_bot.cpp +++ b/src/core/bs_bot.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" @@ -57,14 +56,12 @@ class CommandBSBot : public Command return MOD_CONT; } - for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) - { + for (ch = nick; *ch && ch - nick < Config.NickLen; ++ch) if (!isvalidnick(*ch)) { notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); return MOD_CONT; } - } /* check for hardcored ircd forbidden nicks */ if (!ircdproto->IsNickValid(nick)) @@ -80,15 +77,12 @@ class CommandBSBot : public Command return MOD_CONT; } - for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) - { + for (ch = user; *ch && ch - user < Config.UserLen; ++ch) if (!isalnum(*ch)) { notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); return MOD_CONT; } - } - /* We check whether the nick is registered, and inform the user * if so. You need to drop the nick manually before you can use @@ -185,14 +179,12 @@ class CommandBSBot : public Command return MOD_CONT; } - for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) - { + for (ch = nick; *ch && ch - nick < Config.NickLen; ++ch) if (!isvalidnick(*ch)) { notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); return MOD_CONT; } - } /* check for hardcored ircd forbidden nicks */ if (!ircdproto->IsNickValid(nick)) @@ -208,16 +200,12 @@ class CommandBSBot : public Command } if (user) - { - for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) - { + for (ch = user; *ch && ch - user < Config.UserLen; ++ch) if (!isalnum(*ch)) { notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); return MOD_CONT; } - } - } ci::string ci_bi_nick(bi->nick.c_str()); if (ci_bi_nick != nick && findbot(nick)) @@ -271,10 +259,9 @@ class CommandBSBot : public Command if (user) { - if (ircd->ts6) { + if (ircd->ts6) // This isn't the nicest way to do this, unfortunately. bi->uid = ts6_uid_retrieve(); - } ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->pseudoclient_mode, bi->uid); XLine x(bi->nick.c_str(), "Reserved for services"); ircdproto->SendSQLine(&x); diff --git a/src/core/bs_botlist.cpp b/src/core/bs_botlist.cpp index ebebf7a71..bfc0cfc58 100644 --- a/src/core/bs_botlist.cpp +++ b/src/core/bs_botlist.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" @@ -31,15 +30,15 @@ class CommandBSBotList : public Command return MOD_CONT; } - for (botinfo_map::const_iterator it = BotListByNick.begin(); it != BotListByNick.end(); ++it) + for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { BotInfo *bi = it->second; - + if (!bi->HasFlag(BI_PRIVATE)) { if (!count) notice_lang(Config.s_BotServ, u, BOT_BOTLIST_HEADER); - count++; + ++count; u->SendMessage(Config.s_BotServ, " %-15s (%s@%s)", bi->nick.c_str(), bi->user.c_str(), bi->host.c_str()); } } @@ -48,14 +47,14 @@ class CommandBSBotList : public Command { notice_lang(Config.s_BotServ, u, BOT_BOTLIST_PRIVATE_HEADER); - for (botinfo_map::const_iterator it = BotListByNick.begin(); it != BotListByNick.end(); ++it) + for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { BotInfo *bi = it->second; - + if (bi->HasFlag(BI_PRIVATE)) { u->SendMessage(Config.s_BotServ, " %-15s (%s@%s)", bi->nick.c_str(), bi->user.c_str(), bi->host.c_str()); - count++; + ++count; } } } diff --git a/src/core/bs_help.cpp b/src/core/bs_help.cpp index 80070c138..3842b8910 100644 --- a/src/core/bs_help.cpp +++ b/src/core/bs_help.cpp @@ -7,9 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ + /*************************************************************************/ #include "module.h" @@ -33,7 +32,7 @@ class CommandBSHelp : public Command { // Abuse syntax error to display general list help. notice_help(Config.s_BotServ, u, BOT_HELP); - for (CommandMap::const_iterator it = BotServ->Commands.begin(); it != BotServ->Commands.end(); ++it) + for (CommandMap::const_iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; ++it) it->second->OnServHelp(u); notice_help(Config.s_BotServ, u, BOT_HELP_FOOTER, Config.BSMinUsers); } @@ -51,6 +50,4 @@ class BSHelp : public Module } }; - - MODULE_INIT(BSHelp) diff --git a/src/core/bs_info.cpp b/src/core/bs_info.cpp index 4e8cf042f..45e650d29 100644 --- a/src/core/bs_info.cpp +++ b/src/core/bs_info.cpp @@ -24,7 +24,7 @@ class CommandBSInfo : public Command *buf = 0; end = buf; - for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(); it != RegisteredChannelList.end(); ++it) + for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it) { ChannelInfo *ci = it->second; @@ -90,142 +90,114 @@ class CommandBSInfo : public Command else notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_BOT_NONE); - if (ci->botflags.HasFlag(BS_KICK_BADWORDS)) { + if (ci->botflags.HasFlag(BS_KICK_BADWORDS)) + { if (ci->ttb[TTB_BADWORDS]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_BADWORDS]); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_BADWORDS]); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS, - getstring(u, BOT_INFO_ACTIVE)); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_BOLDS)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS, getstring(u, BOT_INFO_ACTIVE)); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BADWORDS, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_BOLDS)) + { if (ci->ttb[TTB_BOLDS]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_BOLDS]); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_BOLDS]); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS, - getstring(u, BOT_INFO_ACTIVE)); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_CAPS)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS, getstring(u, BOT_INFO_ACTIVE)); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_BOLDS, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_CAPS)) + { if (ci->ttb[TTB_CAPS]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_CAPS], ci->capsmin, - ci->capspercent); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_ON, - getstring(u, BOT_INFO_ACTIVE), ci->capsmin, - ci->capspercent); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_OFF, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_COLORS)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_ON, getstring(u, BOT_INFO_ACTIVE), ci->capsmin, ci->capspercent); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_CAPS_OFF, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_COLORS)) + { if (ci->ttb[TTB_COLORS]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_COLORS]); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_COLORS]); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS, - getstring(u, BOT_INFO_ACTIVE)); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_FLOOD)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS, getstring(u, BOT_INFO_ACTIVE)); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_COLORS, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_FLOOD)) + { if (ci->ttb[TTB_FLOOD]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_FLOOD], ci->floodlines, - ci->floodsecs); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_ON, - getstring(u, BOT_INFO_ACTIVE), - ci->floodlines, ci->floodsecs); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_OFF, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_REPEAT)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_ON, getstring(u, BOT_INFO_ACTIVE), ci->floodlines, ci->floodsecs); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_FLOOD_OFF, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_REPEAT)) + { if (ci->ttb[TTB_REPEAT]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_REPEAT], ci->repeattimes); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_REPEAT], ci->repeattimes); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_ON, - getstring(u, BOT_INFO_ACTIVE), - ci->repeattimes); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_OFF, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_REVERSES)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_ON, getstring(u, BOT_INFO_ACTIVE), ci->repeattimes); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REPEAT_OFF, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_REVERSES)) + { if (ci->ttb[TTB_REVERSES]) - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_REVERSES]); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_REVERSES]); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES, - getstring(u, BOT_INFO_ACTIVE)); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES, - getstring(u, BOT_INFO_INACTIVE)); - if (ci->botflags.HasFlag(BS_KICK_UNDERLINES)) { + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES, getstring(u, BOT_INFO_ACTIVE)); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_REVERSES, getstring(u, BOT_INFO_INACTIVE)); + if (ci->botflags.HasFlag(BS_KICK_UNDERLINES)) + { if (ci->ttb[TTB_UNDERLINES]) - notice_lang(Config.s_BotServ, u, - BOT_INFO_CHAN_KICK_UNDERLINES_BAN, - getstring(u, BOT_INFO_ACTIVE), - ci->ttb[TTB_UNDERLINES]); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES_BAN, getstring(u, BOT_INFO_ACTIVE), ci->ttb[TTB_UNDERLINES]); else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES, - getstring(u, BOT_INFO_ACTIVE)); - } else - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES, - getstring(u, BOT_INFO_INACTIVE)); + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES, getstring(u, BOT_INFO_ACTIVE)); + } + else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_KICK_UNDERLINES, getstring(u, BOT_INFO_INACTIVE)); end = buf; *end = 0; - if (ci->botflags.HasFlag(BS_DONTKICKOPS)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s", - getstring(u, BOT_INFO_OPT_DONTKICKOPS)); + if (ci->botflags.HasFlag(BS_DONTKICKOPS)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s", getstring(u, BOT_INFO_OPT_DONTKICKOPS)); need_comma = 1; } - if (ci->botflags.HasFlag(BS_DONTKICKVOICES)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", - need_comma ? commastr : "", - getstring(u, BOT_INFO_OPT_DONTKICKVOICES)); + if (ci->botflags.HasFlag(BS_DONTKICKVOICES)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? commastr : "", getstring(u, BOT_INFO_OPT_DONTKICKVOICES)); need_comma = 1; } - if (ci->botflags.HasFlag(BS_FANTASY)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", - need_comma ? commastr : "", - getstring(u, BOT_INFO_OPT_FANTASY)); + if (ci->botflags.HasFlag(BS_FANTASY)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? commastr : "", getstring(u, BOT_INFO_OPT_FANTASY)); need_comma = 1; } - if (ci->botflags.HasFlag(BS_GREET)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", - need_comma ? commastr : "", - getstring(u, BOT_INFO_OPT_GREET)); + if (ci->botflags.HasFlag(BS_GREET)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? commastr : "", getstring(u, BOT_INFO_OPT_GREET)); need_comma = 1; } - if (ci->botflags.HasFlag(BS_NOBOT)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", - need_comma ? commastr : "", - getstring(u, BOT_INFO_OPT_NOBOT)); + if (ci->botflags.HasFlag(BS_NOBOT)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? commastr : "", getstring(u, BOT_INFO_OPT_NOBOT)); need_comma = 1; } - if (ci->botflags.HasFlag(BS_SYMBIOSIS)) { - end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", - need_comma ? commastr : "", - getstring(u, BOT_INFO_OPT_SYMBIOSIS)); + if (ci->botflags.HasFlag(BS_SYMBIOSIS)) + { + end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? commastr : "", getstring(u, BOT_INFO_OPT_SYMBIOSIS)); need_comma = 1; } - notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_OPTIONS, - *buf ? buf : getstring(u, BOT_INFO_OPT_NONE)); - - } else + notice_lang(Config.s_BotServ, u, BOT_INFO_CHAN_OPTIONS, *buf ? buf : getstring(u, BOT_INFO_OPT_NONE)); + } + else notice_lang(Config.s_BotServ, u, BOT_INFO_NOT_FOUND, query); return MOD_CONT; } diff --git a/src/core/bs_kick.cpp b/src/core/bs_kick.cpp index 6c8e020e4..54781a134 100644 --- a/src/core/bs_kick.cpp +++ b/src/core/bs_kick.cpp @@ -40,14 +40,18 @@ class CommandBSKick : public Command notice_lang(Config.s_BotServ, u, ACCESS_DENIED); else if (!ci->bi) notice_help(Config.s_BotServ, u, BOT_NOT_ASSIGNED); - else { - if (option == "BADWORDS") { - if (value == "ON") { - if (ttb) { + else + { + if (option == "BADWORDS") + { + if (value == "ON") + { + if (ttb) + { errno = 0; ci->ttb[TTB_BADWORDS] = strtol(ttb, NULL, 10); /* Only error if errno returns ERANGE or EINVAL or we are less then 0 - TSL */ - if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BADWORDS] < 0) + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BADWORDS] < 0) { /* leaving the debug behind since we might want to know what these are */ Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_BADWORDS]; @@ -56,59 +60,71 @@ class CommandBSKick : public Command notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } - } else { - ci->ttb[TTB_BADWORDS] = 0; } + else + ci->ttb[TTB_BADWORDS] = 0; ci->botflags.SetFlag(BS_KICK_BADWORDS); if (ci->ttb[TTB_BADWORDS]) - notice_lang(Config.s_BotServ, u, BOT_KICK_BADWORDS_ON_BAN, - ci->ttb[TTB_BADWORDS]); + notice_lang(Config.s_BotServ, u, BOT_KICK_BADWORDS_ON_BAN, ci->ttb[TTB_BADWORDS]); else notice_lang(Config.s_BotServ, u, BOT_KICK_BADWORDS_ON); - } else { + } + else + { ci->botflags.UnsetFlag(BS_KICK_BADWORDS); notice_lang(Config.s_BotServ, u, BOT_KICK_BADWORDS_OFF); } - } else if (option == "BOLDS") { - if (value == "ON") { - if (ttb) { + } + else if (option == "BOLDS") + { + if (value == "ON") + { + if (ttb) + { errno = 0; ci->ttb[TTB_BOLDS] = strtol(ttb, NULL, 10); - if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BOLDS] < 0) + if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BOLDS] < 0) { Alog(LOG_DEBUG) << "errno is " << errno << " ERANGE " << ERANGE << " EINVAL " << EINVAL << " ttb " << ci->ttb[TTB_BOLDS]; ci->ttb[TTB_BOLDS] = 0; notice_lang(Config.s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } - } else + } + else ci->ttb[TTB_BOLDS] = 0; ci->botflags.SetFlag(BS_KICK_BOLDS); if (ci->ttb[TTB_BOLDS]) - notice_lang(Config.s_BotServ, u, BOT_KICK_BOLDS_ON_BAN, - ci->ttb[TTB_BOLDS]); + notice_lang(Config.s_BotServ, u, BOT_KICK_BOLDS_ON_BAN, ci->ttb[TTB_BOLDS]); else notice_lang(Config.s_BotServ, u, BOT_KICK_BOLDS_ON); - } else { + } + else + { ci->botflags.UnsetFlag(BS_KICK_BOLDS); notice_lang(Config.s_BotServ, u, BOT_KICK_BOLDS_OFF); |
