1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 20:03:14 +02:00

The next of a few "CBX OCDing over code style" commits, focusing on src/core/ns_*.

This commit is contained in:
Naram Qashat
2010-06-27 11:55:39 -04:00
parent 57caa0b53f
commit 9269d20a70
35 changed files with 104 additions and 213 deletions
+5 -6
View File
@@ -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> &params, 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))
+3 -4
View File
@@ -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;
+1 -2
View File
@@ -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"
+3 -3
View File
@@ -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;
}
+5 -10
View File
@@ -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());
}
}
+5 -6
View File
@@ -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");
}
};
+1 -2
View File
@@ -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"
+5 -18
View File
@@ -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;
+2 -3
View File
@@ -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);
+1 -4
View File
@@ -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;
+4 -10
View File
@@ -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)
+15 -24
View File
@@ -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);
}
}
}
+1 -4
View File
@@ -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;
+2 -3
View File
@@ -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];
+10 -15
View File
@@ -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)
+1 -2
View File
@@ -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"
+6 -7
View File
@@ -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;
}
};
+4 -13
View File
@@ -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;
}
+2 -5
View File
@@ -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");
}
};
+6 -7
View File
@@ -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());
}
};
+4 -13
View File
@@ -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;
}
+1 -4
View File
@@ -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");
+2 -5
View File
@@ -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"));
+1 -3
View File
@@ -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"
+1 -4
View File
@@ -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");
+1 -4
View File
@@ -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");
+1 -4
View File
@@ -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");
+1 -4
View File
@@ -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");
+2 -5
View File
@@ -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");
+1 -4
View File
@@ -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");
+1 -4
View File
@@ -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");
+1 -4
View File
@@ -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");
+1 -2
View File
@@ -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"
+2 -3
View File
@@ -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;
+2 -2
View File
@@ -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());
}
};