mirror of
https://github.com/anope/anope.git
synced 2026-07-08 14:03:13 +02:00
The next of a few "CBX OCDing over code style" commits, focusing on src/core/hs_* and src/core/ms_*, plus some tiny fallout caused by changing the FOREACH_* macros.
This commit is contained in:
+10
-6
@@ -55,8 +55,8 @@ enum EventReturn
|
||||
* loaded modules in a readable simple way, e.g.:
|
||||
* 'FOREACH_MOD(I_OnConnect,OnConnect(user));'
|
||||
*/
|
||||
#define FOREACH_MOD(y,x) \
|
||||
do \
|
||||
#define FOREACH_MOD(y, x) \
|
||||
if (true) \
|
||||
{ \
|
||||
std::vector<Module*>::iterator safei; \
|
||||
for (std::vector<Module*>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
|
||||
@@ -73,15 +73,17 @@ do \
|
||||
} \
|
||||
_i = safei; \
|
||||
} \
|
||||
} while (0);
|
||||
} \
|
||||
else \
|
||||
static_cast<void>(0)
|
||||
|
||||
/**
|
||||
* This define is similar to the one above but returns a result in MOD_RESULT.
|
||||
* The first module to return a nonzero result is the value to be accepted,
|
||||
* and any modules after are ignored.
|
||||
*/
|
||||
#define FOREACH_RESULT(y,x) \
|
||||
do \
|
||||
#define FOREACH_RESULT(y, x) \
|
||||
if (true) \
|
||||
{ \
|
||||
std::vector<Module*>::iterator safei; \
|
||||
MOD_RESULT = EVENT_CONTINUE; \
|
||||
@@ -103,7 +105,9 @@ do \
|
||||
} \
|
||||
_i = safei; \
|
||||
} \
|
||||
} while(0);
|
||||
} \
|
||||
else \
|
||||
static_cast<void>(0)
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <dlfcn.h>
|
||||
|
||||
+1
-2
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
@@ -34,7 +33,7 @@ class CommandHSDelAll : public Command
|
||||
}
|
||||
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
|
||||
NickCore *nc = na->nc;
|
||||
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)
|
||||
{
|
||||
na = *it;
|
||||
na->hostinfo.RemoveVhost();
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,7 +30,7 @@ class CommandHSHelp : public Command
|
||||
void OnSyntaxError(User *u, const ci::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_HostServ, u, HOST_HELP, Config.s_HostServ);
|
||||
for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it)
|
||||
for (CommandMap::const_iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; ++it)
|
||||
it->second->OnServHelp(u);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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"
|
||||
@@ -41,7 +40,7 @@ class CommandHSList : public Command
|
||||
notice_lang(Config.s_HostServ, u, LIST_INCORRECT_RANGE);
|
||||
return MOD_CONT;
|
||||
}
|
||||
for (unsigned i = 1; i < key.size(); ++i)
|
||||
for (unsigned i = 1, end = key.size(); i < end; ++i)
|
||||
{
|
||||
if (!isdigit(key[i]) && i != tmp)
|
||||
{
|
||||
@@ -53,7 +52,7 @@ class CommandHSList : public Command
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
+2
-3
@@ -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"
|
||||
@@ -32,7 +31,7 @@ class CommandHSOff : public Command
|
||||
ircdproto->SendVhostDel(u);
|
||||
notice_lang(Config.s_HostServ, u, HOST_OFF);
|
||||
}
|
||||
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -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"
|
||||
@@ -46,7 +45,7 @@ class CommandHSOn : public Command
|
||||
}
|
||||
else
|
||||
notice_lang(Config.s_HostServ, u, HOST_NOT_ASSIGNED);
|
||||
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -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"
|
||||
@@ -55,7 +54,6 @@ class CommandHSSet : public Command
|
||||
else
|
||||
{
|
||||
for (s = vIdent; *s; ++s)
|
||||
{
|
||||
if (!isvalidchar(*s))
|
||||
{
|
||||
notice_lang(Config.s_HostServ, u, HOST_SET_IDENT_ERROR);
|
||||
@@ -64,7 +62,6 @@ class CommandHSSet : public Command
|
||||
delete [] hostmask;
|
||||
return MOD_CONT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ircd->vident)
|
||||
{
|
||||
@@ -101,7 +98,6 @@ class CommandHSSet : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
tmp_time = time(NULL);
|
||||
|
||||
if ((na = findnick(nick)))
|
||||
@@ -117,9 +113,7 @@ class CommandHSSet : public Command
|
||||
delete [] hostmask;
|
||||
return MOD_CONT;
|
||||
}
|
||||
Alog() << "vHost for user \002" << nick << "\002 set to \002"
|
||||
<< (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "")
|
||||
<< hostmask << " \002 by oper \002" << u->nick << "\002";
|
||||
Alog() << "vHost for user \002" << nick << "\002 set to \002" << (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "") << hostmask << " \002 by oper \002" << u->nick << "\002";
|
||||
|
||||
na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick);
|
||||
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
|
||||
|
||||
@@ -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,6 @@ class CommandHSSetAll : public Command
|
||||
else
|
||||
{
|
||||
for (s = vIdent; *s; ++s)
|
||||
{
|
||||
if (!isvalidchar(*s))
|
||||
{
|
||||
notice_lang(Config.s_HostServ, u, HOST_SET_IDENT_ERROR);
|
||||
@@ -77,7 +75,6 @@ class CommandHSSetAll : public Command
|
||||
delete [] hostmask;
|
||||
return MOD_CONT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ircd->vident)
|
||||
{
|
||||
@@ -117,9 +114,7 @@ class CommandHSSetAll : public Command
|
||||
|
||||
tmp_time = time(NULL);
|
||||
|
||||
Alog() << "vHost for all nicks in group \002" << nick << "\002 set to \002"
|
||||
<< (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "")
|
||||
<< hostmask << " \002 by oper \002" << u->nick << "\002";
|
||||
Alog() << "vHost for all nicks in group \002" << nick << "\002 set to \002" << (vIdent && ircd->vident ? vIdent : "") << (vIdent && ircd->vident ? "@" : "") << hostmask << " \002 by oper \002" << u->nick << "\002";
|
||||
|
||||
na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick);
|
||||
HostServSyncVhosts(na);
|
||||
|
||||
@@ -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"
|
||||
@@ -44,15 +43,13 @@ class CommandMSCancel : public Command
|
||||
int i;
|
||||
|
||||
for (i = mi->memos.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if ((mi->memos[i]->HasFlag(MF_UNREAD)) && !stricmp(mi->memos[i]->sender.c_str(), u->Account()->display) && !mi->memos[i]->HasFlag(MF_NOTIFYS))
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(name)->nc, mi, mi->memos[i]->number))
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(name)->nc, mi, mi->memos[i]->number));
|
||||
delmemo(mi, mi->memos[i]->number);
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_CANCELLED, name);
|
||||
return MOD_CONT;
|
||||
}
|
||||
}
|
||||
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_CANCEL_NONE);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -41,7 +40,7 @@ class CommandMSCheck : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if ((na->HasFlag(NS_FORBIDDEN)))
|
||||
if (na->HasFlag(NS_FORBIDDEN))
|
||||
{
|
||||
notice_lang(Config.s_MemoServ, u, NICK_X_FORBIDDEN, recipient);
|
||||
return MOD_CONT;
|
||||
@@ -100,6 +99,7 @@ class MSCheck : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSCheck());
|
||||
}
|
||||
};
|
||||
|
||||
+8
-21
@@ -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"
|
||||
@@ -30,13 +29,9 @@ class MemoDelCallback : public NumberList
|
||||
return;
|
||||
|
||||
if (ci)
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, Number - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, Number - 1));
|
||||
}
|
||||
|
||||
delmemo(mi, Number - 1);
|
||||
}
|
||||
@@ -54,7 +49,7 @@ class CommandMSDel : public Command
|
||||
MemoInfo *mi;
|
||||
ChannelInfo *ci = NULL;
|
||||
ci::string numstr = params.size() ? params[0] : "", chan;
|
||||
unsigned i;
|
||||
unsigned i, end;
|
||||
int last;
|
||||
|
||||
if (!numstr.empty() && numstr[0] == '#')
|
||||
@@ -80,9 +75,7 @@ class CommandMSDel : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi = &u->Account()->memos;
|
||||
}
|
||||
if (numstr.empty() || (!isdigit(numstr[0]) && numstr != "ALL" && numstr != "LAST"))
|
||||
this->OnSyntaxError(u, numstr);
|
||||
else if (mi->memos.empty())
|
||||
@@ -99,31 +92,23 @@ class CommandMSDel : public Command
|
||||
else if (numstr == "LAST")
|
||||
{
|
||||
/* Delete last memo. */
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
last = mi->memos[i]->number;
|
||||
if (ci)
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, last));
|
||||
}
|
||||
else
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, last))
|
||||
}
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, last));
|
||||
delmemo(mi, last);
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_DELETED_ONE, last);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ci)
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, 0));
|
||||
}
|
||||
/* Delete all memos. */
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
{
|
||||
delete [] mi->memos[i]->text;
|
||||
delete mi->memos[i];
|
||||
@@ -136,7 +121,7 @@ class CommandMSDel : public Command
|
||||
}
|
||||
|
||||
/* Reset the order */
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
mi->memos[i]->number = i + 1;
|
||||
}
|
||||
return MOD_CONT;
|
||||
@@ -167,6 +152,8 @@ class MSDel : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSDel());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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,7 +30,7 @@ class CommandMSHelp : public Command
|
||||
void OnSyntaxError(User *u, const ci::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_MemoServ, u, MEMO_HELP_HEADER);
|
||||
for (CommandMap::const_iterator it = NickServ->Commands.begin(); it != NickServ->Commands.end(); ++it)
|
||||
for (CommandMap::const_iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; ++it)
|
||||
it->second->OnServHelp(u);
|
||||
notice_help(Config.s_MemoServ, u, MEMO_HELP_FOOTER, Config.s_ChanServ);
|
||||
}
|
||||
@@ -45,6 +44,7 @@ class MSHelp : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSHelp());
|
||||
}
|
||||
};
|
||||
|
||||
+6
-10
@@ -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"
|
||||
@@ -84,12 +83,10 @@ class CommandMSInfo : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = 0, i;
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
{
|
||||
int count = 0, i, end;
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
if (mi->memos[i]->HasFlag(MF_UNREAD))
|
||||
++count;
|
||||
}
|
||||
if (count == mi->memos.size())
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_INFO_X_MEMOS_ALL_UNREAD, name, count);
|
||||
else if (!count)
|
||||
@@ -143,12 +140,10 @@ class CommandMSInfo : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = 0, i;
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
{
|
||||
int count = 0, i, end;
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
if (mi->memos[i]->HasFlag(MF_UNREAD))
|
||||
++count;
|
||||
}
|
||||
if (count == mi->memos.size())
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_INFO_MEMOS_ALL_UNREAD, count);
|
||||
else if (!count)
|
||||
@@ -213,6 +208,7 @@ class MSInfo : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSInfo());
|
||||
}
|
||||
};
|
||||
|
||||
+6
-10
@@ -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,7 +66,7 @@ class CommandMSList : public Command
|
||||
ci::string param = params.size() ? params[0] : "", chan;
|
||||
ChannelInfo *ci;
|
||||
MemoInfo *mi;
|
||||
int i;
|
||||
int i, end;
|
||||
|
||||
if (!param.empty() && param[0] == '#')
|
||||
{
|
||||
@@ -87,9 +86,7 @@ class CommandMSList : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi = &u->Account()->memos;
|
||||
}
|
||||
if (!param.empty() && !isdigit(param[0]) && param != "NEW")
|
||||
this->OnSyntaxError(u, param);
|
||||
else if (!mi->memos.size())
|
||||
@@ -107,12 +104,10 @@ class CommandMSList : public Command
|
||||
{
|
||||
if (!param.empty())
|
||||
{
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
{
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
if (mi->memos[i]->HasFlag(MF_UNREAD))
|
||||
break;
|
||||
}
|
||||
if (i == mi->memos.size())
|
||||
if (i == end)
|
||||
{
|
||||
if (!chan.empty())
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
|
||||
@@ -124,7 +119,7 @@ class CommandMSList : public Command
|
||||
|
||||
bool SentHeader = false;
|
||||
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
{
|
||||
if (!param.empty() && !(mi->memos[i]->HasFlag(MF_UNREAD)))
|
||||
continue;
|
||||
@@ -171,6 +166,7 @@ class MSList : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSList());
|
||||
}
|
||||
};
|
||||
|
||||
+5
-11
@@ -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"
|
||||
@@ -83,9 +82,7 @@ class CommandMSRead : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi = &u->Account()->memos;
|
||||
}
|
||||
num = !numstr.empty() ? atoi(numstr.c_str()) : -1;
|
||||
if (numstr.empty() || (numstr != "LAST" && numstr != "NEW" && num <= 0))
|
||||
this->OnSyntaxError(u, numstr);
|
||||
@@ -97,19 +94,17 @@ class CommandMSRead : public Command
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
int i, end;
|
||||
|
||||
if (numstr == "NEW")
|
||||
{
|
||||
int readcount = 0;
|
||||
for (i = 0; i < mi->memos.size(); ++i)
|
||||
{
|
||||
for (i = 0, end = mi->memos.size(); i < end; ++i)
|
||||
if (mi->memos[i]->HasFlag(MF_UNREAD))
|
||||
{
|
||||
MemoListCallback::DoRead(u, mi, ci, i);
|
||||
++readcount;
|
||||
}
|
||||
}
|
||||
if (!readcount)
|
||||
{
|
||||
if (!chan.empty())
|
||||
@@ -120,13 +115,11 @@ class CommandMSRead : public Command
|
||||
}
|
||||
else if (numstr == "LAST")
|
||||
{
|
||||
for (i = 0; i < mi->memos.size() - 1; ++i);
|
||||
for (i = 0, end = mi->memos.size() - 1; i < end; ++i);
|
||||
MemoListCallback::DoRead(u, mi, ci, i);
|
||||
}
|
||||
else /* number[s] */
|
||||
{
|
||||
(new MemoListCallback(u, mi, numstr.c_str()))->Process();
|
||||
}
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
@@ -156,6 +149,7 @@ class MSRead : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSRead());
|
||||
}
|
||||
};
|
||||
|
||||
+8
-11
@@ -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"
|
||||
@@ -29,13 +28,10 @@ class CommandMSRSend : public Command
|
||||
int z = 3;
|
||||
|
||||
/* prevent user from rsend to themselves */
|
||||
if ((na = findnick(nick)))
|
||||
if ((na = findnick(nick)) && na->nc == u->Account())
|
||||
{
|
||||
if (na->nc == u->Account())
|
||||
{
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_NO_RSEND_SELF);
|
||||
return MOD_CONT;
|
||||
}
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_NO_RSEND_SELF);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
if (Config.MSMemoReceipt == 1)
|
||||
@@ -81,13 +77,14 @@ class MSRSend : public Module
|
||||
public:
|
||||
MSRSend(const std::string &modname, const std::string &creator) : Module(modname, creator)
|
||||
{
|
||||
if (!Config.MSMemoReceipt)
|
||||
throw ModuleException("Don't like memo reciepts, or something.");
|
||||
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
this->AddCommand(MemoServ, new CommandMSRSend());
|
||||
|
||||
if (!Config.MSMemoReceipt)
|
||||
throw ModuleException("Don't like memo reciepts, or something.");
|
||||
this->AddCommand(MemoServ, new CommandMSRSend());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -55,6 +54,7 @@ class MSSend : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSSend());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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"
|
||||
@@ -34,10 +33,10 @@ class CommandMSSendAll : public Command
|
||||
|
||||
NickAlias *na = findnick(u->nick);
|
||||
|
||||
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 ((na && na->nc == nc) || stricmp(u->nick.c_str(), nc->display))
|
||||
memo_send(u, nc->display, text, z);
|
||||
}
|
||||
@@ -71,6 +70,7 @@ class MSSendAll : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSSendAll());
|
||||
}
|
||||
};
|
||||
|
||||
+1
-2
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
@@ -32,10 +31,10 @@ class CommandMSStaff : public Command
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
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->IsServicesOper())
|
||||
memo_send(u, nc->display, text, z);
|
||||
}
|
||||
@@ -68,6 +67,7 @@ class MSStaff : public Module
|
||||
this->SetAuthor("Anope");
|
||||
this->SetVersion(VERSION_STRING);
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(MemoServ, new CommandMSStaff());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ class CommandNSSuspend : public Command
|
||||
Alog() << Config.s_NickServ << ": " << u->nick << " set SUSPEND for nick " << nick;
|
||||
notice_lang(Config.s_NickServ, u, NICK_SUSPEND_SUCCEEDED, nick);
|
||||
|
||||
FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na))
|
||||
FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user