diff options
Diffstat (limited to 'src')
35 files changed, 104 insertions, 213 deletions
diff --git a/src/core/ns_access.cpp b/src/core/ns_access.cpp index e0549172e..4fc76903d 100644 --- a/src/core/ns_access.cpp +++ b/src/core/ns_access.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" @@ -20,7 +19,7 @@ class CommandNSAccess : public Command CommandReturn DoServAdminList(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) { const char *mask = params.size() > 2 ? params[2].c_str() : NULL; - unsigned i; + unsigned i, end; if (nc->access.empty()) { @@ -35,7 +34,7 @@ class CommandNSAccess : public Command } notice_lang(Config.s_NickServ, u, NICK_ACCESS_LIST_X, params[1].c_str()); - for (i = 0; i < nc->access.size(); ++i) + for (i = 0, end = nc->access.size(); i < end; ++i) { std::string access = nc->GetAccess(i); if (mask && !Anope::Match(access, mask, true)) @@ -94,7 +93,7 @@ class CommandNSAccess : public Command CommandReturn DoList(User *u, NickCore *nc, const char *mask) { - unsigned i; + unsigned i, end; if (nc->access.empty()) { @@ -103,7 +102,7 @@ class CommandNSAccess : public Command } notice_lang(Config.s_NickServ, u, NICK_ACCESS_LIST); - for (i = 0; i < nc->access.size(); ++i) + for (i = 0, end = nc->access.size(); i < end; ++i) { std::string access = nc->GetAccess(i); if (mask && !Anope::Match(access, mask, true)) diff --git a/src/core/ns_alist.cpp b/src/core/ns_alist.cpp index ddbb6c1db..ebff3f0c8 100644 --- a/src/core/ns_alist.cpp +++ b/src/core/ns_alist.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" @@ -94,7 +93,7 @@ class CommandNSAList : public Command notice_lang(Config.s_NickServ, u, is_servadmin ? NICK_ALIST_HEADER_X : NICK_ALIST_HEADER, na->nick); - 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; @@ -107,7 +106,7 @@ class CommandNSAList : public Command ++match_count; - if ((ci->HasFlag(CI_XOP)) || level == ACCESS_FOUNDER) + if (ci->HasFlag(CI_XOP) || level == ACCESS_FOUNDER) { const char *xop; diff --git a/src/core/ns_drop.cpp b/src/core/ns_drop.cpp index f5e52c575..7994e4e7c 100644 --- a/src/core/ns_drop.cpp +++ b/src/core/ns_drop.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/ns_forbid.cpp b/src/core/ns_forbid.cpp index ff54de4c3..6f05dcdfd 100644 --- a/src/core/ns_forbid.cpp +++ b/src/core/ns_forbid.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" @@ -28,7 +27,8 @@ class CommandNSForbid : public Command const char *reason = params.size() > 1 ? params[1].c_str() : NULL; /* Assumes that permission checking has already been done. */ - if (Config.ForceForbidReason && !reason) { + if (Config.ForceForbidReason && !reason) + { this->OnSyntaxError(u, ""); return MOD_CONT; } diff --git a/src/core/ns_getemail.cpp b/src/core/ns_getemail.cpp index 01dff2cfa..94653b856 100644 --- a/src/core/ns_getemail.cpp +++ b/src/core/ns_getemail.cpp @@ -8,13 +8,11 @@ * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. * - * * A simple call to check for all emails that a user may have registered * with. It returns the nicks that match the email you provide. Wild * Cards are not excepted. Must use user@email-host. - * - * */ + /*************************************************************************/ #include "module.h" @@ -33,17 +31,14 @@ class CommandNSGetEMail : public Command Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETEMAIL on " << email; - for (nickcore_map::const_iterator it = NickCoreList.begin(); it != NickCoreList.end(); ++it) + for (nickcore_map::const_iterator it = NickCoreList.begin(), it_end = NickCoreList.end(); it != it_end; ++it) { NickCore *nc = it->second; - if (nc->email) + if (nc->email && nc->email == email) { - if (nc->email == email) - { - ++j; - notice_lang(Config.s_NickServ, u, NICK_GETEMAIL_EMAILS_ARE, nc->display, email.c_str()); - } + ++j; + notice_lang(Config.s_NickServ, u, NICK_GETEMAIL_EMAILS_ARE, nc->display, email.c_str()); } } diff --git a/src/core/ns_getpass.cpp b/src/core/ns_getpass.cpp index 98170b7ac..e6f6533a3 100644 --- a/src/core/ns_getpass.cpp +++ b/src/core/ns_getpass.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" @@ -81,14 +80,14 @@ class NSGetPass : public Module public: NSGetPass(const std::string &modname, const std::string &creator) : Module(modname, creator) { + std::string tmp_pass = "plain:tmp"; + if (enc_decrypt(tmp_pass, tmp_pass) == -1) + throw ModuleException("Incompatible with the encryption module being used"); + this->SetAuthor("Anope"); this->SetType(CORE); this->AddCommand(NickServ, new CommandNSGetPass()); - - std::string tmp_pass = "plain:tmp"; - if (enc_decrypt(tmp_pass, tmp_pass) == -1) - throw ModuleException("Incompatible with the encryption module being used"); } }; diff --git a/src/core/ns_ghost.cpp b/src/core/ns_ghost.cpp index 3f1ae6897..44e71c0c1 100644 --- a/src/core/ns_ghost.cpp +++ b/src/core/ns_ghost.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/ns_group.cpp b/src/core/ns_group.cpp index bf9371f75..5cec0f99f 100644 --- a/src/core/ns_group.cpp +++ b/src/core/ns_group.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" @@ -27,7 +26,7 @@ class CommandNSGroup : public Command NickAlias *na, *target; const char *nick = params[0].c_str(); std::string pass = params[1].c_str(); - std::list<std::pair<ci::string, ci::string> >::iterator it; + std::list<std::pair<ci::string, ci::string> >::iterator it, it_end; if (Config.NSEmailReg && findrequestnick(u->nick)) { @@ -48,16 +47,12 @@ class CommandNSGroup : public Command } if (Config.RestrictOperNicks) - { - for (it = Config.Opers.begin(); it != Config.Opers.end(); ++it) - { + for (it = Config.Opers.begin(), it_end = Config.Opers.end(); it != it_end; ++it) if (!is_oper(u) && u->nick.find(it->first.c_str()) != std::string::npos) { notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } - } - } na = findnick(u->nick); if (!(target = findnick(nick))) @@ -121,9 +116,7 @@ class CommandNSGroup : public Command FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); ircdproto->SetAutoIdentificationToken(u); - Alog() << Config.s_NickServ << ": " << u->GetMask() << " makes " << u->nick - << " join group of " << target->nick << " (" << target->nc->display - << ") (e-mail: " << (target->nc->email ? target->nc->email : "none") << ")"; + Alog() << Config.s_NickServ << ": " << u->GetMask() << " makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (e-mail: " << (target->nc->email ? target->nc->email : "none") << ")"; notice_lang(Config.s_NickServ, u, NICK_GROUP_JOINED, target->nick); u->lastnickreg = time(NULL); @@ -180,14 +173,10 @@ class CommandNSUngroup : public Command std::list<NickAlias *>::iterator it = std::find(oldcore->aliases.begin(), oldcore->aliases.end(), na); if (it != oldcore->aliases.end()) - { oldcore->aliases.erase(it); - } if (!stricmp(oldcore->display, na->nick)) - { change_core_display(oldcore); - } na->nc = new NickCore(na->nick); na->nc->aliases.push_back(na); @@ -206,10 +195,8 @@ class CommandNSUngroup : public Command User *user = finduser(na->nick); if (user) - { /* The user on the nick who was ungrouped may be identified to the old group, set -r */ user->RemoveMode(NickServ, UMODE_REGISTERED); - } } return MOD_CONT; @@ -252,7 +239,7 @@ class CommandNSGList : public Command int wont_expire; notice_lang(Config.s_NickServ, u, nick ? NICK_GLIST_HEADER_X : NICK_GLIST_HEADER, nc->display); - for (std::list<NickAlias *>::iterator it = nc->aliases.begin(); it != nc->aliases.end(); ++it) + for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it) { NickAlias *na2 = *it; diff --git a/src/core/ns_help.cpp b/src/core/ns_help.cpp index b212d5498..423cc5c75 100644 --- a/src/core/ns_help.cpp +++ b/src/core/ns_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" @@ -42,7 +41,7 @@ class CommandNSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_NickServ, u, NICK_HELP); - for (CommandMap::const_iterator it = NickServ->Commands.begin(); it != NickServ->Commands.end(); ++it) + for (CommandMap::const_iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; ++it) it->second->OnServHelp(u); if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP); diff --git a/src/core/ns_identify.cpp b/src/core/ns_identify.cpp index b749358ac..51a0716a4 100644 --- a/src/core/ns_identify.cpp +++ b/src/core/ns_identify.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" @@ -58,9 +57,7 @@ class CommandNSIdentify : public Command else { if (u->IsIdentified()) - { Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out of account " << u->Account()->display; - } if (na->last_realname) delete [] na->last_realname; diff --git a/src/core/ns_info.cpp b/src/core/ns_info.cpp index 72bb59d94..55e11dfce 100644 --- a/src/core/ns_info.cpp +++ b/src/core/ns_info.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" @@ -95,13 +94,8 @@ class CommandNSInfo : public Command notice_lang(Config.s_NickServ, u, NICK_INFO_REALNAME, na->nick, na->last_realname); - if (na->nc->IsServicesOper()) - { - if (show_hidden || (!(na->nc->HasFlag(NI_HIDE_STATUS)))) - { - notice_lang(Config.s_NickServ, u, NICK_INFO_SERVICES_OPERTYPE, na->nick, na->nc->ot->GetName().c_str()); - } - } + if (na->nc->IsServicesOper() && (show_hidden || !na->nc->HasFlag(NI_HIDE_STATUS))) + notice_lang(Config.s_NickServ, u, NICK_INFO_SERVICES_OPERTYPE, na->nick, na->nc->ot->GetName().c_str()); if (nick_online) { @@ -143,7 +137,7 @@ class CommandNSInfo : public Command { if (ircd->vident && !na->hostinfo.GetIdent().empty()) notice_lang(Config.s_NickServ, u, NICK_INFO_VHOST2, na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str()); - else + else notice_lang(Config.s_NickServ, u, NICK_INFO_VHOST, na->hostinfo.GetHost().c_str()); } if (na->nc->greet) diff --git a/src/core/ns_list.cpp b/src/core/ns_list.cpp index b0a2663c0..d126bd104 100644 --- a/src/core/ns_list.cpp +++ b/src/core/ns_list.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" @@ -65,14 +64,12 @@ class CommandNSList : public Command return MOD_CONT; } for (s = tmp; *s; ++s) - { if (!isdigit(*s)) { delete [] tmp; notice_lang(Config.s_ChanServ, u, LIST_INCORRECT_RANGE); return MOD_CONT; } - } from = atoi(tmp); delete [] tmp; tmp = myStrGetTokenRemainder(pattern, '-', 1); /* Read TO out */ @@ -82,14 +79,12 @@ class CommandNSList : public Command return MOD_CONT; } for (s = tmp; *s; ++s) - { if (!isdigit(*s)) { delete [] tmp; notice_lang(Config.s_ChanServ, u, LIST_INCORRECT_RANGE); return MOD_CONT; } - } to = atoi(tmp); delete [] tmp; pattern = sstrdup("*"); @@ -100,18 +95,17 @@ class CommandNSList : public Command if (is_servadmin && params.size() > 1) { - std::string keyword; + ci::string keyword; spacesepstream keywords(params[1].c_str()); while (keywords.GetToken(keyword)) { - ci::string keyword_ci = keyword.c_str(); - if (keyword_ci == "FORBIDDEN") + if (keyword == "FORBIDDEN") forbidden = true; - if (keyword_ci == "NOEXPIRE") + if (keyword == "NOEXPIRE") nsnoexpire = true; - if (keyword_ci == "SUSPENDED") + if (keyword == "SUSPENDED") suspended = true; - if (keyword_ci == "UNCONFIRMED") + if (keyword == "UNCONFIRMED") unconfirmed = true; } } @@ -121,14 +115,14 @@ class CommandNSList : public Command notice_lang(Config.s_NickServ, u, NICK_LIST_HEADER, pattern); if (!unconfirmed) { - for (nickalias_map::const_iterator it = NickAliasList.begin(); it != NickAliasList.end(); ++it) + for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it) { NickAlias *na = it->second; - + /* Don't show private and forbidden nicks to non-services admins. */ - if ((na->HasFlag(NS_FORBIDDEN)) && !is_servadmin) + if (na->HasFlag(NS_FORBIDDEN) && !is_servadmin) continue; - if ((na->nc->HasFlag(NI_PRIVATE)) && !is_servadmin && na->nc != mync) + if (na->nc->HasFlag(NI_PRIVATE) && !is_servadmin && na->nc != mync) continue; if (forbidden && !na->HasFlag(NS_FORBIDDEN)) continue; @@ -140,7 +134,7 @@ class CommandNSList : public Command /* We no longer compare the pattern against the output buffer. * Instead we build a nice nick!user@host buffer to compare. * The output is then generated separately. -TheShadow */ - snprintf(buf, sizeof(buf), "%s!%s", na->nick, na->last_usermask && !(na->HasFlag(NS_FORBIDDEN)) ? na->last_usermask : "*@*"); + snprintf(buf, sizeof(buf), "%s!%s", na->nick, na->last_usermask && !na->HasFlag(NS_FORBIDDEN) ? na->last_usermask : "*@*"); if (!stricmp(pattern, na->nick) || Anope::Match(buf, pattern, false)) { if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nnicks <= Config.NSListMax) @@ -168,18 +162,15 @@ class CommandNSList : public Command { noexpire_char = ' '; - for (nickrequest_map::const_iterator it = NickRequestList.begin(); it != NickRequestList.end(); ++it) + for (nickrequest_map::const_iterator it = NickRequestList.begin(), it_end = NickRequestList.end(); it != it_end; ++it) { NickRequest *nr = it->second; snprintf(buf, sizeof(buf), "%s!*@*", nr->nick); - if (!stricmp(pattern, nr->nick) || Anope::Match(buf, pattern, false)) + if ((!stricmp(pattern, nr->nick) || Anope::Match(buf, pattern, false)) && ++nnicks <= Config.NSListMax) { - if (++nnicks <= Config.NSListMax) - { - snprintf(buf, sizeof(buf), "%-20s [UNCONFIRMED]", nr->nick); - u->SendMessage(Config.s_NickServ, " %c%s", noexpire_char, buf); - } + snprintf(buf, sizeof(buf), "%-20s [UNCONFIRMED]", nr->nick); + u->SendMessage(Config.s_NickServ, " %c%s", noexpire_char, buf); } } } diff --git a/src/core/ns_logout.cpp b/src/core/ns_logout.cpp index 860e60c36..cf49674d0 100644 --- a/src/core/ns_logout.cpp +++ b/src/core/ns_logout.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" @@ -39,9 +38,7 @@ class CommandNSLogout : public Command na = findnick(u2->nick); if (nick && !param.empty() && param == "REVALIDATE") - { validate_user(u2); - } u2->isSuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */ Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out nickname " << u2->nick; diff --git a/src/core/ns_recover.cpp b/src/core/ns_recover.cpp index da6d4381f..acbc7073b 100644 --- a/src/core/ns_recover.cpp +++ b/src/core/ns_recover.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" @@ -68,7 +67,7 @@ class CommandNSRecover : public Command } else { - if (u->Account() == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) + if (u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc))) { char relstr[192]; diff --git a/src/core/ns_register.cpp b/src/core/ns_register.cpp index ece85a9be..3579df173 100644 --- a/src/core/ns_register.cpp +++ b/src/core/ns_register.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" @@ -81,9 +80,7 @@ class CommandNSConfirm : public Command /* Delrequest must be called before validate_user */ delete nr; if (user) - { validate_user(user); - } } FOREACH_MOD(I_OnNickRegister, OnNickRegister(na)); @@ -189,14 +186,14 @@ class CommandNSRegister : public CommandNSConfirm const char *email = params.size() > 1 ? params[1].c_str() : NULL; char passcode[11]; int idx, min = 1, max = 62; - int chars[] = - { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', - 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', - 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', - 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' - }; - std::list<std::pair<ci::string, ci::string> >::iterator it; + int chars[] = { + ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', + 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', + 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' + }; + std::list<std::pair<ci::string, ci::string> >::iterator it, it_end; if (readonly) { @@ -234,8 +231,7 @@ class CommandNSRegister : public CommandNSConfirm } if (Config.RestrictOperNicks) - { - for (it = Config.Opers.begin(); it != Config.Opers.end(); ++it) + for (it = Config.Opers.begin(), it_end = Config.Opers.end(); it != it_end; ++it) { ci::string nick = it->first; @@ -244,7 +240,6 @@ class CommandNSRegister : public CommandNSConfirm notice_lang(Config.s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; } - } } if (Config.NSForceEmail && !email) diff --git a/src/core/ns_release.cpp b/src/core/ns_release.cpp index e01fa3efb..d2b6eaa03 100644 --- a/src/core/ns_release.cpp +++ b/src/core/ns_release.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/ns_resetpass.cpp b/src/core/ns_resetpass.cpp index 9dfd56603..25c598d13 100644 --- a/src/core/ns_resetpass.cpp +++ b/src/core/ns_resetpass.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" @@ -67,12 +66,12 @@ class NSResetPass : public Module public: NSResetPass(const std::string &modname, const std::string &creator) : Module(modname, creator) { - this->SetAuthor("Anope"); - this->SetType(CORE); - if (!Config.UseMail) throw ModuleException("Not using mail."); + this->SetAuthor("Anope"); + this->SetType(CORE); + this->AddCommand(NickServ, new CommandNSResetPass()); ModuleManager::Attach(I_OnPreCommand, this); @@ -83,7 +82,7 @@ class NSResetPass : public Module if (service == Config.s_NickServ && command == "CONFIRM" && !params.empty()) { NickAlias *na = findnick(u->nick); - + time_t t; std::string c; if (na && na->nc->GetExtRegular("ns_resetpass_code", c) && na->nc->GetExtRegular("ns_resetpass_time", t)) @@ -131,7 +130,7 @@ class NSResetPass : public Module return EVENT_STOP; } } - + return EVENT_CONTINUE; } }; diff --git a/src/core/ns_saset.cpp b/src/core/ns_saset.cpp index 7d487c1fa..2b8150f18 100644 --- a/src/core/ns_saset.cpp +++ b/src/core/ns_saset.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" @@ -24,10 +23,8 @@ class CommandNSSASet : public Command ~CommandNSSASet() { - for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) - { + for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) delete it->second; - } this->subcommands.clear(); } @@ -61,11 +58,9 @@ class CommandNSSASet : public Command mod_run_cmd(NickServ, u, c, params[1], cmdparams); } else - { notice_lang(Config.s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str()); - } } - + return MOD_CONT; } @@ -74,7 +69,7 @@ class CommandNSSASet : public Command if (subcommand.empty()) { notice_help(Config.s_NickServ, u, NICK_HELP_SASET_HEAD); - for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) + for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) it->second->OnServHelp(u); notice_help(Config.s_NickServ, u, NICK_HELP_SASET_TAIL); return true; @@ -84,9 +79,7 @@ class CommandNSSASet : public Command Command *c = this->FindCommand(subcommand); if (c) - { return c->OnHelp(u, subcommand); - } } return false; @@ -117,9 +110,7 @@ class CommandNSSASet : public Command std::map<ci::string, Command *>::const_iterator it = this->subcommands.find(subcommand); if (it != this->subcommands.end()) - { return it->second; - } return NULL; } diff --git a/src/core/ns_saset_noexpire.cpp b/src/core/ns_saset_noexpire.cpp index a5df0bb19..e68486350 100644 --- a/src/core/ns_saset_noexpire.cpp +++ b/src/core/ns_saset_noexpire.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -68,7 +66,6 @@ class NSSASetNoexpire : public Module NSSASetNoexpire(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SASET"); @@ -80,7 +77,7 @@ class NSSASetNoexpire : public Module { Command *c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("NOEXPRE"); + c->DelSubcommand("NOEXPIRE"); } }; diff --git a/src/core/ns_sendpass.cpp b/src/core/ns_sendpass.cpp index 0708f5f24..d75f38e8f 100644 --- a/src/core/ns_sendpass.cpp +++ b/src/core/ns_sendpass.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" @@ -74,17 +73,17 @@ class NSSendPass : public Module public: NSSendPass(const std::string &modname, const std::string &creator) : Module(modname, creator) { - this->SetAuthor("Anope"); - this->SetType(CORE); - - this->AddCommand(NickServ, new CommandNSSendPass()); - if (!Config.UseMail) throw ModuleException("Not using mail, whut."); std::string tmp_pass = "plain:tmp"; if (enc_decrypt(tmp_pass, tmp_pass) == -1) throw ModuleException("Incompatible with the encryption module being used"); + + this->SetAuthor("Anope"); + this->SetType(CORE); + + this->AddCommand(NickServ, new CommandNSSendPass()); } }; diff --git a/src/core/ns_set.cpp b/src/core/ns_set.cpp index af3cd7a7f..f858c6a9c 100644 --- a/src/core/ns_set.cpp +++ b/src/core/ns_set.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" @@ -24,10 +23,8 @@ class CommandNSSet : public Command ~CommandNSSet() { - for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) - { + for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) delete it->second; - } this->subcommands.clear(); } @@ -50,16 +47,14 @@ class CommandNSSet : public Command if (c) { ci::string cmdparams; - for (std::vector<ci::string>::const_iterator it = params.begin() + 1; it != params.end(); ++it) + for (std::vector<ci::string>::const_iterator it = params.begin() + 1, it_end = params.end(); it != it_end; ++it) cmdparams += " " + *it; if (!cmdparams.empty()) cmdparams.erase(cmdparams.begin()); mod_run_cmd(NickServ, u, c, params[0], cmdparams); } else - { notice_lang(Config.s_NickServ, u, NICK_SET_UNKNOWN_OPTION, params[0].c_str()); - } return MOD_CONT; } @@ -69,7 +64,7 @@ class CommandNSSet : public Command if (subcommand.empty()) { notice_help(Config.s_NickServ, u, NICK_HELP_SET_HEAD); - for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) + for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) it->second->OnServHelp(u); notice_help(Config.s_NickServ, u, NICK_HELP_SET_TAIL); return true; @@ -79,9 +74,7 @@ class CommandNSSet : public Command Command *c = this->FindCommand(subcommand); if (c) - { return c->OnHelp(u, subcommand); - } } return false; @@ -112,9 +105,7 @@ class CommandNSSet : public Command std::map<ci::string, Command *>::const_iterator it = this->subcommands.find(subcommand); if (it != this->subcommands.end()) - { return it->second; - } return NULL; } diff --git a/src/core/ns_set_autoop.cpp b/src/core/ns_set_autoop.cpp index d1c0d0d81..93e637f97 100644 --- a/src/core/ns_set_autoop.cpp +++ b/src/core/ns_set_autoop.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -110,7 +108,6 @@ class NSSetAutoOp : public Module NSSetAutoOp(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *set = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_email.cpp b/src/core/ns_set_email.cpp index ec1b78c83..6d3e60ecb 100644 --- a/src/core/ns_set_email.cpp +++ b/src/core/ns_set_email.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -133,13 +131,12 @@ class NSSetEmail : public Module NSSetEmail(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); if (c) c->AddSubcommand(new CommandNSSetEmail("EMAIL")); - + c = FindCommand(NickServ, "SASET"); if (c) c->AddSubcommand(new CommandNSSASetEmail("EMAIL")); diff --git a/src/core/ns_set_greet.cpp b/src/core/ns_set_greet.cpp index 0a1e94547..c33b90991 100644 --- a/src/core/ns_set_greet.cpp +++ b/src/core/ns_set_greet.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" diff --git a/src/core/ns_set_hide.cpp b/src/core/ns_set_hide.cpp index e17fac21f..160b0f0fd 100644 --- a/src/core/ns_set_hide.cpp +++ b/src/core/ns_set_hide.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -179,7 +177,6 @@ class NSSetHide : public Module NSSetHide(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *set = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_icq.cpp b/src/core/ns_set_icq.cpp index a00810bac..1fcce6c40 100644 --- a/src/core/ns_set_icq.cpp +++ b/src/core/ns_set_icq.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -109,7 +107,6 @@ class NSSetICQ : public Module NSSetICQ(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_kill.cpp b/src/core/ns_set_kill.cpp index d9d6caa7c..f996fdb5b 100644 --- a/src/core/ns_set_kill.cpp +++ b/src/core/ns_set_kill.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -156,7 +154,6 @@ class NSSetKill : public Module NSSetKill(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_language.cpp b/src/core/ns_set_language.cpp index a175f91a7..00d4f5864 100644 --- a/src/core/ns_set_language.cpp +++ b/src/core/ns_set_language.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -116,7 +114,6 @@ class NSSetLanguage : public Module NSSetLanguage(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_message.cpp b/src/core/ns_set_message.cpp index 89f3cca0a..600872c01 100644 --- a/src/core/ns_set_message.cpp +++ b/src/core/ns_set_message.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -56,7 +54,7 @@ class CommandNSSetMessage : public Command { syntax_error(Config.s_NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX); } - + void OnServHelp(User *u) { notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_MSG); @@ -122,7 +120,6 @@ class NSSetMessage : public Module NSSetMessage(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_private.cpp b/src/core/ns_set_private.cpp index 661287929..da18a8b44 100644 --- a/src/core/ns_set_private.cpp +++ b/src/core/ns_set_private.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -110,7 +108,6 @@ class NSSetPrivate : public Module NSSetPrivate(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_secure.cpp b/src/core/ns_set_secure.cpp index a452a31f3..ce627d9d4 100644 --- a/src/core/ns_set_secure.cpp +++ b/src/core/ns_set_secure.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -110,7 +108,6 @@ class NSSetSecure : public Module NSSetSecure(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_set_url.cpp b/src/core/ns_set_url.cpp index 5ef83d32e..810a43aac 100644 --- a/src/core/ns_set_url.cpp +++ b/src/core/ns_set_url.cpp @@ -7,10 +7,8 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * $Id$ - * */ + /*************************************************************************/ #include "module.h" @@ -102,7 +100,6 @@ class NSSetURL : public Module NSSetURL(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); - this->SetVersion("$Id$"); this->SetType(CORE); Command *c = FindCommand(NickServ, "SET"); diff --git a/src/core/ns_status.cpp b/src/core/ns_status.cpp index df6785902..a213db474 100644 --- a/src/core/ns_status.cpp +++ b/src/core/ns_status.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/ns_suspend.cpp b/src/core/ns_suspend.cpp index 17bfc46c7..6564ca9f8 100644 --- a/src/core/ns_suspend.cpp +++ b/src/core/ns_suspend.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" @@ -60,7 +59,7 @@ class CommandNSSuspend : public Command na->nc->UnsetFlag(NI_KILL_QUICK); na->nc->UnsetFlag(NI_KILL_IMMED); - for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(); it != na->nc->aliases.end(); ++it) + for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end; ++it) { NickAlias *na2 = *it; diff --git a/src/core/ns_update.cpp b/src/core/ns_update.cpp index 271784202..7a2e287b8 100644 --- a/src/core/ns_update.cpp +++ b/src/core/ns_update.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" @@ -60,6 +59,7 @@ class NSUpdate : public Module { this->SetAuthor("Anope"); this->SetType(CORE); + this->AddCommand(NickServ, new CommandNSUpdate()); } }; |