diff options
| author | Adam <Adam@drink-coca-cola.info> | 2010-05-14 20:35:38 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-06-18 21:01:53 -0400 |
| commit | f049124905bd9f53439293e873003cb027a17b91 (patch) | |
| tree | 352ed9251fd47055dd770aa2d5eabb20247e4b43 /src/core | |
| parent | 81a45520a773732c9f46785f27aa1956150775d7 (diff) | |
Rewrote the hashing system to use std::tr1::unordered_map
Diffstat (limited to 'src/core')
110 files changed, 759 insertions, 820 deletions
diff --git a/src/core/bs_act.c b/src/core/bs_act.c index d0b9c8b08..1bf11e078 100644 --- a/src/core/bs_act.c +++ b/src/core/bs_act.c @@ -75,7 +75,7 @@ class BSAct : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSAct()); + this->AddCommand(BotServ, new CommandBSAct()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c index f37db9aca..dc847eb66 100644 --- a/src/core/bs_assign.c +++ b/src/core/bs_assign.c @@ -85,7 +85,7 @@ class BSAssign : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSAssign); + this->AddCommand(BotServ, new CommandBSAssign); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c index af616c41a..3db6f1e42 100644 --- a/src/core/bs_badwords.c +++ b/src/core/bs_badwords.c @@ -229,7 +229,7 @@ class BSBadwords : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSBadwords); + this->AddCommand(BotServ, new CommandBSBadwords); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index 8abfecde8..d8cb3db6d 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -414,7 +414,7 @@ class BSBot : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSBot()); + this->AddCommand(BotServ, new CommandBSBot()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_botlist.c b/src/core/bs_botlist.c index 540cac30d..935e6d18a 100644 --- a/src/core/bs_botlist.c +++ b/src/core/bs_botlist.c @@ -23,34 +23,39 @@ class CommandBSBotList : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - int i, count = 0; - BotInfo *bi; + unsigned count = 0; - if (!nbots) { + if (BotList.empty()) + { notice_lang(Config.s_BotServ, u, BOT_BOTLIST_EMPTY); return MOD_CONT; } - for (i = 0; i < 256; i++) { - for (bi = botlists[i]; bi; bi = bi->next) { - if (!(bi->HasFlag(BI_PRIVATE))) { - if (!count) - notice_lang(Config.s_BotServ, u, BOT_BOTLIST_HEADER); - count++; - u->SendMessage(Config.s_BotServ, " %-15s (%s@%s)", bi->nick.c_str(), bi->user.c_str(), bi->host.c_str()); - } + for (botinfo_map::const_iterator it = BotList.begin(); it != BotList.end(); ++it) + { + BotInfo *bi = it->second; + + if (!bi->HasFlag(BI_PRIVATE)) + { + if (!count) + notice_lang(Config.s_BotServ, u, BOT_BOTLIST_HEADER); + count++; + u->SendMessage(Config.s_BotServ, " %-15s (%s@%s)", bi->nick.c_str(), bi->user.c_str(), bi->host.c_str()); } } - if (u->Account()->HasCommand("botserv/botlist") && count < nbots) { + if (u->Account()->HasCommand("botserv/botlist") && count < BotList.size()) + { notice_lang(Config.s_BotServ, u, BOT_BOTLIST_PRIVATE_HEADER); - for (i = 0; i < 256; i++) { - for (bi = botlists[i]; bi; bi = bi->next) { - 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++; - } + for (botinfo_map::const_iterator it = BotList.begin(); it != BotList.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++; } } } @@ -59,6 +64,7 @@ class CommandBSBotList : public Command notice_lang(Config.s_BotServ, u, BOT_BOTLIST_EMPTY); else notice_lang(Config.s_BotServ, u, BOT_BOTLIST_FOOTER, count); + return MOD_CONT; } @@ -77,7 +83,7 @@ class BSBotList : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSBotList()); + this->AddCommand(BotServ, new CommandBSBotList()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_help.c b/src/core/bs_help.c index d28595986..a3e53df5c 100644 --- a/src/core/bs_help.c +++ b/src/core/bs_help.c @@ -25,7 +25,7 @@ class CommandBSHelp : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - mod_help_cmd(Config.s_BotServ, u, BOTSERV, params[0].c_str()); + mod_help_cmd(findbot(Config.s_BotServ), u, params[0].c_str()); return MOD_CONT; } @@ -46,7 +46,7 @@ class BSHelp : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSHelp()); + this->AddCommand(BotServ, new CommandBSHelp()); } }; diff --git a/src/core/bs_info.c b/src/core/bs_info.c index 3ac3e9540..3f873aafd 100644 --- a/src/core/bs_info.c +++ b/src/core/bs_info.c @@ -19,25 +19,24 @@ class CommandBSInfo : public Command private: void send_bot_channels(User * u, BotInfo * bi) { - int i; - ChannelInfo *ci; char buf[307], *end; *buf = 0; end = buf; - for (i = 0; i < 256; i++) { - for (ci = chanlists[i]; ci; ci = ci->next) { - if (ci->bi == bi) { - if (strlen(buf) + strlen(ci->name.c_str()) > 300) { - u->SendMessage(Config.s_BotServ, "%s", buf); - *buf = 0; - end = buf; - } - end += - snprintf(end, sizeof(buf) - (end - buf), " %s ", - ci->name.c_str()); + for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(); it != RegisteredChannelList.end(); ++it) + { + ChannelInfo *ci = it->second; + + if (ci->bi == bi) + { + if (strlen(buf) + strlen(ci->name.c_str()) > 300) + { + u->SendMessage(Config.s_BotServ, "%s", buf); + *buf = 0; + end = buf; } + end += snprintf(end, sizeof(buf) - (end - buf), " %s ", ci->name.c_str()); } } @@ -251,7 +250,7 @@ class BSInfo : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSInfo()); + this->AddCommand(BotServ, new CommandBSInfo()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index 766239c73..ab2782c8d 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -335,7 +335,7 @@ class BSKick : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSKick()); + this->AddCommand(BotServ, new CommandBSKick()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_say.c b/src/core/bs_say.c index 9cd630eb8..8dfc55115 100644 --- a/src/core/bs_say.c +++ b/src/core/bs_say.c @@ -81,7 +81,7 @@ class BSSay : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(BOTSERV, new CommandBSSay()); + this->AddCommand(BotServ, new CommandBSSay()); ModuleManager::Attach(I_OnBotServHelp, this); } diff --git a/src/core/bs_set.c b/src/core/bs_ |
