summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp166
-rw-r--r--src/command_parse.cpp25
-rw-r--r--src/commands/cmd_away.cpp10
-rw-r--r--src/commands/cmd_invite.cpp8
-rw-r--r--src/commands/cmd_kill.cpp6
-rw-r--r--src/commands/cmd_nick.cpp17
-rw-r--r--src/commands/cmd_notice.cpp20
-rw-r--r--src/commands/cmd_privmsg.cpp22
-rw-r--r--src/commands/cmd_stats.cpp6
-rw-r--r--src/commands/cmd_user.cpp6
-rw-r--r--src/helperfuncs.cpp4
-rw-r--r--src/inspircd.cpp9
-rw-r--r--src/mode.cpp22
-rw-r--r--src/modes/cmode_b.cpp14
-rw-r--r--src/modes/cmode_h.cpp16
-rw-r--r--src/modes/cmode_o.cpp16
-rw-r--r--src/modes/cmode_v.cpp16
-rw-r--r--src/modules.cpp64
-rw-r--r--src/modules/extra/m_geoip.cpp4
-rw-r--r--src/modules/extra/m_ldapauth.cpp12
-rw-r--r--src/modules/extra/m_ldapoper.cpp6
-rw-r--r--src/modules/extra/m_sqlauth.cpp12
-rw-r--r--src/modules/extra/m_sqllog.cpp8
-rw-r--r--src/modules/extra/m_sqloper.cpp6
-rw-r--r--src/modules/extra/m_ziplink.cpp6
-rw-r--r--src/modules/m_abbreviation.cpp10
-rw-r--r--src/modules/m_alias.cpp12
-rw-r--r--src/modules/m_allowinvite.cpp13
-rw-r--r--src/modules/m_antibear.cpp12
-rw-r--r--src/modules/m_antibottler.cpp10
-rw-r--r--src/modules/m_auditorium.cpp6
-rw-r--r--src/modules/m_banexception.cpp24
-rw-r--r--src/modules/m_banredirect.cpp12
-rw-r--r--src/modules/m_blockamsg.cpp10
-rw-r--r--src/modules/m_blockcaps.cpp14
-rw-r--r--src/modules/m_blockcolor.cpp12
-rw-r--r--src/modules/m_callerid.cpp22
-rw-r--r--src/modules/m_cap.cpp6
-rw-r--r--src/modules/m_cban.cpp12
-rw-r--r--src/modules/m_censor.cpp14
-rw-r--r--src/modules/m_cgiirc.cpp6
-rw-r--r--src/modules/m_chanfilter.cpp14
-rw-r--r--src/modules/m_chanlog.cpp6
-rw-r--r--src/modules/m_channelban.cpp6
-rw-r--r--src/modules/m_chanprotect.cpp28
-rw-r--r--src/modules/m_cloaking.cpp6
-rw-r--r--src/modules/m_commonchans.cpp8
-rw-r--r--src/modules/m_conn_waitpong.cpp16
-rw-r--r--src/modules/m_connflood.cpp12
-rw-r--r--src/modules/m_customtitle.cpp4
-rw-r--r--src/modules/m_dccallow.cpp24
-rw-r--r--src/modules/m_deaf.cpp8
-rw-r--r--src/modules/m_delayjoin.cpp6
-rw-r--r--src/modules/m_delaymsg.cpp14
-rw-r--r--src/modules/m_denychans.cpp12
-rw-r--r--src/modules/m_dnsbl.cpp12
-rw-r--r--src/modules/m_filter.cpp46
-rw-r--r--src/modules/m_gecosban.cpp2
-rw-r--r--src/modules/m_hidechans.cpp14
-rw-r--r--src/modules/m_hideoper.cpp10
-rw-r--r--src/modules/m_ident.cpp16
-rw-r--r--src/modules/m_invisible.cpp18
-rw-r--r--src/modules/m_inviteexception.cpp6
-rw-r--r--src/modules/m_joinflood.cpp6
-rw-r--r--src/modules/m_jumpserver.cpp6
-rw-r--r--src/modules/m_kicknorejoin.cpp6
-rw-r--r--src/modules/m_lockserv.cpp10
-rw-r--r--src/modules/m_maphide.cpp6
-rw-r--r--src/modules/m_messageflood.cpp16
-rw-r--r--src/modules/m_muteban.cpp14
-rw-r--r--src/modules/m_namesx.cpp6
-rw-r--r--src/modules/m_nickflood.cpp10
-rw-r--r--src/modules/m_nicklock.cpp12
-rw-r--r--src/modules/m_noctcp.cpp12
-rw-r--r--src/modules/m_nokicks.cpp10
-rw-r--r--src/modules/m_nonicks.cpp17
-rw-r--r--src/modules/m_nonotice.cpp12
-rw-r--r--src/modules/m_nopartmsg.cpp2
-rw-r--r--src/modules/m_operchans.cpp10
-rw-r--r--src/modules/m_operinvex.cpp12
-rw-r--r--src/modules/m_operlevels.cpp6
-rw-r--r--src/modules/m_operlog.cpp6
-rw-r--r--src/modules/m_operprefix.cpp6
-rw-r--r--src/modules/m_override.cpp43
-rw-r--r--src/modules/m_password_hash.cpp9
-rw-r--r--src/modules/m_permchannels.cpp6
-rw-r--r--src/modules/m_redirect.cpp8
-rw-r--r--src/modules/m_regonlycreate.cpp10
-rw-r--r--src/modules/m_restrictchans.cpp8
-rw-r--r--src/modules/m_restrictmsg.cpp10
-rw-r--r--src/modules/m_rline.cpp6
-rw-r--r--src/modules/m_safelist.cpp16
-rw-r--r--src/modules/m_sasl.cpp4
-rw-r--r--src/modules/m_securelist.cpp10
-rw-r--r--src/modules/m_serverban.cpp2
-rw-r--r--src/modules/m_services_account.cpp32
-rw-r--r--src/modules/m_servprotect.cpp24
-rw-r--r--src/modules/m_shun.cpp18
-rw-r--r--src/modules/m_silence.cpp20
-rw-r--r--src/modules/m_spanningtree/main.cpp24
-rw-r--r--src/modules/m_spanningtree/main.h28
-rw-r--r--src/modules/m_spanningtree/override_admin.cpp8
-rw-r--r--src/modules/m_spanningtree/override_map.cpp6
-rw-r--r--src/modules/m_spanningtree/override_modules.cpp8
-rw-r--r--src/modules/m_spanningtree/override_motd.cpp8
-rw-r--r--src/modules/m_spanningtree/override_squit.cpp6
-rw-r--r--src/modules/m_spanningtree/override_stats.cpp14
-rw-r--r--src/modules/m_spanningtree/override_time.cpp6
-rw-r--r--src/modules/m_spanningtree/override_whois.cpp8
-rw-r--r--src/modules/m_spanningtree/precommand.cpp14
-rw-r--r--src/modules/m_spy.cpp6
-rw-r--r--src/modules/m_sslinfo.cpp8
-rw-r--r--src/modules/m_sslmodes.cpp8
-rw-r--r--src/modules/m_stripcolor.cpp12
-rw-r--r--src/modules/m_svshold.cpp12
-rw-r--r--src/modules/m_swhois.cpp4
-rw-r--r--src/modules/m_timedbans.cpp4
-rw-r--r--src/modules/m_uhnames.cpp6
-rw-r--r--src/modules/m_watch.cpp4
-rw-r--r--src/snomasks.cpp6
-rw-r--r--src/users.cpp42
121 files changed, 805 insertions, 832 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index eb4f802f0..15c2c56b1 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -72,14 +72,14 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
{
if(!forceset)
{
- int MOD_RESULT = 0;
+ ModResult res;
/* 0: check status, 1: don't, -1: disallow change silently */
- FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(u,this,ntopic));
+ FIRST_MOD_RESULT(ServerInstance, OnLocalTopicChange, res, (u,this,ntopic));
- if (MOD_RESULT == 1)
+ if (res == MOD_RES_DENY)
return CMD_FAILURE;
- else if (MOD_RESULT == 0)
+ if (res != MOD_RES_ALLOW)
{
if (!this->HasUser(u))
{
@@ -248,7 +248,6 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
return NULL;
char cname[MAXBUF];
- int MOD_RESULT = 0;
std::string privs;
Channel *Ptr;
@@ -304,9 +303,9 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
if (IS_LOCAL(user) && override == false)
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance,I_OnUserPreJoin, OnUserPreJoin(user, NULL, cname, privs, key ? key : ""));
- if (MOD_RESULT == 1)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(Instance, OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key ? key : ""));
+ if (MOD_RESULT == MOD_RES_DENY)
return NULL;
}
@@ -324,13 +323,13 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
*/
if (IS_LOCAL(user) && override == false)
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance,I_OnUserPreJoin, OnUserPreJoin(user, Ptr, cname, privs, key ? key : ""));
- if (MOD_RESULT == 1)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(Instance, OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key ? key : ""));
+ if (MOD_RESULT == MOD_RES_DENY)
{
return NULL;
}
- else if (MOD_RESULT == 0)
+ else if (MOD_RESULT == MOD_RES_PASSTHRU)
{
std::string ckey = Ptr->GetModeParameter('k');
bool invited = user->IsInvited(Ptr->name.c_str());
@@ -338,46 +337,33 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
if (!ckey.empty())
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance, I_OnCheckKey, OnCheckKey(user, Ptr, key ? key : ""));
- if (!MOD_RESULT)
+ FIRST_MOD_RESULT(Instance, OnCheckKey, MOD_RESULT, (user, Ptr, key ? key : ""));
+ if (!MOD_RESULT.check((key && ckey == key) || can_bypass))
{
// If no key provided, or key is not the right one, and can't bypass +k (not invited or option not enabled)
- if ((!key || ckey != key) && !can_bypass)
- {
- user->WriteNumeric(ERR_BADCHANNELKEY, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name.c_str());
- return NULL;
- }
+ user->WriteNumeric(ERR_BADCHANNELKEY, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name.c_str());
+ return NULL;
}
}
if (Ptr->IsModeSet('i'))
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance,I_OnCheckInvite,OnCheckInvite(user, Ptr));
- if (!MOD_RESULT)
+ FIRST_MOD_RESULT(Instance, OnCheckInvite, MOD_RESULT, (user, Ptr));
+ if (!MOD_RESULT.check(invited))
{
- if (!invited)
- {
- user->WriteNumeric(ERR_INVITEONLYCHAN, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name.c_str());
- return NULL;
- }
+ user->WriteNumeric(ERR_INVITEONLYCHAN, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name.c_str());
+ return NULL;
}
}
std::string limit = Ptr->GetModeParameter('l');
if (!limit.empty())
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance, I_OnCheckLimit, OnCheckLimit(user, Ptr));
- if (!MOD_RESULT)
+ FIRST_MOD_RESULT(Instance, OnCheckLimit, MOD_RESULT, (user, Ptr));
+ if (!MOD_RESULT.check((Ptr->GetUserCounter() < atol(limit.c_str()) || can_bypass)))
{
- long llimit = atol(limit.c_str());
- if (Ptr->GetUserCounter() >= llimit && !can_bypass)
- {
- user->WriteNumeric(ERR_CHANNELISFULL, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name.c_str());
- return NULL;
- }
+ user->WriteNumeric(ERR_CHANNELISFULL, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name.c_str());
+ return NULL;
}
}
@@ -474,15 +460,15 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const
bool Channel::IsBanned(User* user)
{
- int result = 0;
- DO_EACH_HOOK(ServerInstance, OnCheckBan, int modresult, (user, this))
+ ModResult result;
+ DO_EACH_HOOK(ServerInstance, OnCheckBan, ModResult modresult, (user, this))
{
- result = banmatch_reduce(result, modresult);
+ result = result + modresult;
}
WHILE_EACH_HOOK(ServerInstance, OnCheckBan);
- if (result)
- return (result < 0);
+ if (result != MOD_RES_PASSTHRU)
+ return (result == MOD_RES_DENY);
char mask[MAXBUF];
snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString());
@@ -498,16 +484,16 @@ bool Channel::IsBanned(User* user)
return false;
}
-int Channel::GetExtBanStatus(const std::string &str, char type)
+ModResult Channel::GetExtBanStatus(const std::string &str, char type)
{
- int result = 0;
- DO_EACH_HOOK(ServerInstance, OnCheckStringExtBan, int modresult, (str, this, type))
+ ModResult result;
+ DO_EACH_HOOK(ServerInstance, OnCheckStringExtBan, ModResult modresult, (str, this, type))
{
- result = banmatch_reduce(result, modresult);
+ result = result + modresult;
}
WHILE_EACH_HOOK(ServerInstance, OnCheckStringExtBan);
- if (result)
+ if (result != MOD_RES_PASSTHRU)
return result;
// nobody decided for us, check the ban list
@@ -520,32 +506,30 @@ int Channel::GetExtBanStatus(const std::string &str, char type)
ServerInstance->Logs->Log("EXTBANS", DEBUG, "Checking %s against %s, type is %c", str.c_str(), maskptr.c_str(), type);
if (InspIRCd::Match(str, maskptr, NULL))
- return -1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
-int Channel::GetExtBanStatus(User *user, char type)
+ModResult Channel::GetExtBanStatus(User *user, char type)
{
- int result = 0;
- DO_EACH_HOOK(ServerInstance, OnCheckExtBan, int modresult, (user, this, type))
+ ModResult rv;
+ DO_EACH_HOOK(ServerInstance, OnCheckExtBan, ModResult modresult, (user, this, type))
{
- result = banmatch_reduce(result, modresult);
+ rv = rv + modresult;
}
WHILE_EACH_HOOK(ServerInstance, OnCheckExtBan);
- if (result)
- return result;
+ if (rv != MOD_RES_PASSTHRU)
+ return rv;
char mask[MAXBUF];
- int rv = 0;
snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString());
- // XXX: we should probably hook cloaked hosts in here somehow too..
- rv = banmatch_reduce(rv, this->GetExtBanStatus(mask, type));
- rv = banmatch_reduce(rv, this->GetExtBanStatus(user->GetFullHost(), type));
- rv = banmatch_reduce(rv, this->GetExtBanStatus(user->GetFullRealHost(), type));
+ rv = rv + this->GetExtBanStatus(mask, type);
+ rv = rv + this->GetExtBanStatus(user->GetFullHost(), type);
+ rv = rv + this->GetExtBanStatus(user->GetFullRealHost(), type);
return rv;
}
@@ -578,9 +562,9 @@ long Channel::PartUser(User *user, std::string &reason)
/* kill the record */
if (iter != ServerInstance->chanlist->end())
{
- int MOD_RESULT = 0;
- FOREACH_RESULT_I(ServerInstance,I_OnChannelPreDelete, OnChannelPreDelete(this));
- if (MOD_RESULT == 1)
+ ModResult res;
+ FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, res, (this));
+ if (res == MOD_RES_DENY)
return 1; // delete halted by module
FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this));
ServerInstance->chanlist->erase(iter);
@@ -619,31 +603,26 @@ long Channel::KickUser(User *src, User *user, const char* reason)
src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick.c_str(), this->name.c_str());
return this->GetUserCounter();
}
- int MOD_RESULT = 0;
- if (!ServerInstance->ULine(src->server))
- {
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,this,reason));
- if (MOD_RESULT == 1)
- return this->GetUserCounter();
- }
- /* Set to -1 by OnUserPreKick if explicit allow was set */
- if (MOD_RESULT != -1)
- {
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,this,AC_KICK));
- if ((MOD_RESULT == ACR_DENY) && (!ServerInstance->ULine(src->server)))
- return this->GetUserCounter();
+ ModResult res;
+ if (ServerInstance->ULine(src->server))
+ res = MOD_RES_ALLOW;
+ if (res == MOD_RES_PASSTHRU)
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreKick, res, (src,user,this,reason));
+ if (res == MOD_RES_PASSTHRU)
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, res, (src,user,this,AC_KICK));
- if ((MOD_RESULT == ACR_DEFAULT) || (!ServerInstance->ULine(src->server)))
+ if (res == MOD_RES_DENY)
+ return this->GetUserCounter();
+
+ if (res == MOD_RES_PASSTHRU)
+ {
+ int them = this->GetStatus(src);
+ int us = this->GetStatus(user);
+ if ((them < STATUS_HOP) || (them < us))
{
- int them = this->GetStatus(src);
- int us = this->GetStatus(user);
- if ((them < STATUS_HOP) || (them < us))
- {
- src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them == STATUS_HOP ? "" : "half-");
- return this->GetUserCounter();
- }
+ src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them == STATUS_HOP ? "" : "half-");
+ return this->GetUserCounter();
}
}
}
@@ -669,9 +648,9 @@ long Channel::KickUser(User *src, User *user, const char* reason)
/* kill the record */
if (iter != ServerInstance->chanlist->end())
{
- int MOD_RESULT = 0;
- FOREACH_RESULT_I(ServerInstance,I_OnChannelPreDelete, OnChannelPreDelete(this));
- if (MOD_RESULT == 1)
+ ModResult res;
+ FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, res, (this));
+ if (res == MOD_RES_DENY)
return 1; // delete halted by module
FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this));
ServerInstance->chanlist->erase(iter);
@@ -892,17 +871,14 @@ void Channel::UserList(User *user, CUList *ulist)
{
char list[MAXBUF];
size_t dlen, curlen;
- int MOD_RESULT = 0;
- bool call_modules = true;
+ ModResult call_modules;
if (!IS_LOCAL(user))
return;
- FOREACH_RESULT(I_OnUserList,OnUserList(user, this, ulist));
- if (MOD_RESULT == 1)
- call_modules = false;
+ FIRST_MOD_RESULT(ServerInstance, OnUserList, call_modules, (user, this, ulist));
- if (MOD_RESULT != -1)
+ if (call_modules != MOD_RES_ALLOW)
{
if ((this->IsModeSet('s')) && (!this->HasUser(user)))
{
@@ -941,7 +917,7 @@ void Channel::UserList(User *user, CUList *ulist)
std::string prefixlist = this->GetPrefixChar(i->first);
std::string nick = i->first->nick;
- if (call_modules)
+ if (call_modules != MOD_RES_DENY)
{
FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->first, this, prefixlist, nick));
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index e7478478a..1ca4c988f 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -28,15 +28,15 @@
int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
- int MOD_RESULT = 0;
- FOREACH_RESULT_I(this,I_OnPassCompare,OnPassCompare(ex, data, input, hashtype))
+ ModResult res;
+ FIRST_MOD_RESULT(this, OnPassCompare, res, (ex, data, input, hashtype));
/* Module matched */
- if (MOD_RESULT == 1)
+ if (res == MOD_RES_ALLOW)
return 0;
/* Module explicitly didnt match */
- if (MOD_RESULT == -1)
+ if (res == MOD_RES_DENY)
return 1;
/* We dont handle any hash types except for plaintext - Thanks tra26 */
@@ -278,9 +278,9 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
if (cm == cmdlist.end())
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd));
- if (MOD_RESULT == 1)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
+ if (MOD_RESULT == MOD_RES_DENY)
return true;
/*
@@ -341,9 +341,9 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
* We call OnPreCommand here seperately if the command exists, so the magic above can
* truncate to max_params if necessary. -- w00t
*/
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, false, cmd));
- if (MOD_RESULT == 1)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
+ if (MOD_RESULT == MOD_RES_DENY)
return true;
/* activity resets the ping pending timer */
@@ -399,9 +399,8 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
cm->second->total_bytes += cmd.length();
/* module calls too */
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command, command_p, user, true, cmd));
- if (MOD_RESULT == 1)
+ FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, true, cmd));
+ if (MOD_RESULT == MOD_RES_DENY)
return do_more;
/*
diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp
index aba803134..261bdd38c 100644
--- a/src/commands/cmd_away.cpp
+++ b/src/commands/cmd_away.cpp
@@ -23,13 +23,13 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
*/
CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User *user)
{
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
if ((parameters.size()) && (!parameters[0].empty()))
{
- FOREACH_RESULT(I_OnSetAway, OnSetAway(user, parameters[0]));
+ FIRST_MOD_RESULT(ServerInstance, OnSetAway, MOD_RESULT, (user, parameters[0]));
- if (MOD_RESULT != 0 && IS_LOCAL(user))
+ if (MOD_RESULT == MOD_RES_DENY && IS_LOCAL(user))
return CMD_FAILURE;
user->awaytime = ServerInstance->Time();
@@ -39,9 +39,9 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User
}
else
{
- FOREACH_RESULT(I_OnSetAway, OnSetAway(user, ""));
+ FIRST_MOD_RESULT(ServerInstance, OnSetAway, MOD_RESULT, (user, ""));
- if (MOD_RESULT != 0 && IS_LOCAL(user))
+ if (MOD_RESULT == MOD_RES_DENY && IS_LOCAL(user))
return CMD_FAILURE;
user->awaymsg.clear();
diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp
index 1d875b74e..31c6f459c 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -23,7 +23,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
*/
CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, User *user)
{
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
if (parameters.size() == 2 || parameters.size() == 3)
{
@@ -56,13 +56,13 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
return CMD_FAILURE;
}
- FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c,timeout));
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreInvite, MOD_RESULT, (user,u,c,timeout));
- if (MOD_RESULT == 1)
+ if (MOD_RESULT == MOD_RES_DENY)
{
return CMD_FAILURE;
}
- else if (MOD_RESULT == 0)
+ else if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if (IS_LOCAL(user))
{
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp
index 842f1239e..2f1a4783e 100644
--- a/src/commands/cmd_kill.cpp
+++ b/src/commands/cmd_kill.cpp
@@ -29,7 +29,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
User *u = ServerInstance->FindNick(parameters[0]);
char killreason[MAXBUF];
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
if (u)
{
@@ -46,9 +46,9 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
* Moved this event inside the IS_LOCAL check also, we don't want half the network killing a user
* and the other half not. This would be a bad thing. ;p -- w00t
*/
- FOREACH_RESULT(I_OnKill, OnKill(user, u, parameters[1]));
+ FIRST_MOD_RESULT(ServerInstance, OnKill, MOD_RESULT, (user, u, parameters[1]));
- if (MOD_RESULT)
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
if (*ServerInstance->Config->HideKillsServer)
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index 44ccffbac..33e0e8081 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -70,9 +70,9 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
* the nick AAA is the same as the nick aaa.
*/
oldnick.assign(user->nick, 0, IS_LOCAL(user) ? ServerInstance->Config->Limits.NickMax : MAXBUF);
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (user,parameters[0]));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
if (user->registered == REG_ALL)
user->WriteCommon("NICK %s",parameters[0].c_str());
@@ -151,9 +151,9 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
}
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user, parameters[0]));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (user, parameters[0]));
+ if (MOD_RESULT == MOD_RES_DENY)
// if a module returns true, the nick change is silently forbidden.
return CMD_FAILURE;
@@ -187,9 +187,8 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
if (user->registered == REG_NICKUSER)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
- if (MOD_RESULT > 0)
+ FIRST_MOD_RESULT(ServerInstance, OnUserRegister, MOD_RESULT, (user));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
// return early to not penalize new users
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 13ffd6c75..e9049d7ab 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -35,10 +35,10 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
if (!user->HasPrivPermission("users/mass-message"))
return CMD_SUCCESS;
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list));
- if (MOD_RESULT)
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
const char* text = temp.c_str();
const char* servermask = (parameters[0].c_str()) + 1;
@@ -80,13 +80,13 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
return CMD_FAILURE;
}
}
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,chan,TYPE_CHANNEL,temp,status, exempt_list));
- if (MOD_RESULT) {
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status, exempt_list));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
- }
+
const char* text = temp.c_str();
if (temp.empty())
@@ -157,10 +157,10 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
return CMD_FAILURE;
}
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,dest,TYPE_USER,temp,0,exempt_list));
- if (MOD_RESULT) {
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNotice, MOD_RESULT, (user,dest,TYPE_USER,temp,0,exempt_list));
+ if (MOD_RESULT == MOD_RES_DENY) {
return CMD_FAILURE;
}
const char* text = temp.c_str();
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 5c6e462c8..c6e74db8b 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -35,10 +35,10 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
if (!user->HasPrivPermission("users/mass-message"))
return CMD_SUCCESS;
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
- if (MOD_RESULT)
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
const char* text = temp.c_str();
@@ -91,13 +91,13 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
}
}
}
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,chan,TYPE_CHANNEL,temp,status,except_list));
- if (MOD_RESULT) {
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status,except_list));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
- }
+
const char* text = temp.c_str();
/* Check again, a module may have zapped the input string */
@@ -175,13 +175,13 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
}
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, dest, TYPE_USER, temp, 0, except_list));
- if (MOD_RESULT) {
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
- }
+
const char* text = temp.c_str();
FOREACH_MOD(I_OnText,OnText(user, dest, TYPE_USER, text, 0, except_list));
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index eb0321c8a..ecd19a71e 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -67,9 +67,9 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
return;
}
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnStats,OnStats(statschar, user, results));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnStats, MOD_RESULT, (statschar, user, results));
+ if (MOD_RESULT == MOD_RES_DENY)
{
results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp
index 833a9b275..b9ef94c97 100644
--- a/src/commands/cmd_user.cpp
+++ b/src/commands/cmd_user.cpp
@@ -54,11 +54,11 @@ CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User
/* parameters 2 and 3 are local and remote hosts, and are ignored */
if (user->registered == REG_NICKUSER)
{
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
- if (MOD_RESULT > 0)
+ FIRST_MOD_RESULT(ServerInstance, OnUserRegister, MOD_RESULT, (user));
+ if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 1d5bf574f..0ec8db966 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -344,8 +344,8 @@ void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::str
{
std::string copy_text = text;
- int MOD_RESULT = 0;
- FOREACH_RESULT_I(this, I_OnWhoisLine, OnWhoisLine(user, dest, numeric, copy_text));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(this, OnWhoisLine, MOD_RESULT, (user, dest, numeric, copy_text));
if (!MOD_RESULT)
user->WriteServ("%d %s", numeric, copy_text.c_str());
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index cedb8a20e..cc69374ec 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -868,12 +868,9 @@ void InspIRCd::BufferedSocketCull()
*/
bool InspIRCd::AllModulesReportReady(User* user)
{
- for (EventHandlerIter i = Modules->EventHandlers[I_OnCheckReady].begin(); i != Modules->EventHandlers[I_OnCheckReady].end(); ++i)
- {
- if (!(*i)->OnCheckReady(user))
- return false;
- }
- return true;
+ ModResult res;
+ FIRST_MOD_RESULT(this, OnCheckReady, res, (user));
+ return (res == MOD_RES_PASSTHRU);
}
time_t InspIRCd::Time()
diff --git a/src/mode.cpp b/src/mode.cpp
index a89227982..38f7835fc 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -350,13 +350,13 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool
ModeHandler *mh = FindMode(modechar, type);
int pcnt = mh->GetNumParams(adding);
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnRawMode, OnRawMode(user, chan, modechar, parameter, adding, pcnt));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnRawMode, MOD_RESULT, (user, chan, modechar, parameter, adding, pcnt));
- if (IS_LOCAL(user) && (MOD_RESULT == ACR_DENY))
+ if (IS_LOCAL(user) && (MOD_RESULT == MOD_RES_DENY))
return MODEACTION_DENY;
- if (chan && !SkipACL && (MOD_RESULT != ACR_ALLOW))
+ if (chan && !SkipACL && (MOD_RESULT != MOD_RES_ALLOW))
{
char needed = mh->GetNeededPrefix();
ModeHandler* prefixmode = FindPrefix(needed);
@@ -489,12 +489,12 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
{
/* Overall access control hook for mode change */
LastParse = mode_sequence;
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user, NULL, targetchannel, AC_GENERAL_MODE));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user, NULL, targetchannel, AC_GENERAL_MODE));
LastParse.clear();
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return;
- SkipAccessChecks = (MOD_RESULT == ACR_ALLOW);
+ SkipAccessChecks = (MOD_RESULT == MOD_RES_ALLOW);
}
else
{
@@ -636,9 +636,9 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_s
if (!mh || !mh->IsListMode())
return;
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnRawMode, OnRawMode(user, chan, mletter, "", true, 0));
- if (MOD_RESULT == ACR_DENY)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnRawMode, MOD_RESULT, (user, chan, mletter, "", true, 0));
+ if (MOD_RESULT == MOD_RES_DENY)
continue;
bool display = true;
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 415d33c30..36078f4b2 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -115,9 +115,9 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan
return dest;
}
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAddBan,OnAddBan(user,chan,dest));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAddBan, MOD_RESULT, (user,chan,dest));
+ if (MOD_RESULT == MOD_RES_DENY)
{
dest = "";
return dest;
@@ -149,7 +149,7 @@ ModePair ModeChannelBan::ModeSet(User*, User*, Channel* channel, const std::stri
return std::make_pair(true, i->data);
}
}
- return std::make_pair(false, parameter);
+ return std::make_pair(false, parameter);
}
std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan, int)
@@ -168,9 +168,9 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan
{
if (!strcasecmp(i->data.c_str(), dest.c_str()))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnDelBan,OnDelBan(user, chan, dest));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnDelBan, MOD_RESULT, (user, chan, dest));
+ if (MOD_RESULT == MOD_RES_DENY)
{
dest = "";
return dest;
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index ce4a0ac56..54ab139ce 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -107,12 +107,12 @@ std::string ModeChannelHalfOp::AddHalfOp(User *user,const char* dest,Channel *ch
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_HALFOP));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_HALFOP));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)))
{
@@ -135,12 +135,12 @@ std::string ModeChannelHalfOp::DelHalfOp(User *user,const char *dest,Channel *ch
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEHALFOP));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_DEHALFOP));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((user != d) && ((status < STATUS_OP) && (!ServerInstance->ULine(user->server))))
{
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 9a271f9a6..908eb698c 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -105,12 +105,12 @@ std::string ModeChannelOp::AddOp(User *user,const char* dest,Channel *chan,int s
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_OP));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_OP));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)))
{
@@ -133,12 +133,12 @@ std::string ModeChannelOp::DelOp(User *user,const char *dest,Channel *chan,int s
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEOP));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_DEOP));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)) && (IS_LOCAL(user)))
{
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 22cfb19ef..03dbb5a33 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -105,12 +105,12 @@ std::string ModeChannelVoice::AddVoice(User *user,const char* dest,Channel *chan
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_VOICE));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_VOICE));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
{
@@ -133,12 +133,12 @@ std::string ModeChannelVoice::DelVoice(User *user,const char *dest,Channel *chan
{
if (IS_LOCAL(user))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEVOICE));
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_DEVOICE));
- if (MOD_RESULT == ACR_DENY)
+ if (MOD_RESULT == MOD_RES_DENY)
return "";
- if (MOD_RESULT == ACR_DEFAULT)
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
{
if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
{
diff --git a/src/modules.cpp b/src/modules.cpp
index 62a156ac6..c5c8aa2ca 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -107,7 +107,7 @@ std::string Event::GetEventID()
Module::Module(InspIRCd* Me) : ServerInstance(Me) { }
Module::~Module() { }
-int Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return 0; }
+ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; }
void Module::OnUserConnect(User*) { }
void Module::OnUserQuit(User*, const std::string&, const std::string&) { }
void Module::OnUserDisconnect(User*) { }
@@ -117,48 +117,48 @@ void Module::OnUserPart(User*, Channel*, std::string&, bool&) { }
void Module::OnPreRehash(User*, const std::string&) { }
void Module::OnModuleRehash(User*, const std::string&) { }
void Module::OnRehash(User*) { }
-int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return 0; }
+ModResult Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnMode(User*, void*, int, const std::vector<std::string>&, const std::vector<TranslateType>&) { }
Version Module::GetVersion() { return Version("Misconfigured", VF_VENDOR, -1); }
void Module::OnOper(User*, const std::string&) { }
void Module::OnPostOper(User*, const std::string&, const std::string &) { }
void Module::OnInfo(User*) { }
void Module::OnWhois(User*, User*) { }
-int Module::OnUserPreInvite(User*, User*, Channel*, time_t) { return 0; }
-int Module::OnUserPreMessage(User*, void*, int, std::string&, char, CUList&) { return 0; }
-int Module::OnUserPreNotice(User*, void*, int, std::string&, char, CUList&) { return 0; }
-int Module::OnUserPreNick(User*, const std::string&) { return 0; }
+ModResult Module::OnUserPreInvite(User*, User*, Channel*, time_t) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserPreMessage(User*, void*, int, std::string&, char, CUList&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserPreNotice(User*, void*, int, std::string&, char, CUList&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserPreNick(User*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnUserPostNick(User*, const std::string&) { }
-int Module::OnAccessCheck(User*, User*, Channel*, int) { return ACR_DEFAULT; }
+ModResult Module::OnAccessCheck(User*, User*, Channel*, int) { return MOD_RES_PASSTHRU; }
void Module::On005Numeric(std::string&) { }
-int Module::OnKill(User*, User*, const std::string&) { return 0; }
+ModResult Module::OnKill(User*, User*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnLoadModule(Module*, const std::string&) { }
void Module::OnUnloadModule(Module*, const std::string&) { }
void Module::OnBackgroundTimer(time_t) { }
-int Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return 0; }
+ModResult Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnPostCommand(const std::string&, const std::vector<std::string>&, User *, CmdResult, const std::string&) { }
-bool Module::OnCheckReady(User*) { return true; }
-int Module::OnUserRegister(User*) { return 0; }
-int Module::OnUserPreKick(User*, User*, Channel*, const std::string&) { return 0; }
+ModResult Module::OnCheckReady(User*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserRegister(User*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserPreKick(User*, User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnUserKick(User*, User*, Channel*, const std::string&, bool&) { }
-int Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return 0; }
-int Module::OnCheckInvite(User*, Channel*) { return 0; }
-int Module::OnCheckKey(User*, Channel*, const std::string&) { return 0; }
-int Module::OnCheckLimit(User*, Channel*) { return 0; }
-int Module::OnCheckBan(User*, Channel*) { return 0; }
-int Module::OnCheckExtBan(User *, Channel *, char) { return 0; }
-int Module::OnCheckStringExtBan(const std::string &s, Channel *c, char type) { return 0; }
-int Module::OnStats(char, User*, string_list&) { return 0; }
-int Module::OnChangeLocalUserHost(User*, const std::string&) { return 0; }
-int Module::OnChangeLocalUserGECOS(User*, const std::string&) { return 0; }
-int Module::OnLocalTopicChange(User*, Channel*, const std::string&) { return 0; }
+ModResult Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckInvite(User*, Channel*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckKey(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckLimit(User*, Channel*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckBan(User*, Channel*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckExtBan(User *, Channel *, char) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckStringExtBan(const std::string &s, Channel *c, char type) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnStats(char, User*, string_list&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnChangeLocalUserHost(User*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnChangeLocalUserGECOS(User*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnLocalTopicChange(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnEvent(Event*) { return; }
const char* Module::OnRequest(Request*) { return NULL; }
-int Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { return 0; }
+ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { return MOD_RES_PASSTHRU; }
void Module::OnGlobalOper(User*) { }
void Module::OnPostConnect(User*) { }
-int Module::OnAddBan(User*, Channel*, const std::string &) { return 0; }
-int Module::OnDelBan(User*, Channel*, const std::string &) { return 0; }
+ModResult Module::OnAddBan(User*, Channel*, const std::string &) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnDelBan(User*, Channel*, const std::string &) { return MOD_RES_PASSTHRU; }
void Module::OnRawSocketAccept(int, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { }
int Module::OnRawSocketWrite(int, const char*, int) { return 0; }
void Module::OnRawSocketClose(int) { }
@@ -184,20 +184,20 @@ void Module::OnAddLine(User*, XLine*) { }
void Module::OnDelLine(User*, XLine*) { }
void Module::OnExpireLine(XLine*) { }
void Module::OnCleanup(int, void*) { }
-int Module::OnChannelPreDelete(Channel*) { return 0; }
+ModResult Module::OnChannelPreDelete(Channel*) { return MOD_RES_PASSTHRU; }
void Module::OnChannelDelete(Channel*) { }
-int Module::OnSetAway(User*, const std::string &) { return 0; }
-int Module::OnUserList(User*, Channel*, CUList*&) { return 0; }
-int Module::OnWhoisLine(User*, User*, int&, std::string&) { return 0; }
+ModResult Module::OnSetAway(User*, const std::string &) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserList(User*, Channel*, CUList*&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnWhoisLine(User*, User*, int&, std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnBuildExemptList(MessageType, Channel*, User*, char, CUList&, const std::string&) { }
void Module::OnGarbageCollect() { }
void Module::OnBufferFlushed(User*) { }
void Module::OnText(User*, void*, int, const std::string&, char, CUList&) { }
void Module::OnRunTestSuite() { }
void Module::OnNamesListItem(User*, User*, Channel*, std::string&, std::string&) { }
-int Module::OnNumeric(User*, unsigned int, const std::string&) { return 0; }
+ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnHookIO(EventHandler*, ListenSocketBase*) { }
-bool Module::OnHostCycle(User* user) { return false; }
+ModResult Module::OnHostCycle(User*) { return MOD_RES_PASSTHRU; }
ModuleManager::ModuleManager(InspIRCd* Ins) : ModCount(0), Instance(Ins)
{
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp
index 21a57a283..e04d5b963 100644
--- a/src/modules/extra/m_geoip.cpp
+++ b/src/modules/extra/m_geoip.cpp
@@ -63,7 +63,7 @@ class ModuleGeoIP : public Module
}
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
/* only do lookups on local users */
if (IS_LOCAL(user))
@@ -81,7 +81,7 @@ class ModuleGeoIP : public Module
ServerInstance->Users->QuitUser(user, "Could not identify your country of origin. Access denied.");
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index 94c0df469..8ffccd863 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -111,20 +111,20 @@ public:
return true;
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
{
user->Extend("ldapauthed");
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (!CheckCredentials(user))
{
ServerInstance->Users->QuitUser(user, killreason);
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
bool CheckCredentials(User* user)
@@ -217,9 +217,9 @@ public:
user->Shrink("ldapauth_failed");
}
- virtual bool OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(User* user)
{
- return user->GetExt("ldapauthed");
+ return user->GetExt("ldapauthed") ? MOD_RES_PASSTHRU : MOD_RES_DENY;
}
virtual Version GetVersion()
diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp
index f99b80db3..46b6cbcb2 100644
--- a/src/modules/extra/m_ldapoper.cpp
+++ b/src/modules/extra/m_ldapoper.cpp
@@ -97,7 +97,7 @@ public:
return true;
}
- virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
+ virtual ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
User* user = dynamic_cast<User*>(ex);
if (hashtype == "ldap")
@@ -105,11 +105,11 @@ public:
if (LookupOper(user, data, input))
{
/* This is an ldap oper and has been found, claim the OPER command */
- return 1;
+ return MOD_RES_DENY;
}
}
/* We don't know this oper! */
- return 0;
+ return MOD_RES_PASSTHRU;
}
bool LookupOper(User* user, const std::string &what, const std::string &opassword)
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 6dc01a5f8..e20f4e33e 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -69,20 +69,20 @@ public:
verbose = Conf.ReadFlag("sqlauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
{
user->Extend("sqlauthed");
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (!CheckCredentials(user))
{
ServerInstance->Users->QuitUser(user, killreason);
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
bool CheckCredentials(User* user)
@@ -196,9 +196,9 @@ public:
user->Shrink("sqlauth_failed");
}
- virtual bool OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(User* user)
{
- return user->GetExt("sqlauthed");
+ return user->GetExt("sqlauthed") ? MOD_RES_PASSTHRU : MOD_RES_DENY;
}
virtual Version GetVersion()
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp
index c952d495e..7313556d7 100644
--- a/src/modules/extra/m_sqllog.cpp
+++ b/src/modules/extra/m_sqllog.cpp
@@ -269,19 +269,19 @@ class ModuleSQLLog : public Module
AddLogEntry(LT_OPER,user->nick,user->host,user->server);
}
- virtual int OnKill(User* source, User* dest, const std::string &reason)
+ virtual ModResult OnKill(User* source, User* dest, const std::string &reason)
{
AddLogEntry(LT_KILL,dest->nick,dest->host,source->nick);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
if ((command == "GLINE" || command == "KLINE" || command == "ELINE" || command == "ZLINE") && validated)
{
AddLogEntry(LT_XLINE,user->nick,command[0]+std::string(":")+parameters[0],user->server);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserConnect(User* user)
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 52a73eba9..8e96a781d 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -120,7 +120,7 @@ public:
hashtype = assign(Conf.ReadValue("sqloper", "hash", 0));
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
if ((validated) && (command == "OPER"))
{
@@ -131,10 +131,10 @@ public:
* If the oper lookup fails later, we pass the command to the original handler
* for /oper by calling its Handle method directly.
*/
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
bool LookupOper(User* user, const std::string &username, const std::string &password)
diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp
index efff13644..c220460bd 100644
--- a/src/modules/extra/m_ziplink.cpp
+++ b/src/modules/extra/m_ziplink.cpp
@@ -134,7 +134,7 @@ class ModuleZLib : public Module
}
/* Handle stats z (misc stats) */
- virtual int OnStats(char symbol, User* user, string_list &results)
+ virtual ModResult OnStats(char symbol, User* user, string_list &results)
{
if (symbol == 'z')
{
@@ -168,10 +168,10 @@ class ModuleZLib : public Module
results.push_back(sn+" 304 "+user->nick+" :ZIPSTATS percentage_of_original_outbound_traffic = "+outbound_ratio);
results.push_back(sn+" 304 "+user->nick+" :ZIPSTATS percentage_of_orignal_inbound_traffic = "+inbound_ratio);
results.push_back(sn+" 304 "+user->nick+" :ZIPSTATS total_size_of_original_traffic = "+combined_ratio);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnRawSocketConnect(int fd)
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp
index 852764db1..9a9fabb84 100644
--- a/src/modules/m_abbreviation.cpp
+++ b/src/modules/m_abbreviation.cpp
@@ -33,11 +33,11 @@ class ModuleAbbreviation : public Module
return Version("$Id$",VF_VENDOR,API_VERSION);
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
/* Command is already validated, has a length of 0, or last character is not a . */
if (validated || command.empty() || *command.rbegin() != '.')
- return 0;
+ return MOD_RES_PASSTHRU;
/* Whack the . off the end */
command.erase(command.end() - 1);
@@ -56,7 +56,7 @@ class ModuleAbbreviation : public Module
if (matchlist.length() > 450)
{
user->WriteNumeric(420, "%s :Ambiguous abbreviation and too many possible matches.", user->nick.c_str());
- return true;
+ return MOD_RES_DENY;
}
if (!foundmatch)
@@ -74,7 +74,7 @@ class ModuleAbbreviation : public Module
if (!matchlist.empty())
{
user->WriteNumeric(420, "%s :Ambiguous abbreviation, posssible matches: %s%s", user->nick.c_str(), foundcommand.c_str(), matchlist.c_str());
- return true;
+ return MOD_RES_DENY;
}
if (foundcommand.empty())
@@ -87,7 +87,7 @@ class ModuleAbbreviation : public Module
command = foundcommand;
}
- return false;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 1741bb10d..5140faeaf 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -137,7 +137,7 @@ class ModuleAlias : public Module
return word;
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
std::multimap<std::string, Alias>::iterator i, upperbound;
@@ -145,12 +145,12 @@ class ModuleAlias : public Module
* to know.
*/
if (user->registered != REG_ALL)
- return 0;
+ return MOD_RES_PASSTHRU;
/* We dont have any commands looking like this? Stop processing. */
i = Aliases.find(command);
if (i == Aliases.end())
- return 0;
+ return MOD_RES_PASSTHRU;
/* Avoid iterating on to different aliases if no patterns match. */
upperbound = Aliases.upper_bound(command);
@@ -166,7 +166,7 @@ class ModuleAlias : public Module
{
if (DoAlias(user, NULL, &(i->second), compare, original_line))
{
- return 1;
+ return MOD_RES_DENY;
}
}
@@ -174,7 +174,7 @@ class ModuleAlias : public Module
}
// If we made it here, no aliases actually matched.
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserMessage(User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
@@ -243,8 +243,6 @@ class ModuleAlias : public Module
i++;
}
-
- return;
}
diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp
index ce4d73098..f38da5495 100644
--- a/src/modules/m_allowinvite.cpp
+++ b/src/modules/m_allowinvite.cpp
@@ -39,24 +39,25 @@ class ModuleAllowInvite : public Module
ServerInstance->AddExtBanChar('A');
}
- virtual int OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
+ virtual ModResult OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
{
if (IS_LOCAL(user))
{
- if (channel->GetExtBanStatus(user, 'A') == -1)
+ ModResult res = channel->GetExtBanStatus(user, 'A');
+ if (res == MOD_RES_DENY)
{
// Matching extban, explicitly deny /invite
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You are banned from using INVITE", user->nick.c_str(), channel->name.c_str());
- return 1;
+ return res;
}
- if (channel->IsModeSet('A') || channel->GetExtBanStatus(user, 'A') == 1)
+ if (channel->IsModeSet('A') || res == MOD_RES_ALLOW)
{
// Explicitly allow /invite
- return -1;
+ return MOD_RES_ALLOW;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleAllowInvite()
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index c00b92f2b..70a4a96fb 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -37,7 +37,7 @@ class ModuleAntiBear : public Module
return Version("$Id$",VF_VENDOR,API_VERSION);
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
if (command == "NOTICE" && !validated && parameters.size() > 1 && user->GetExt("antibear_timewait"))
{
@@ -52,24 +52,24 @@ class ModuleAntiBear : public Module
else
delete zl;
- return 1;
+ return MOD_RES_DENY;
}
user->Shrink("antibear_timewait");
// Block the command, so the user doesn't receive a no such nick notice
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick.c_str());
user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick.c_str());
user->WriteServ("PRIVMSG %s :\1TIME\1", user->nick.c_str());
user->Extend("antibear_timewait");
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index 15a5e096a..cae67f410 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -37,7 +37,7 @@ class ModuleAntiBottler : public Module
return Version("$Id$",VF_VENDOR,API_VERSION);
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
char data[MAXBUF];
strlcpy(data,original_line.c_str(),MAXBUF);
@@ -56,7 +56,7 @@ class ModuleAntiBottler : public Module
}
// Bug Fix (#14) -- FCS
if (!*data)
- return 0;
+ return MOD_RES_PASSTHRU;
strtok(data," ");
char *ident = strtok(NULL," ");
@@ -65,7 +65,7 @@ class ModuleAntiBottler : public Module
char *gecos = strtok(NULL,"\r\n");
if (!ident || !local || !remote || !gecos)
- return 0;
+ return MOD_RES_PASSTHRU;
for (char* j = remote; *j; j++)
{
@@ -84,10 +84,10 @@ class ModuleAntiBottler : public Module
modified.push_back(remote);
modified.push_back(strgecos);
ServerInstance->Parser->CallHandler("USER", modified, user);
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 594dccf90..b7b60497b 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -159,13 +159,13 @@ class ModuleAuditorium : public Module
}
}
- bool OnHostCycle(User* user)
+ ModResult OnHostCycle(User* user)
{
for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
if (f->first->IsModeSet('u'))
- return true;
+ return MOD_RES_DENY;
- return false;
+ return MOD_RES_PASSTHRU;
}
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index 55a5da83f..dafa47d2c 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -57,7 +57,7 @@ public:
output.append(" EXCEPTS=e");
}
- virtual int OnCheckExtBan(User *user, Channel *chan, char type)
+ virtual ModResult OnCheckExtBan(User *user, Channel *chan, char type)
{
if (chan != NULL)
{
@@ -65,7 +65,7 @@ public:
chan->GetExt(be.GetInfoKey(), list);
if (!list)
- return 0;
+ return MOD_RES_PASSTHRU;
std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
for (modelist::iterator it = list->begin(); it != list->end(); it++)
@@ -78,15 +78,15 @@ public:
if (InspIRCd::Match(user->GetFullRealHost(), maskptr) || InspIRCd::Match(user->GetFullHost(), maskptr) || (InspIRCd::MatchCIDR(mask, maskptr)))
{
// They match an entry on the list, so let them pass this.
- return 1;
+ return MOD_RES_ALLOW;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnCheckStringExtBan(const std::string &str, Channel *chan, char type)
+ virtual ModResult OnCheckStringExtBan(const std::string &str, Channel *chan, char type)
{
if (chan != NULL)
{
@@ -94,7 +94,7 @@ public:
chan->GetExt(be.GetInfoKey(), list);
if (!list)
- return 0;
+ return MOD_RES_PASSTHRU;
for (modelist::iterator it = list->begin(); it != list->end(); it++)
{
if (it->mask[0] != type || it->mask[1] != ':')
@@ -103,14 +103,14 @@ public:
std::string maskptr = it->mask.substr(2);
if (InspIRCd::Match(str, maskptr))
// They match an entry on the list, so let them in.
- return 1;
+ return MOD_RES_ALLOW;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnCheckBan(User* user, Channel* chan)
+ virtual ModResult OnCheckBan(User* user, Channel* chan)
{
if (chan != NULL)
{
@@ -120,7 +120,7 @@ public:
if (!list)
{
// No list, proceed normally
- return 0;
+ return MOD_RES_PASSTHRU;
}
std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
@@ -129,11 +129,11 @@ public:
if (InspIRCd::Match(user->GetFullRealHost(), it->mask) || InspIRCd::Match(user->GetFullHost(), it->mask) || (InspIRCd::MatchCIDR(mask, it->mask)))
{
// They match an entry on the list, so let them in.
- return 1;
+ return MOD_RES_ALLOW;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnCleanup(int target_type, void* item)
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 316225893..1a486325a 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -262,13 +262,13 @@ class ModuleBanRedirect : public Module
ExceptionModule = ServerInstance->Modules->Find("m_banexception.so");
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
/* This prevents recursion when a user sets multiple ban redirects in a chain
* (thanks Potter)
*/
if (nofollow)
- return 0;
+ return MOD_RES_PASSTHRU;
/* Return 1 to prevent the join, 0 to allow it */
if (chan)
@@ -288,7 +288,7 @@ class ModuleBanRedirect : public Module
ListModeRequest n(this, ExceptionModule, user, chan);
/* Users with ban exceptions are allowed to join without being redirected */
if (n.Send())
- return 0;
+ return MOD_RES_PASSTHRU;
}
std::string ipmask(user->nick);
@@ -308,7 +308,7 @@ class ModuleBanRedirect : public Module
if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str())))
{
user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
- return 1;
+ return MOD_RES_ALLOW;
}
else
{
@@ -317,13 +317,13 @@ class ModuleBanRedirect : public Module
nofollow = true;
Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time());
nofollow = false;
- return 1;
+ return MOD_RES_ALLOW;
}
}
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleBanRedirect()
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 89728bdb9..104086bfe 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -84,11 +84,11 @@ class ModuleBlockAmsg : public Module
action = IBLOCK_KILLOPERS;
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
// Don't do anything with unregistered users, or remote ones.
if(!user || (user->registered != REG_ALL) || !IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
// We want case insensitive command comparison.
// Add std::string contructor for irc::string :x
@@ -119,7 +119,7 @@ class ModuleBlockAmsg : public Module
*/
if(targets == 0)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
userchans = user->chans.size();
@@ -144,7 +144,7 @@ class ModuleBlockAmsg : public Module
else if(action == IBLOCK_NOTICE || action == IBLOCK_NOTICEOPERS)
user->WriteServ( "NOTICE %s :Global message (/amsg or /ame) detected", user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
if(m)
@@ -160,7 +160,7 @@ class ModuleBlockAmsg : public Module
user->Extend("amsgblock", (char*)m);
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
void OnCleanup(int target_type, void* item)
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 6ce1cecc5..ca1bc5a2b 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -51,21 +51,21 @@ public:
ReadConf();
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
if ((!IS_LOCAL(user)) || (text.length() < minlen))
- return 0;
+ return MOD_RES_PASSTHRU;
Channel* c = (Channel*)dest;
if (CHANOPS_EXEMPT(ServerInstance, 'B') && c->GetStatus(user) == STATUS_OP)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
- if (c->IsModeSet('B') || c->GetExtBanStatus(user, 'B') < 0)
+ if (!c->GetExtBanStatus(user, 'B').check(!c->IsModeSet('B')))
{
int caps = 0;
const char* actstr = "\1ACTION ";
@@ -87,14 +87,14 @@ public:
if ( ((caps*100)/(int)text.length()) >= percent )
{
user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Your message cannot contain more than %d%% capital letters if it's longer than %d characters", user->nick.c_str(), c->name.c_str(), percent, minlen);
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 982d225c3..5bd86bccf 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -42,7 +42,7 @@ class ModuleBlockColour : public Module
ServerInstance->AddExtBanChar('c');
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
{
@@ -50,10 +50,10 @@ class ModuleBlockColour : public Module
if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) == STATUS_OP)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
- if(c->IsModeSet('c') || c->GetExtBanStatus(user, 'c') < 0)
+ if (!c->GetExtBanStatus(user, 'c').check(!c->IsModeSet('c')))
{
for (std::string::iterator i = text.begin(); i != text.end(); i++)
{
@@ -66,16 +66,16 @@ class ModuleBlockColour : public Module
case 22:
case 31:
user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name.c_str());
- return 1;
+ return MOD_RES_DENY;
break;
}
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index f275c0a88..4c490a334 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -367,13 +367,13 @@ public:
output += " CALLERID=g";
}
- int PreText(User* user, User* dest, std::string& text, bool notice)
+ ModResult PreText(User* user, User* dest, std::string& text, bool notice)
{
if (!dest->IsModeSet('g'))
- return 0;
+ return MOD_RES_PASSTHRU;
if (operoverride && IS_OPER(user))
- return 0;
+ return MOD_RES_PASSTHRU;
callerid_data* dat = GetData(dest, true);
std::set<User*>::iterator i = dat->accepting.find(user);
@@ -396,25 +396,25 @@ public:
}
dat->lastnotify = now;
}
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList &exempt_list)
{
if (IS_LOCAL(user) && target_type == TYPE_USER)
return PreText(user, (User*)dest, text, true);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user, void* dest, int target_type, std::string& text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user, void* dest, int target_type, std::string& text, char status, CUList &exempt_list)
{
if (IS_LOCAL(user) && target_type == TYPE_USER)
return PreText(user, (User*)dest, text, true);
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnCleanup(int type, void* item)
@@ -447,11 +447,11 @@ public:
}
}
- virtual int OnUserPreNick(User* user, const std::string& newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string& newnick)
{
if (!tracknick)
RemoveFromAllAccepts(user);
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserQuit(User* user, const std::string& message, const std::string& oper_message)
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index 2b700a5ae..626b4c23c 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -141,13 +141,13 @@ class ModuleCAP : public Module
ServerInstance->Modules->Attach(eventlist, this, 1);
}
- virtual bool OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(User* user)
{
/* Users in CAP state get held until CAP END */
if (user->GetExt("CAP_REGHOLD"))
- return false;
+ return MOD_RES_DENY;
- return true;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleCAP()
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index bf4fa4e6d..a38c9cc40 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -176,16 +176,16 @@ class ModuleCBan : public Module
ServerInstance->XLines->UnregisterFactory(&f);
}
- virtual int OnStats(char symbol, User* user, string_list &out)
+ virtual ModResult OnStats(char symbol, User* user, string_list &out)
{
if (symbol != 'C')
- return 0;
+ return MOD_RES_PASSTHRU;
ServerInstance->XLines->InvokeStats("CBAN", 210, user, out);
- return 1;
+ return MOD_RES_DENY;
}
- virtual int OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
{
XLine *rl = ServerInstance->XLines->MatchesLine("CBAN", cname);
@@ -196,10 +196,10 @@ class ModuleCBan : public Module
ServerInstance->SNO->WriteToSnoMask('a', "%s tried to join %s which is CBANed (%s)",
user->nick.c_str(), cname, rl->reason.c_str());
ServerInstance->PI->SendSNONotice("A", user->nick + " tried to join " + std::string(cname) + " which is CBANed (" + rl->reason + ")");
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 13527f64a..6050d49ab 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -64,10 +64,10 @@ class ModuleCensor : public Module
}
// format of a config entry is <badword text="shit" replace="poo">
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
bool active = false;
@@ -79,12 +79,12 @@ class ModuleCensor : public Module
Channel* c = (Channel*)dest;
if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetStatus(user) == STATUS_OP)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
}
if (!active)
- return 0;
+ return MOD_RES_PASSTHRU;
irc::string text2 = text.c_str();
for (censor_t::iterator index = censors.begin(); index != censors.end(); index++)
@@ -94,17 +94,17 @@ class ModuleCensor : public Module
if (index->second.empty())
{
user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str());
- return 1;
+ return MOD_RES_DENY;
}
SearchAndReplace(text2, index->first, index->second);
}
}
text = text2.c_str();
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index a406ad658..4c1c35257 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -249,7 +249,7 @@ public:
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
for(CGIHostlist::iterator iter = cmd.Hosts.begin(); iter != cmd.Hosts.end(); iter++)
{
@@ -282,10 +282,10 @@ public:
{
// We don't need to do anything here
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserConnect(User* user)
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 977bab4cb..4f6ebf22a 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -88,10 +88,10 @@ class ModuleChanFilter : public Module
cf.DoRehash();
}
- virtual int ProcessMessages(User* user,Channel* chan,std::string &text)
+ virtual ModResult ProcessMessages(User* user,Channel* chan,std::string &text)
{
if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'g') && chan->GetStatus(user) == STATUS_OP))
- return 0;
+ return MOD_RES_PASSTHRU;
modelist* list;
chan->GetExt(cf.GetInfoKey(), list);
@@ -106,21 +106,21 @@ class ModuleChanFilter : public Module
user->WriteNumeric(404, "%s %s :Cannot send to channel (your message contained a censored word)",user->nick.c_str(), chan->name.c_str());
else
user->WriteNumeric(404, "%s %s %s :Cannot send to channel (your message contained a censored word)",user->nick.c_str(), chan->name.c_str(), i->mask.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
return ProcessMessages(user,(Channel*)dest,text);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnCleanup(int target_type, void* item)
@@ -133,7 +133,7 @@ class ModuleChanFilter : public Module
return cf.DoOnRequest(request);
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp
index 259474d74..8149bad1b 100644
--- a/src/modules/m_chanlog.cpp
+++ b/src/modules/m_chanlog.cpp
@@ -64,13 +64,13 @@ class ModuleChanLog : public Module
}
- virtual int OnSendSnotice(char &sno, std::string &desc, const std::string &msg)
+ virtual ModResult OnSendSnotice(char &sno, std::string &desc, const std::string &msg)
{
std::multimap<char, std::string>::const_iterator it = logstreams.find(sno);
char buf[MAXBUF];
if (it == logstreams.end())
- return 0;
+ return MOD_RES_PASSTHRU;
snprintf(buf, MAXBUF, "\2%s\2: %s", desc.c_str(), msg.c_str());
@@ -92,7 +92,7 @@ class ModuleChanLog : public Module
it++;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp
index eeb5c751d..8167b8aae 100644
--- a/src/modules/m_channelban.cpp
+++ b/src/modules/m_channelban.cpp
@@ -34,12 +34,12 @@ class ModuleBadChannelExtban : public Module
return Version("$Id$", VF_COMMON|VF_VENDOR,API_VERSION);
}
- virtual int OnCheckBan(User *user, Channel *c)
+ virtual ModResult OnCheckBan(User *user, Channel *c)
{
- int rv = 0;
+ ModResult rv;
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
- rv = banmatch_reduce(rv, c->GetExtBanStatus(i->first->name, 'j'));
+ rv = rv + c->GetExtBanStatus(i->first->name, 'j');
}
return rv;
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index e436e9225..e2c71673d 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -381,7 +381,7 @@ class ModuleChanProtect : public Module
DeprivOthers = Conf.ReadFlag("chanprotect","deprotectothers", "yes", 0);
}
- virtual int OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
{
// if the user is the first user into the channel, mark them as the founder, but only if
// the config option for it is set
@@ -389,10 +389,10 @@ class ModuleChanProtect : public Module
if (FirstInGetsFounder && !chan)
privs = std::string(1, QPrefix) + "@";
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
+ virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
{
// here we perform access checks, this is the important bit that actually stops kicking/deopping
// etc of protected users. There are many types of access check, we're going to handle
@@ -406,14 +406,14 @@ class ModuleChanProtect : public Module
// firstly, if a ulined nick, or a server, is setting the mode, then allow them to set the mode
// without any access checks, we're not worthy :p
if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
- return ACR_ALLOW;
+ return MOD_RES_ALLOW;
std::string founder("cm_founder_"+channel->name);
std::string protect("cm_protect_"+channel->name);
// Can do anything to yourself if deprotectself is enabled.
if (DeprivSelf && source == dest)
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
bool candepriv_founder = (DeprivOthers && source->GetExt(founder));
bool candepriv_protected = (source->GetExt(founder) || (DeprivOthers && source->GetExt(protect))); // Can the source remove +a?
@@ -425,12 +425,12 @@ class ModuleChanProtect : public Module
if (dest->GetExt(founder) && !candepriv_founder)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't deop "+dest->nick+" as they're a channel founder");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
if ((dest->GetExt(protect)) && !candepriv_protected)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't deop "+dest->nick+" as they're protected (+a)");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
break;
@@ -439,12 +439,12 @@ class ModuleChanProtect : public Module
if (dest->GetExt(founder) && !candepriv_founder)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't kick "+dest->nick+" as they're a channel founder");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
if ((dest->GetExt(protect)) && !candepriv_protected)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't kick "+dest->nick+" as they're protected (+a)");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
break;
@@ -453,12 +453,12 @@ class ModuleChanProtect : public Module
if (dest->GetExt(founder) && !candepriv_founder)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't de-halfop "+dest->nick+" as they're a channel founder");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
if ((dest->GetExt(protect)) && !candepriv_protected)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't de-halfop "+dest->nick+" as they're protected (+a)");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
break;
@@ -467,18 +467,18 @@ class ModuleChanProtect : public Module
if (dest->GetExt(founder) && !candepriv_founder)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't devoice "+dest->nick+" as they're a channel founder");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
if ((dest->GetExt(protect)) && !candepriv_protected)
{
source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't devoice "+dest->nick+" as they're protected (+a)");
- return ACR_DENY;
+ return MOD_RES_DENY;
}
break;
}
// we dont know what this access check is, or dont care. just carry on, nothing to see here.
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleChanProtect()
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 43f73bfe0..2fa3b9e63 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -307,7 +307,7 @@ class ModuleCloaking : public Module
}
}
- virtual int OnCheckBan(User* user, Channel* chan)
+ virtual ModResult OnCheckBan(User* user, Channel* chan)
{
char mask[MAXBUF];
std::string* tofree;
@@ -318,10 +318,10 @@ class ModuleCloaking : public Module
for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++)
{
if (InspIRCd::Match(mask,i->data))
- return -1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
void Prioritize()
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index 71639c51e..d9e253758 100644
--- a/src/modules/m_commonchans.cpp
+++ b/src/modules/m_commonchans.cpp
@@ -68,7 +68,7 @@ class ModulePrivacyMode : public Module
return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION);
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_USER)
{
@@ -76,13 +76,13 @@ class ModulePrivacyMode : public Module
if (!IS_OPER(user) && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t))
{
user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick.c_str(), t->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
}
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index 9a0adc3d6..4da240138 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -56,7 +56,7 @@ class ModuleWaitPong : public Module
return (char*)out;
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
char* pingrpl = RandString(10);
@@ -66,10 +66,10 @@ class ModuleWaitPong : public Module
user->WriteServ("NOTICE %s :*** If you are having problems connecting due to ping timeouts, please type /quote PONG %s or /raw PONG %s now.", user->nick.c_str(), pingrpl, pingrpl);
user->Extend(extenstr, pingrpl);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User* user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User* user, bool validated, const std::string &original_line)
{
if (command == "PONG")
{
@@ -82,23 +82,23 @@ class ModuleWaitPong : public Module
{
delete[] pingrpl;
user->Shrink(extenstr);
- return 1;
+ return MOD_RES_DENY;
}
else
{
if(killonbadreply)
ServerInstance->Users->QuitUser(user, "Incorrect ping reply for registration");
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual bool OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(User* user)
{
char* pingrpl;
- return (!user->GetExt(extenstr, pingrpl));
+ return user->GetExt(extenstr, pingrpl) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
virtual void OnUserDisconnect(User* user)
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 6828d28f2..88f566d6d 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -61,12 +61,12 @@ public:
first = ServerInstance->Time();
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
time_t next = ServerInstance->Time();
if ((ServerInstance->startup_time + boot_wait) > next)
- return 0;
+ return MOD_RES_PASSTHRU;
/* time difference between first and latest connection */
time_t tdiff = next - first;
@@ -81,11 +81,11 @@ public:
/* expire throttle */
throttled = 0;
ServerInstance->SNO->WriteGlobalSno('a', "Connection throttle deactivated");
- return 0;
+ return MOD_RES_PASSTHRU;
}
ServerInstance->Users->QuitUser(user, quitmsg);
- return 1;
+ return MOD_RES_DENY;
}
if (tdiff <= seconds)
@@ -95,7 +95,7 @@ public:
throttled = 1;
ServerInstance->SNO->WriteGlobalSno('a', "Connection throttle activated");
ServerInstance->Users->QuitUser(user, quitmsg);
- return 1;
+ return MOD_RES_DENY;
}
}
else
@@ -103,7 +103,7 @@ public:
conns = 1;
first = next;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnRehash(User* user)
diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp
index 806f2194f..54dd9b0d0 100644
--- a/src/modules/m_customtitle.cpp
+++ b/src/modules/m_customtitle.cpp
@@ -101,7 +101,7 @@ class ModuleCustomTitle : public Module
// :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games.
- int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
+ ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
{
/* We use this and not OnWhois because this triggers for remote, too */
if (numeric == 312)
@@ -114,7 +114,7 @@ class ModuleCustomTitle : public Module
}
}
/* Dont block anything */
- return 0;
+ return MOD_RES_PASSTHRU;
}
// Whenever the linking module wants to send out data, but doesnt know what the data
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index df70bba82..cd43a4539 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -282,21 +282,21 @@ class ModuleDCCAllow : public Module
}
- virtual int OnUserPreNick(User* user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
{
RemoveNick(user);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreNotice(user, dest, target_type, text, status, exempt_list);
}
- virtual int OnUserPreNotice(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
if (target_type == TYPE_USER)
{
@@ -304,7 +304,7 @@ class ModuleDCCAllow : public Module
/* Always allow a user to dcc themselves (although... why?) */
if (user == u)
- return 0;
+ return MOD_RES_PASSTHRU;
if ((text.length()) && (text[0] == '\1'))
{
@@ -319,7 +319,7 @@ class ModuleDCCAllow : public Module
{
for (dccallowlist::const_iterator iter = dl->begin(); iter != dl->end(); ++iter)
if (InspIRCd::Match(user->GetFullHost(), iter->hostmask))
- return 0;
+ return MOD_RES_PASSTHRU;
}
// tokenize
@@ -346,7 +346,7 @@ class ModuleDCCAllow : public Module
{
/* We have a matching badfile entry, override whatever the default action is */
if (bfl[i].action == "allow")
- return 0;
+ return MOD_RES_PASSTHRU;
else
{
found = true;
@@ -357,24 +357,24 @@ class ModuleDCCAllow : public Module
/* only follow the default action if no badfile matches were found above */
if ((!found) && (defaultaction == "allow"))
- return 0;
+ return MOD_RES_PASSTHRU;
user->WriteServ("NOTICE %s :The user %s is not accepting DCC SENDs from you. Your file %s was not sent.", user->nick.c_str(), u->nick.c_str(), filename.c_str());
u->WriteServ("NOTICE %s :%s (%s@%s) attempted to send you a file named %s, which was blocked.", u->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), filename.c_str());
u->WriteServ("NOTICE %s :If you trust %s and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.", u->nick.c_str(), user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
else if ((type == "CHAT") && (blockchat))
{
user->WriteServ("NOTICE %s :The user %s is not accepting DCC CHAT requests from you.", user->nick.c_str(), u->nick.c_str());
u->WriteServ("NOTICE %s :%s (%s@%s) attempted to initiate a DCC CHAT session, which was blocked.", u->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str());
u->WriteServ("NOTICE %s :If you trust %s and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.", u->nick.c_str(), user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
void Expire()
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 0600d1ab9..aaa3696b5 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -74,7 +74,7 @@ class ModuleDeaf : public Module
delete conf;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
@@ -83,10 +83,10 @@ class ModuleDeaf : public Module
this->BuildDeafList(MSG_NOTICE, chan, user, status, text, exempt_list);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
@@ -95,7 +95,7 @@ class ModuleDeaf : public Module
this->BuildDeafList(MSG_PRIVMSG, chan, user, status, text, exempt_list);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text)
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index d9eb83c48..9463457f7 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -42,7 +42,7 @@ class ModuleDelayJoin : public Module
virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick);
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created);
void CleanUser(User* user);
- bool OnHostCycle(User* user);
+ ModResult OnHostCycle(User* user);
void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent);
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
@@ -158,9 +158,9 @@ void ModuleDelayJoin::OnUserKick(User* source, User* user, Channel* chan, const
}
}
-bool ModuleDelayJoin::OnHostCycle(User* user)
+ModResult ModuleDelayJoin::OnHostCycle(User* user)
{
- return user->GetExt("delayjoin");
+ return user->GetExt("delayjoin") ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
void ModuleDelayJoin::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index c40439ea8..8400823fa 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -60,7 +60,7 @@ class ModuleDelayMsg : public Module
void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent);
void OnCleanup(int target_type, void* item);
- int OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list);
+ ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list);
};
/* $ModDesc: Allows for delay-join channels (+D) where users dont appear to join until they speak */
@@ -130,21 +130,21 @@ void ModuleDelayMsg::OnCleanup(int target_type, void* item)
}
}
-int ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
/* Server origin */
if (!user)
- return false;
+ return MOD_RES_PASSTHRU;
if (target_type != TYPE_CHANNEL)
- return false;
+ return MOD_RES_PASSTHRU;
Channel* channel = (Channel*) dest;
void* jointime_as_ptr;
if (!user->GetExt("delaymsg_"+channel->name, jointime_as_ptr))
- return false;
+ return MOD_RES_PASSTHRU;
time_t jointime = reinterpret_cast<time_t>(jointime_as_ptr);
@@ -156,7 +156,7 @@ int ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, st
{
user->WriteNumeric(404, "%s %s :You must wait %s seconds after joining to send to channel (+d)",
user->nick.c_str(), channel->name.c_str(), len.c_str());
- return true;
+ return MOD_RES_DENY;
}
}
else
@@ -164,7 +164,7 @@ int ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, st
/* Timer has expired, we can stop checking now */
user->Shrink("delaymsg_"+channel->name);
}
- return false;
+ return MOD_RES_PASSTHRU;
}
MODULE_INIT(ModuleDelayMsg)
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 3a9df37a2..401642e08 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -86,7 +86,7 @@ class ModuleDenyChannels : public Module
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
for (int j =0; j < Conf->Enumerate("badchan"); j++)
{
@@ -94,7 +94,7 @@ class ModuleDenyChannels : public Module
{
if (IS_OPER(user) && Conf->ReadFlag("badchan","allowopers",j))
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
else
{
@@ -105,7 +105,7 @@ class ModuleDenyChannels : public Module
{
if (InspIRCd::Match(cname, Conf->ReadValue("goodchan", "name", i)))
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
}
@@ -117,16 +117,16 @@ class ModuleDenyChannels : public Module
{
user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname,cname,redirect.c_str(), reason.c_str());
Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time());
- return 1;
+ return MOD_RES_DENY;
}
}
user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname,cname,reason.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 7fb652cf7..f70496d68 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -305,7 +305,7 @@ class ModuleDNSBL : public Module
ReadConf();
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
/* only do lookups on local users */
if (IS_LOCAL(user))
@@ -320,7 +320,7 @@ class ModuleDNSBL : public Module
success = inet_aton(user->GetIPString(), &in);
if (!success)
- return 0;
+ return MOD_RES_PASSTHRU;
d = (unsigned char) (in.s_addr >> 24) & 0xFF;
c = (unsigned char) (in.s_addr >> 16) & 0xFF;
@@ -344,13 +344,13 @@ class ModuleDNSBL : public Module
}
/* don't do anything with this hot potato */
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnStats(char symbol, User* user, string_list &results)
+ virtual ModResult OnStats(char symbol, User* user, string_list &results)
{
if (symbol != 'd')
- return 0;
+ return MOD_RES_PASSTHRU;
unsigned long total_hits = 0, total_misses = 0;
@@ -366,7 +366,7 @@ class ModuleDNSBL : public Module
results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total hits: " + ConvToStr(total_hits));
results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total misses: " + ConvToStr(total_misses));
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 3288d69fb..36a8c4f95 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -123,21 +123,21 @@ protected:
public:
FilterBase(InspIRCd* Me, const std::string &source);
virtual ~FilterBase();
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
virtual FilterResult* FilterMatch(User* user, const std::string &text, int flags) = 0;
virtual bool DeleteFilter(const std::string &freeform) = 0;
virtual void SyncFilters(Module* proto, void* opaque) = 0;
virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter);
virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flags) = 0;
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
virtual void OnRehash(User* user);
virtual Version GetVersion();
std::string EncodeFilter(FilterResult* filter);
FilterResult DecodeFilter(const std::string &data);
virtual void OnSyncNetwork(Module* proto, void* opaque);
virtual void OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata);
- virtual int OnStats(char symbol, User* user, string_list &results) = 0;
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line);
+ virtual ModResult OnStats(char symbol, User* user, string_list &results) = 0;
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line);
bool AppliesToMe(User* user, FilterResult* filter, int flags);
void OnLoadModule(Module* mod, const std::string& name);
virtual void ReadFilters(ConfigReader &MyConf) = 0;
@@ -249,20 +249,20 @@ FilterBase::~FilterBase()
ServerInstance->Modules->DoneWithInterface("RegularExpression");
}
-int FilterBase::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ModResult FilterBase::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
flags = FLAG_PRIVMSG;
return OnUserPreNotice(user,dest,target_type,text,status,exempt_list);
}
-int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ModResult FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
/* Leave ulines alone */
if ((ServerInstance->ULine(user->server)) || (!IS_LOCAL(user)))
- return 0;
+ return MOD_RES_PASSTHRU;
if (!flags)
flags = FLAG_NOTICE;
@@ -281,7 +281,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri
Channel* t = (Channel*)dest;
target = std::string(t->name);
std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), target);
- if (i != exemptfromfilter.end()) return 0;
+ if (i != exemptfromfilter.end()) return MOD_RES_PASSTHRU;
}
if (f->action == "block")
{
@@ -314,12 +314,12 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri
}
ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+ user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + f->action);
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
-int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ModResult FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
flags = 0;
if (validated && IS_LOCAL(user))
@@ -332,7 +332,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
{
/* QUIT with no reason: nothing to do */
if (parameters.size() < 1)
- return 0;
+ return MOD_RES_PASSTHRU;
checkline = parameters[0];
replacepoint = 0;
@@ -343,10 +343,10 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
{
/* PART with no reason: nothing to do */
if (parameters.size() < 2)
- return 0;
+ return MOD_RES_PASSTHRU;
std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), parameters[0]);
- if (i != exemptfromfilter.end()) return 0;
+ if (i != exemptfromfilter.end()) return MOD_RES_PASSTHRU;
checkline = parameters[1];
replacepoint = 1;
parting = true;
@@ -354,7 +354,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
}
else
/* We're only messing with PART and QUIT */
- return 0;
+ return MOD_RES_PASSTHRU;
FilterResult* f = NULL;
@@ -363,7 +363,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
if (!f)
/* PART or QUIT reason doesnt match a filter */
- return 0;
+ return MOD_RES_PASSTHRU;
/* We cant block a part or quit, so instead we change the reason to 'Reason filtered' */
Command* c = ServerInstance->Parser->GetHandler(command);
@@ -380,7 +380,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
if ((f->action == "block") || (((!parting) && (f->action == "kill"))) || (f->action == "silent"))
{
c->Handle(params, user);
- return 1;
+ return MOD_RES_DENY;
}
else
{
@@ -401,12 +401,12 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par
else
delete gl;
}
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
void FilterBase::OnRehash(User* user)
@@ -671,7 +671,7 @@ class ModuleFilter : public FilterBase
}
}
- virtual int OnStats(char symbol, User* user, string_list &results)
+ virtual ModResult OnStats(char symbol, User* user, string_list &results)
{
if (symbol == 's')
{
@@ -685,7 +685,7 @@ class ModuleFilter : public FilterBase
results.push_back(sn+" 223 "+user->nick+" :EXEMPT "+(*i));
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp
index 6ecd41342..46ed50f2f 100644
--- a/src/modules/m_gecosban.cpp
+++ b/src/modules/m_gecosban.cpp
@@ -34,7 +34,7 @@ class ModuleGecosBan : public Module
return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION);
}
- virtual int OnCheckBan(User *user, Channel *c)
+ virtual ModResult OnCheckBan(User *user, Channel *c)
{
return c->GetExtBanStatus(user->fullname, 'r');
}
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
index 070a3ce53..521920593 100644
--- a/src/modules/m_hidechans.cpp
+++ b/src/modules/m_hidechans.cpp
@@ -75,30 +75,30 @@ class ModuleHideChans : public Module
AffectsOpers = conf.ReadFlag("hidechans", "affectsopers", 0);
}
- int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
+ ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
{
/* always show to self */
if (user == dest)
- return 0;
+ return MOD_RES_PASSTHRU;
/* don't touch anything except 319 */
if (numeric != 319)
- return 0;
+ return MOD_RES_PASSTHRU;
/* don't touch if -I */
if (!dest->IsModeSet('I'))
- return 0;
+ return MOD_RES_PASSTHRU;
/* if it affects opers, we don't care if they are opered */
if (AffectsOpers)
- return 1;
+ return MOD_RES_DENY;
/* doesn't affect opers, sender is opered */
if (user->HasPrivPermission("users/auspex"))
- return 0;
+ return MOD_RES_PASSTHRU;
/* user must be opered, boned. */
- return 1;
+ return MOD_RES_DENY;
}
};
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index be4de8f8d..b19ecb97c 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -70,21 +70,21 @@ class ModuleHideOper : public Module
return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
}
- int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
+ ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
{
/* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
* person doing the WHOIS is not an oper
*/
if (numeric != 313)
- return 0;
+ return MOD_RES_PASSTHRU;
if (!dest->IsModeSet('H'))
- return 0;
+ return MOD_RES_PASSTHRU;
if (!user->HasPrivPermission("users/auspex"))
- return 1;
+ return MOD_RES_DENY;
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 8d21d5cc8..690d7b15c 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -312,7 +312,7 @@ class ModuleIdent : public Module
RequestTimeout = 5;
}
- virtual int OnUserRegister(User *user)
+ virtual ModResult OnUserRegister(User *user)
{
for (int j = 0; j < Conf->Enumerate("connect"); j++)
{
@@ -323,7 +323,7 @@ class ModuleIdent : public Module
bool useident = Conf->ReadFlag("connect", "useident", "yes", j);
if (!useident)
- return 0;
+ return MOD_RES_PASSTHRU;
}
}
@@ -345,21 +345,21 @@ class ModuleIdent : public Module
ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason());
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
/* This triggers pretty regularly, we can use it in preference to
* creating a Timer object and especially better than creating a
* Timer per ident lookup!
*/
- virtual bool OnCheckReady(User *user)
+ virtual ModResult OnCheckReady(User *user)
{
/* Does user have an ident socket attached at all? */
IdentRequestSocket *isock = NULL;
if (!user->GetExt("ident_socket", isock))
{
ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :(");
- return true;
+ return MOD_RES_PASSTHRU;
}
ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket");
@@ -377,14 +377,14 @@ class ModuleIdent : public Module
* we call this to clean up the user
*/
OnUserDisconnect(user);
- return true;
+ return MOD_RES_PASSTHRU;
}
/* Got a result yet? */
if (!isock->HasResult())
{
ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet");
- return false;
+ return MOD_RES_DENY;
}
ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!");
@@ -400,7 +400,7 @@ class ModuleIdent : public Module
/* The user isnt actually disconnecting, we call this to clean up the user */
OnUserDisconnect(user);
- return true;
+ return MOD_RES_PASSTHRU;
}
virtual void OnCleanup(int target_type, void *item)
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 7ccd8188b..5c879aea6 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -160,10 +160,10 @@ class ModuleInvisible : public Module
virtual void OnRehash(User* user);
void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
- bool OnHostCycle(User* user);
+ ModResult OnHostCycle(User* user);
/* No privmsg response when hiding - submitted by Eric at neowin */
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
/* Fix by Eric @ neowin.net, thanks :) -- Brain */
void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) CUSTOM_PRINTF(4, 5);
};
@@ -224,13 +224,13 @@ void ModuleInvisible::OnUserQuit(User* user, const std::string &reason, const st
}
}
-bool ModuleInvisible::OnHostCycle(User* user)
+ModResult ModuleInvisible::OnHostCycle(User* user)
{
- return user->IsModeSet('Q');
+ return user->IsModeSet('Q') ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
/* No privmsg response when hiding - submitted by Eric at neowin */
-int ModuleInvisible::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ModResult ModuleInvisible::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_USER) && (IS_LOCAL(user)))
{
@@ -238,13 +238,13 @@ int ModuleInvisible::OnUserPreNotice(User* user,void* dest,int target_type, std:
if(target->IsModeSet('Q') && !IS_OPER(user))
{
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), target->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
-int ModuleInvisible::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ModResult ModuleInvisible::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreNotice(user, dest, target_type, text, status, exempt_list);
}
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index da7f10df1..29d7eb5d5 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -57,7 +57,7 @@ public:
output.append(" INVEX=I");
}
- virtual int OnCheckInvite(User* user, Channel* chan)
+ virtual ModResult OnCheckInvite(User* user, Channel* chan)
{
if(chan != NULL)
{
@@ -71,14 +71,14 @@ public:
if(InspIRCd::Match(user->GetFullRealHost(), it->mask) || InspIRCd::Match(user->GetFullHost(), it->mask) || (InspIRCd::MatchCIDR(mask, it->mask)))
{
// They match an entry on the list, so let them in.
- return 1;
+ return MOD_RES_DENY;
}
}
}
// or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual const char* OnRequest(Request* request)
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index c83df92c4..180d58376 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -211,7 +211,7 @@ class ModuleJoinFlood : public Module
ServerInstance->Modules->Attach(eventlist, this, 3);
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan)
{
@@ -221,11 +221,11 @@ class ModuleJoinFlood : public Module
if (f->islocked())
{
user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick.c_str(),chan->name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created)
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index 5ea4cdf8e..6e8f00b44 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -147,16 +147,16 @@ class ModuleJumpServer : public Module
{
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
if (js.port && js.redirect_new_users)
{
user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead",
user->nick.c_str(), js.redirect_to.c_str(), js.port);
ServerInstance->Users->QuitUser(user, js.reason);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 5327c0592..04ecfffd7 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -119,7 +119,7 @@ public:
ServerInstance->Modules->Attach(eventlist, this, 4);
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan)
{
@@ -135,7 +135,7 @@ public:
if (iter->first == user)
{
user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter('J').c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
else
@@ -156,7 +156,7 @@ public:
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent)
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index 0a19d56df..3dff80fdf 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -95,19 +95,19 @@ public:
ResetLocked();
}
- virtual int OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(User* user)
{
if (locked)
{
ServerInstance->Users->QuitUser(user, "Server is temporarily closed. Please try again later.");
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual bool OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(User* user)
{
- return !locked;
+ return locked ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp
index 3c3b9a39b..73f217ec2 100644
--- a/src/modules/m_maphide.cpp
+++ b/src/modules/m_maphide.cpp
@@ -33,15 +33,15 @@ class ModuleMapHide : public Module
url = MyConf.ReadValue("security", "maphide", 0);
}
- int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
if (!IS_OPER(user) && !url.empty() && (command == "MAP" || command == "LINKS"))
{
user->WriteServ("NOTICE %s :/%s has been disabled; visit %s", user->nick.c_str(), command.c_str(), url.c_str());
- return 1;
+ return MOD_RES_DENY;
}
else
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleMapHide()
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index fc62cd67e..da1038512 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -205,11 +205,11 @@ class ModuleMsgFlood : public Module
ServerInstance->Modules->Attach(eventlist, this, 3);
}
- int ProcessMessages(User* user,Channel* dest, const std::string &text)
+ ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
{
if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'f') && dest->GetStatus(user) == STATUS_OP))
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
floodsettings *f;
@@ -239,27 +239,27 @@ class ModuleMsgFlood : public Module
delete dest;
}
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
return ProcessMessages(user,(Channel*)dest,text);
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
return ProcessMessages(user,(Channel*)dest,text);
- return 0;
+ return MOD_RES_PASSTHRU;
}
void OnChannelDelete(Channel* chan)
diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp
index 03203cfc7..0ac2e7ece 100644
--- a/src/modules/m_muteban.cpp
+++ b/src/modules/m_muteban.cpp
@@ -34,22 +34,22 @@ class ModuleQuietBan : public Module
return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
}
- virtual int OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user) || target_type != TYPE_CHANNEL)
- return 0;
+ return MOD_RES_PASSTHRU;
Channel* chan = static_cast<Channel*>(dest);
- if (chan->GetExtBanStatus(user, 'm') < 0 && chan->GetStatus(user) < STATUS_VOICE)
+ if (chan->GetExtBanStatus(user, 'm') == MOD_RES_DENY && chan->GetStatus(user) < STATUS_VOICE)
{
- user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)",user->nick.c_str(), ((Channel *)dest)->name.c_str());
- return 1;
+ user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)", user->nick.c_str(), chan->name.c_str());
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
}
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp
index 377c9b1f0..3aa8ec355 100644
--- a/src/modules/m_namesx.cpp
+++ b/src/modules/m_namesx.cpp
@@ -48,7 +48,7 @@ class ModuleNamesX : public Module
output.append(" NAMESX");
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
irc::string c = command.c_str();
/* We don't actually create a proper command handler class for PROTOCTL,
@@ -61,10 +61,10 @@ class ModuleNamesX : public Module
if ((parameters.size()) && (!strcasecmp(parameters[0].c_str(),"NAMESX")))
{
user->Extend("NAMESX");
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index 614843901..17f3a35f0 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -213,10 +213,10 @@ class ModuleNickFlood : public Module
ServerInstance->Modules->Attach(eventlist, this, 3);
}
- virtual int OnUserPreNick(User* user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
{
if (isdigit(newnick[0])) /* allow switches to UID */
- return 0;
+ return MOD_RES_PASSTHRU;
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
@@ -231,7 +231,7 @@ class ModuleNickFlood : public Module
if (f->islocked())
{
user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick.c_str(), channel->name.c_str(), f->nicks, f->secs);
- return 1;
+ return MOD_RES_DENY;
}
if (f->shouldlock())
@@ -239,12 +239,12 @@ class ModuleNickFlood : public Module
f->clear();
f->lock();
channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name.c_str(), f->nicks, f->secs);
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
/*
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index bc5ebe47a..e7c9e0199 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -168,23 +168,23 @@ class ModuleNickLock : public Module
}
- virtual int OnUserPreNick(User* user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
if (isdigit(newnick[0])) /* Allow a switch to a UID */
- return 0;
+ return MOD_RES_PASSTHRU;
if (user->GetExt("NICKForced")) /* Allow forced nick changes */
- return 0;
+ return MOD_RES_PASSTHRU;
if (user->GetExt("nick_locked"))
{
user->WriteNumeric(447, "%s :You cannot change your nickname (your nick is locked)",user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index f58fd192c..0dc004ee8 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -69,12 +69,12 @@ class ModuleNoCTCP : public Module
return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreNotice(user,dest,target_type,text,status,exempt_list);
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
{
@@ -82,22 +82,22 @@ class ModuleNoCTCP : public Module
if (CHANOPS_EXEMPT(ServerInstance, 'C') && c->GetStatus(user) == STATUS_OP)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
- if (c->IsModeSet('C') || c->GetExtBanStatus(user, 'C') < 0)
+ if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet('C')))
{
if ((text.length()) && (text[0] == '\1'))
{
if (strncmp(text.c_str(),"\1ACTION ",8))
{
user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void On005Numeric(std::string &output)
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 911b181ab..4af76e0d8 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -40,26 +40,26 @@ class ModuleNoKicks : public Module
ServerInstance->AddExtBanChar('Q');
}
- virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
+ virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
{
if (access_type == AC_KICK)
{
- if (channel->IsModeSet('Q') || channel->GetExtBanStatus(source, 'Q') < 0)
+ if (!channel->GetExtBanStatus(source, 'Q').check(!channel->IsModeSet('Q')))
{
if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
{
// ulines can still kick with +Q in place
- return ACR_ALLOW;
+ return MOD_RES_PASSTHRU;
}
else
{
// nobody else can (not even opers with override, and founders)
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
- return ACR_DENY;
+ return MOD_RES_DENY;
}
}
}
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleNoKicks()
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index 1b34c7597..769097ca0 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -70,17 +70,17 @@ class ModuleNoNickChange : public Module
ServerInstance->AddExtBanChar('N');
}
- virtual int OnUserPreNick(User* user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
if (isdigit(newnick[0])) /* don't even think about touching a switch to uid! */
- return 0;
+ return MOD_RES_PASSTHRU;
// Allow forced nick changes.
if (user->GetExt("NICKForced"))
- return 0;
+ return MOD_RES_PASSTHRU;
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
@@ -89,14 +89,15 @@ class ModuleNoNickChange : public Module
if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetStatus(user) == STATUS_OP)
continue;
- if (curr->IsModeSet('N') || curr->GetExtBanStatus(user, 'N') < 0)
+ if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N')))
{
- user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)", user->nick.c_str(), curr->name.c_str());
- return 1;
+ user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)",
+ user->nick.c_str(), curr->name.c_str());
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 6d17bc85d..72426646f 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -40,31 +40,31 @@ class ModuleNoNotice : public Module
ServerInstance->AddExtBanChar('T');
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
{
Channel* c = (Channel*)dest;
- if (c->IsModeSet('T') || c->GetExtBanStatus(user, 'T') < 0)
+ if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet('T')))
{
if (ServerInstance->ULine(user->server))
{
// ulines are exempt.
- return 0;
+ return MOD_RES_PASSTHRU;
}
else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetStatus(user) == STATUS_OP)
{
// channel ops are exempt if set in conf.
- return 0;
+ return MOD_RES_PASSTHRU;
}
else
{
user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleNoNotice()
diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp
index 50a6e14b9..931603907 100644
--- a/src/modules/m_nopartmsg.cpp
+++ b/src/modules/m_nopartmsg.cpp
@@ -40,7 +40,7 @@ class ModulePartMsgBan : public Module
if (!IS_LOCAL(user))
return;
- if (channel->GetExtBanStatus(user, 'p') < 0)
+ if (channel->GetExtBanStatus(user, 'p') == MOD_RES_DENY)
partmessage = "";
return;
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index f714e00f6..52d5a28be 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -58,23 +58,23 @@ class ModuleOperChans : public Module
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan && chan->IsModeSet('O') && !IS_OPER(user))
{
user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s %s :Only IRC operators may join %s (+O is set)",
user->nick.c_str(), chan->name.c_str(), chan->name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnCheckBan(User* user, Channel* chan)
+ virtual ModResult OnCheckBan(User* user, Channel* chan)
{
if (IS_OPER(user))
return chan->GetExtBanStatus(user->oper, 'O');
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleOperChans()
diff --git a/src/modules/m_operinvex.cpp b/src/modules/m_operinvex.cpp
index 5cd7ab3c6..41fc51a1d 100644
--- a/src/modules/m_operinvex.cpp
+++ b/src/modules/m_operinvex.cpp
@@ -37,10 +37,10 @@ class ModuleOperInvex : public Module
return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION);
}
- virtual int OnCheckInvite(User *user, Channel *c)
+ virtual ModResult OnCheckInvite(User *user, Channel *c)
{
if (!IS_LOCAL(user) || !IS_OPER(user))
- return 0;
+ return MOD_RES_PASSTHRU;
Module* ExceptionModule = ServerInstance->Modules->Find("m_inviteexception.so");
if (ExceptionModule)
@@ -48,17 +48,17 @@ class ModuleOperInvex : public Module
if (ListModeRequest(this, ExceptionModule, user->oper, 'O', c).Send())
{
// Oper type is exempt
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnCheckBan(User *user, Channel *c)
+ virtual ModResult OnCheckBan(User *user, Channel *c)
{
if (!IS_OPER(user))
- return 0;
+ return MOD_RES_PASSTHRU;
return c->GetExtBanStatus(user->oper, 'O');
}
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 74a6e2c5f..b613c1e31 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -44,7 +44,7 @@ class ModuleOperLevels : public Module
return Version("$Id$", VF_VENDOR, API_VERSION);
}
- virtual int OnKill(User* source, User* dest, const std::string &reason)
+ virtual ModResult OnKill(User* source, User* dest, const std::string &reason)
{
long dest_level = 0,source_level = 0;
@@ -74,10 +74,10 @@ class ModuleOperLevels : public Module
if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str());
dest->WriteServ("NOTICE %s :*** Oper %s attempted to /kill you!",dest->nick.c_str(),source->nick.c_str());
source->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper %s is a higher level than you",source->nick.c_str(),dest->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index f58945c25..646aada3e 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -37,11 +37,11 @@ class ModuleOperLog : public Module
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
/* If the command doesnt appear to be valid, we dont want to mess with it. */
if (!validated)
- return 0;
+ return MOD_RES_PASSTHRU;
if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command)))
{
@@ -50,7 +50,7 @@ class ModuleOperLog : public Module
ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s %s",user->nick.c_str(), user->ident.c_str(), user->host.c_str(), command.c_str(), parameters.empty() ? "" : irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined().c_str());
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void On005Numeric(std::string &output)
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index deb826108..aeea1ad19 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -151,12 +151,12 @@ class ModuleOperPrefixMode : public Module
}
// XXX: is there a better way to do this?
- virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt)
+ virtual ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt)
{
/* force event propagation to its ModeHandler */
if (!IS_FAKE(user) && chan && (mode == 'y'))
- return ACR_ALLOW;
- return 0;
+ return MOD_RES_ALLOW;
+ return MOD_RES_PASSTHRU;
}
virtual void OnOper(User *user, const std::string&)
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index ea5e36d94..ae18803d3 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -116,7 +116,7 @@ class ModuleOverride : public Module
}
- virtual int OnLocalTopicChange(User *source, Channel *channel, const std::string &topic)
+ virtual ModResult OnLocalTopicChange(User *source, Channel *channel, const std::string &topic)
{
if (IS_OPER(source) && CanOverride(source, "TOPIC"))
{
@@ -126,13 +126,13 @@ class ModuleOverride : public Module
}
// Explicit allow
- return -1;
+ return MOD_RES_ALLOW;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreKick(User* source, User* user, Channel* chan, const std::string &reason)
+ virtual ModResult OnUserPreKick(User* source, User* user, Channel* chan, const std::string &reason)
{
if (IS_OPER(source) && CanOverride(source,"KICK"))
{
@@ -141,18 +141,17 @@ class ModuleOverride : public Module
{
ServerInstance->SNO->WriteGlobalSno('G',std::string(source->nick)+" used oper override to kick "+std::string(user->nick)+" on "+std::string(chan->name)+" ("+reason+")");
}
- /* Returning -1 explicitly allows the kick */
- return -1;
+ return MOD_RES_ALLOW;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
+ virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
{
if (!IS_OPER(source))
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
if (!source || !channel)
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
int mode = STATUS_NORMAL;
if (channel->HasUser(source))
@@ -221,15 +220,15 @@ class ModuleOverride : public Module
if (over_this)
{
OverriddenMode = true;
- return ACR_ALLOW;
+ return MOD_RES_ALLOW;
}
else
{
- return ACR_DEFAULT;
+ return MOD_RES_PASSTHRU;
}
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (IS_LOCAL(user) && IS_OPER(user))
{
@@ -244,14 +243,14 @@ class ModuleOverride : public Module
{
// Can't join normally -- must use a special key to bypass restrictions
user->WriteServ("NOTICE %s :*** You may not join normally. You must join with a key of 'override' to oper override.", user->nick.c_str());
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (NoisyOverride)
chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass invite-only", cname, user->nick.c_str());
ServerInstance->SNO->WriteGlobalSno('G', user->nick+" used oper override to bypass +i on "+std::string(cname));
}
- return -1;
+ return MOD_RES_ALLOW;
}
if ((chan->modes[CM_KEY]) && (CanOverride(user,"KEY")) && keygiven != chan->GetModeParameter('k'))
@@ -260,13 +259,13 @@ class ModuleOverride : public Module
{
// Can't join normally -- must use a special key to bypass restrictions
user->WriteServ("NOTICE %s :*** You may not join normally. You must join with a key of 'override' to oper override.", user->nick.c_str());
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (NoisyOverride)
chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel key", cname, user->nick.c_str());
ServerInstance->SNO->WriteGlobalSno('G', user->nick+" used oper override to bypass +k on "+std::string(cname));
- return -1;
+ return MOD_RES_ALLOW;
}
if ((chan->modes[CM_LIMIT]) && (chan->GetUserCounter() >= atoi(chan->GetModeParameter('l').c_str())) && (CanOverride(user,"LIMIT")))
@@ -275,13 +274,13 @@ class ModuleOverride : public Module
{
// Can't join normally -- must use a special key to bypass restrictions
user->WriteServ("NOTICE %s :*** You may not join normally. You must join with a key of 'override' to oper override.", user->nick.c_str());
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (NoisyOverride)
chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel limit", cname, user->nick.c_str());
ServerInstance->SNO->WriteGlobalSno('G', user->nick+" used oper override to bypass +l on "+std::string(cname));
- return -1;
+ return MOD_RES_ALLOW;
}
if (chan->IsBanned(user) && CanOverride(user,"BANWALK"))
@@ -290,17 +289,17 @@ class ModuleOverride : public Module
{
// Can't join normally -- must use a special key to bypass restrictions
user->WriteServ("NOTICE %s :*** You may not join normally. You must join with a key of 'override' to oper override.", user->nick.c_str());
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (NoisyOverride)
chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass channel ban", cname, user->nick.c_str());
ServerInstance->SNO->WriteGlobalSno('G',"%s used oper override to bypass channel ban on %s", user->nick.c_str(), cname);
- return -1;
+ return MOD_RES_ALLOW;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual const char* OnRequest(Request* request)
diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp
index 761f52bc4..fcc910073 100644
--- a/src/modules/m_password_hash.cpp
+++ b/src/modules/m_password_hash.cpp
@@ -134,7 +134,7 @@ class ModuleOperHash : public Module
}
}
- virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
+ virtual ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
/* First, lets see what hash theyre using on this oper */
hashymodules::iterator x = hashers.find(hashtype.c_str());
@@ -146,13 +146,14 @@ class ModuleOperHash : public Module
HashResetRequest(this, x->second).Send();
/* Compare the hash in the config to the generated hash */
if (!strcasecmp(data.c_str(), HashSumRequest(this, x->second, input.c_str()).Send()))
- return 1;
+ return MOD_RES_ALLOW;
/* No match, and must be hashed, forbid */
- else return -1;
+ else
+ return MOD_RES_DENY;
}
/* Not a hash, fall through to strcmp in core */
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index f765c2422..647c840b5 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -184,12 +184,12 @@ public:
return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
}
- virtual int OnChannelPreDelete(Channel *c)
+ virtual ModResult OnChannelPreDelete(Channel *c)
{
if (c->IsModeSet('P'))
- return 1;
+ return MOD_RES_DENY;
- return 0;
+ return MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index dd7d2e954..9d19b0cf0 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -100,7 +100,7 @@ class ModuleRedirect : public Module
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan)
{
@@ -116,16 +116,16 @@ class ModuleRedirect : public Module
if (destchan && destchan->IsModeSet('L'))
{
user->WriteNumeric(470, "%s %s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", user->nick.c_str(), cname);
- return 1;
+ return MOD_RES_DENY;
}
user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname, channel.c_str());
Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time());
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleRedirect()
diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp
index 41b11ed41..5be303148 100644
--- a/src/modules/m_regonlycreate.cpp
+++ b/src/modules/m_regonlycreate.cpp
@@ -26,22 +26,22 @@ class ModuleRegOnlyCreate : public Module
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan)
- return 0;
+ return MOD_RES_PASSTHRU;
if (IS_OPER(user))
- return 0;
+ return MOD_RES_PASSTHRU;
if ((!user->IsModeSet('r')) && (!user->GetExt("accountname")))
{
// XXX. there may be a better numeric for this..
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname);
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleRegOnlyCreate()
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index f84d9abb2..68aa455e7 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -51,11 +51,11 @@ class ModuleRestrictChans : public Module
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
irc::string x = cname;
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
// channel does not yet exist (record is null, about to be created IF we were to allow it)
if (!chan)
@@ -64,10 +64,10 @@ class ModuleRestrictChans : public Module
if ((!IS_OPER(user)) && (allowchans.find(x) == allowchans.end()))
{
user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname);
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleRestrictChans()
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index b3ab98e51..906184e7a 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -30,7 +30,7 @@ class ModuleRestrictMsg : public Module
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_USER) && (IS_LOCAL(user)))
{
@@ -42,17 +42,17 @@ class ModuleRestrictMsg : public Module
// anything else, blocked.
if (IS_OPER(u) || IS_OPER(user))
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user",user->nick.c_str(),u->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
// however, we must allow channel messages...
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return this->OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 843470f39..b2ddd798d 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -267,13 +267,13 @@ class ModuleRLine : public Module
}
}
- virtual int OnStats(char symbol, User* user, string_list &results)
+ virtual ModResult OnStats(char symbol, User* user, string_list &results)
{
if (symbol != 'R')
- return 0;
+ return MOD_RES_PASSTHRU;
ServerInstance->XLines->InvokeStats("R", 223, user, results);
- return 1;
+ return MOD_RES_DENY;
}
virtual void OnLoadModule(Module* mod, const std::string& name)
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index b99c78c83..bd1a54110 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -68,24 +68,24 @@ class ModuleSafeList : public Module
* OnPreCommand()
* Intercept the LIST command.
*/
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
/* If the command doesnt appear to be valid, we dont want to mess with it. */
if (!validated)
- return 0;
+ return MOD_RES_PASSTHRU;
if (command == "LIST")
{
return this->HandleList(parameters, user);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
/*
* HandleList()
* Handle (override) the LIST command.
*/
- int HandleList(const std::vector<std::string> &parameters, User* user)
+ ModResult HandleList(const std::vector<std::string> &parameters, User* user)
{
int pcnt = parameters.size();
int minusers = 0, maxusers = 0;
@@ -95,7 +95,7 @@ class ModuleSafeList : public Module
user->WriteServ("NOTICE %s :*** Server load is currently too heavy. Please try again later.", user->nick.c_str());
user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str());
user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
/* First, let's check if the user is currently /list'ing */
@@ -105,7 +105,7 @@ class ModuleSafeList : public Module
if (ld)
{
/* user is already /list'ing, we don't want to do shit. */
- return 1;
+ return MOD_RES_DENY;
}
/* Work around mIRC suckyness. YOU SUCK, KHALED! */
@@ -134,7 +134,7 @@ class ModuleSafeList : public Module
user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick.c_str());
user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str());
user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
delete last_list_time;
@@ -156,7 +156,7 @@ class ModuleSafeList : public Module
global_listing++;
- return 1;
+ return MOD_RES_DENY;
}
virtual void OnBufferFlushed(User* user)
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 45984b230..a58d4dcdc 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -230,7 +230,7 @@ class ModuleSASL : public Module
ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
}
- virtual int OnUserRegister(User *user)
+ virtual ModResult OnUserRegister(User *user)
{
SaslAuthenticator *sasl_;
if (user->GetExt("sasl_authenticator", sasl_))
@@ -240,7 +240,7 @@ class ModuleSASL : public Module
user->Shrink("sasl_authenticator");
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnCleanup(int target_type, void *item)
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 6c3114860..6da7ab7aa 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -54,18 +54,18 @@ class ModuleSecureList : public Module
* OnPreCommand()
* Intercept the LIST command.
*/
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
/* If the command doesnt appear to be valid, we dont want to mess with it. */
if (!validated)
- return 0;
+ return MOD_RES_PASSTHRU;
if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!IS_OPER(user)))
{
/* Normally wouldnt be allowed here, are they exempt? */
for (std::vector<std::string>::iterator x = allowlist.begin(); x != allowlist.end(); x++)
if (InspIRCd::Match(user->MakeHost(), *x, ascii_case_insensitive_map))
- return 0;
+ return MOD_RES_PASSTHRU;
/* Not exempt, BOOK EM DANNO! */
user->WriteServ("NOTICE %s :*** You cannot list within the first %lu seconds of connecting. Please try again later.",user->nick.c_str(), (unsigned long) WaitTime);
@@ -74,9 +74,9 @@ class ModuleSecureList : public Module
*/
user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str());
user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void On005Numeric(std::string &output)
diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp
index 241ac1ce3..bd47e947a 100644
--- a/src/modules/m_serverban.cpp
+++ b/src/modules/m_serverban.cpp
@@ -34,7 +34,7 @@ class ModuleServerBan : public Module
return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
}
- virtual int OnCheckBan(User *user, Channel *c)
+ virtual ModResult OnCheckBan(User *user, Channel *c)
{
return c->GetExtBanStatus(user->server, 's');
}
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 78fbb28dc..cc65038d1 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -156,10 +156,10 @@ class ModuleServicesAccount : public Module
}
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
std::string *account;
bool is_registered = user->GetExt("accountname", account);
@@ -168,7 +168,7 @@ class ModuleServicesAccount : public Module
if ((ServerInstance->ULine(user->nick.c_str())) || (ServerInstance->ULine(user->server)))
{
// user is ulined, can speak regardless
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (target_type == TYPE_CHANNEL)
@@ -179,16 +179,16 @@ class ModuleServicesAccount : public Module
{
// user messaging a +M channel and is not registered
user->WriteNumeric(477, ""+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel");
- return 1;
+ return MOD_RES_DENY;
}
if (account)
{
- if (c->GetExtBanStatus(*account, 'M') < 0)
+ if (c->GetExtBanStatus(*account, 'M') == MOD_RES_DENY)
{
// may not speak (text is deliberately vague, so they don't know which restriction to evade)
user->WriteNumeric(477, ""+std::string(user->nick)+" "+std::string(c->name)+" :You may not speak in this channel");
- return 1;
+ return MOD_RES_DENY;
}
}
}
@@ -200,29 +200,29 @@ class ModuleServicesAccount : public Module
{
// user messaging a +R user and is not registered
user->WriteNumeric(477, ""+ user->nick +" "+ u->nick +" :You need to be identified to a registered account to message this user");
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnCheckBan(User* user, Channel* chan)
+ virtual ModResult OnCheckBan(User* user, Channel* chan)
{
std::string* account;
if (!user->GetExt("accountname", account))
- return 0;
+ return MOD_RES_PASSTHRU;
return chan->GetExtBanStatus(*account, 'R');
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
std::string *account;
bool is_registered = user->GetExt("accountname", account);
@@ -233,7 +233,7 @@ class ModuleServicesAccount : public Module
if ((ServerInstance->ULine(user->nick.c_str())) || (ServerInstance->ULine(user->server)))
{
// user is ulined, won't be stopped from joining
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (chan->IsModeSet('R'))
@@ -242,11 +242,11 @@ class ModuleServicesAccount : public Module
{
// joining a +R channel and not identified
user->WriteNumeric(477, user->nick + " " + chan->name + " :You need to be identified to a registered account to join this channel");
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
// Whenever the linking module wants to send out data, but doesnt know what the data
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index f4729d848..4bc0cca4e 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -71,7 +71,7 @@ class ModuleServProtectMode : public Module
}
}
- virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt)
+ virtual ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt)
{
/* Check that the mode is not a server mode, it is being removed, the user making the change is local, there is a parameter,
* and the user making the change is not a uline
@@ -91,42 +91,42 @@ class ModuleServProtectMode : public Module
{
/* BZZZT, Denied! */
user->WriteNumeric(482, "%s %s :You are not permitted to remove privileges from %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network);
- return ACR_DENY;
+ return MOD_RES_DENY;
}
}
}
/* Mode allowed */
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnKill(User* src, User* dst, const std::string &reason)
+ virtual ModResult OnKill(User* src, User* dst, const std::string &reason)
{
if (src == NULL)
- return 0;
+ return MOD_RES_PASSTHRU;
if (dst->IsModeSet('k'))
{
src->WriteNumeric(485, "%s :You are not permitted to kill %s services!", src->nick.c_str(), ServerInstance->Config->Network);
ServerInstance->SNO->WriteGlobalSno('a', std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")");
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreKick(User *src, User *dst, Channel *c, const std::string &reason)
+ virtual ModResult OnUserPreKick(User *src, User *dst, Channel *c, const std::string &reason)
{
if (dst->IsModeSet('k'))
{
src->WriteNumeric(484, "%s %s :You are not permitted to kick services", src->nick.c_str(), c->name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnWhoisLine(User* src, User* dst, int &numeric, std::string &text)
+ virtual ModResult OnWhoisLine(User* src, User* dst, int &numeric, std::string &text)
{
- return ((src != dst) && (numeric == 319) && dst->IsModeSet('k'));
+ return ((src != dst) && (numeric == 319) && dst->IsModeSet('k')) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
};
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 9e3a03583..43359c28a 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -198,13 +198,13 @@ class ModuleShun : public Module
ServerInstance->XLines->UnregisterFactory(&f);
}
- virtual int OnStats(char symbol, User* user, string_list& out)
+ virtual ModResult OnStats(char symbol, User* user, string_list& out)
{
if (symbol != 'S')
- return 0;
+ return MOD_RES_PASSTHRU;
ServerInstance->XLines->InvokeStats("SHUN", 223, user, out);
- return 1;
+ return MOD_RES_DENY;
}
virtual void OnRehash(User* user)
@@ -246,21 +246,21 @@ class ModuleShun : public Module
}
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string>& parameters, User* user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, User* user, bool validated, const std::string &original_line)
{
if (validated)
- return 0;
+ return MOD_RES_PASSTHRU;
if (!ServerInstance->XLines->MatchesLine("SHUN", user))
{
/* Not shunned, don't touch. */
- return 0;
+ return MOD_RES_PASSTHRU;
}
if (!affectopers && IS_OPER(user))
{
/* Don't do anything if the user is an operator and affectopers isn't set */
- return 0;
+ return MOD_RES_PASSTHRU;
}
std::set<std::string>::iterator i = ShunEnabledCommands.find(command);
@@ -269,7 +269,7 @@ class ModuleShun : public Module
{
if (NotifyOfShun)
user->WriteServ("NOTICE %s :*** Command %s not processed, as you have been blocked from issuing commands (SHUN)", user->nick.c_str(), command.c_str());
- return 1;
+ return MOD_RES_DENY;
}
if (command == "QUIT")
@@ -284,7 +284,7 @@ class ModuleShun : public Module
}
/* if we're here, allow the command. */
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 0f851f15c..dd720608f 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -331,7 +331,7 @@ class ModuleSilence : public Module
{
if (IS_LOCAL(i->first))
{
- if (MatchPattern(i->first, sender, public_silence) == 1)
+ if (MatchPattern(i->first, sender, public_silence) == MOD_RES_ALLOW)
{
exempt_list[i->first] = i->first->nick;
}
@@ -339,7 +339,7 @@ class ModuleSilence : public Module
}
}
- virtual int PreText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type)
+ virtual ModResult PreText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type)
{
if (target_type == TYPE_USER && IS_LOCAL(((User*)dest)))
{
@@ -353,29 +353,29 @@ class ModuleSilence : public Module
this->OnBuildExemptList((silence_type == SILENCE_PRIVATE ? MSG_PRIVMSG : MSG_NOTICE), chan, user, status, exempt_list, "");
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_PRIVATE);
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_NOTICE);
}
- virtual int OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout)
+ virtual ModResult OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout)
{
return MatchPattern(dest, source, SILENCE_INVITE);
}
- int MatchPattern(User* dest, User* source, int pattern)
+ ModResult MatchPattern(User* dest, User* source, int pattern)
{
/* Server source */
if (!source || !dest)
- return 1;
+ return MOD_RES_ALLOW;
silencelist* sl;
dest->GetExt("silence_list", sl);
@@ -384,10 +384,10 @@ class ModuleSilence : public Module
for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++)
{
if (((((c->second & pattern) > 0)) || ((c->second & SILENCE_ALL) > 0)) && (InspIRCd::Match(source->GetFullHost(), c->first)))
- return !(((c->second & SILENCE_EXCLUDE) > 0));
+ return (c->second & SILENCE_EXCLUDE) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleSilence()
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index cb9d53b32..3e2b5d3b5 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -360,7 +360,7 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
}
}
-int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user)
{
// we've already checked if pcnt > 0, so this is safe
TreeServer* found = Utils->FindServerMask(parameters[0]);
@@ -377,7 +377,7 @@ int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters
{
user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str());
}
- return 1;
+ return MOD_RES_DENY;
}
/* This method will attempt to get a message to a remote user.
@@ -397,7 +397,7 @@ void ModuleSpanningTree::RemoteMessage(User* user, const char* format, ...)
ServerInstance->PI->SendUserNotice(user, text);
}
-int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters, User* user)
{
for (std::vector<Link>::iterator x = Utils->LinkBlocks.begin(); x < Utils->LinkBlocks.end(); x++)
{
@@ -406,7 +406,7 @@ int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters
if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
{
RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str());
- return 1;
+ return MOD_RES_DENY;
}
TreeServer* CheckDupe = Utils->FindServer(x->Name.c_str());
@@ -414,17 +414,17 @@ int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters
{
RemoteMessage(user, "*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
ConnectServer(&(*x));
- return 1;
+ return MOD_RES_DENY;
}
else
{
RemoteMessage(user, "*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
RemoteMessage(user, "*** CONNECT: No server matching \002%s\002 could be found in the config file.",parameters[0].c_str());
- return 1;
+ return MOD_RES_DENY;
}
void ModuleSpanningTree::OnGetServerDescription(const std::string &servername,std::string &description)
@@ -615,15 +615,15 @@ void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, boo
}
}
-int ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost)
+ModResult ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost)
{
if (user->registered != REG_ALL)
- return 0;
+ return MOD_RES_PASSTHRU;
parameterlist params;
params.push_back(newhost);
Utils->DoOneToMany(user->uuid,"FHOST",params);
- return 0;
+ return MOD_RES_PASSTHRU;
}
void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos)
@@ -856,7 +856,7 @@ void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const p
}
}
-int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
+ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
{
if (IS_LOCAL(user))
{
@@ -874,7 +874,7 @@ int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector<TranslateType> &translate)
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 54524c720..a9cba73af 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -87,35 +87,35 @@ class ModuleSpanningTree : public Module
/** Handle remote MOTD
*/
- int HandleMotd(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleMotd(const std::vector<std::string>& parameters, User* user);
/** Handle remote ADMIN
*/
- int HandleAdmin(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleAdmin(const std::vector<std::string>& parameters, User* user);
/** Handle remote STATS
*/
- int HandleStats(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleStats(const std::vector<std::string>& parameters, User* user);
/** Handle MAP command
*/
- int HandleMap(const std::vector<std::string>& parameters, User* user);
+ bool HandleMap(const std::vector<std::string>& parameters, User* user);
/** Handle SQUIT
*/
- int HandleSquit(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleSquit(const std::vector<std::string>& parameters, User* user);
/** Handle TIME
*/
- int HandleTime(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleTime(const std::vector<std::string>& parameters, User* user);
/** Handle remote WHOIS
*/
- int HandleRemoteWhois(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleRemoteWhois(const std::vector<std::string>& parameters, User* user);
/** Handle remote MODULES
*/
- int HandleModules(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleModules(const std::vector<std::string>& parameters, User* user);
/** Ping all local servers
*/
@@ -135,11 +135,11 @@ class ModuleSpanningTree : public Module
/** Handle remote VERSON
*/
- int HandleVersion(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleVersion(const std::vector<std::string>& parameters, User* user);
/** Handle CONNECT
*/
- int HandleConnect(const std::vector<std::string>& parameters, User* user);
+ ModResult HandleConnect(const std::vector<std::string>& parameters, User* user);
/** Attempt to send a message to a user
*/
@@ -157,7 +157,7 @@ class ModuleSpanningTree : public Module
** *** MODULE EVENTS ***
**/
- virtual int OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
virtual void OnGetServerDescription(const std::string &servername,std::string &description);
virtual void OnUserConnect(User* source);
@@ -168,7 +168,7 @@ class ModuleSpanningTree : public Module
virtual void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
virtual void OnBackgroundTimer(time_t curtime);
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created);
- virtual int OnChangeLocalUserHost(User* user, const std::string &newhost);
+ virtual ModResult OnChangeLocalUserHost(User* user, const std::string &newhost);
virtual void OnChangeName(User* user, const std::string &gecos);
virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
@@ -182,8 +182,8 @@ class ModuleSpanningTree : public Module
virtual void OnAddLine(User *u, XLine *x);
virtual void OnDelLine(User *u, XLine *x);
virtual void OnMode(User* user, void* dest, int target_type, const std::vector<std::string> &text, const std::vector<TranslateType> &translate);
- virtual int OnStats(char statschar, User* user, string_list &results);
- virtual int OnSetAway(User* user, const std::string &awaymsg);
+ virtual ModResult OnStats(char statschar, User* user, string_list &results);
+ virtual ModResult OnSetAway(User* user, const std::string &awaymsg);
virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate);
virtual void ProtoSendMetaData(void* opaque, Extensible* target, const std::string &extname, const std::string &extdata);
virtual std::string ProtoTranslate(Extensible* item);
diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp
index 50ab04566..c63b8dc4d 100644
--- a/src/modules/m_spanningtree/override_admin.cpp
+++ b/src/modules/m_spanningtree/override_admin.cpp
@@ -27,12 +27,12 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, User* user)
{
if (parameters.size() > 0)
{
if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0]))
- return 0;
+ return MOD_RES_PASSTHRU;
/* Remote ADMIN, the server is within the 1st parameter */
parameterlist params;
@@ -46,8 +46,8 @@ int ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters,
}
else
user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index 989ee8900..e3f103cc8 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -80,7 +80,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
// and divisons, we instead render the map onto a backplane of characters
// (a character matrix), then draw the branches as a series of "L" shapes
// from the nodes. This is not only friendlier on CPU it uses less stack.
-int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, User* user)
+bool ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, User* user)
{
if (parameters.size() > 0)
{
@@ -104,7 +104,7 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us
// Don't return if s == Utils->TreeRoot (us)
if (ret)
- return 1;
+ return true;
}
// These arrays represent a virtual screen which we will
@@ -189,6 +189,6 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us
delete[] names;
delete[] stats;
- return 1;
+ return true;
}
diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp
index 039cbb0d0..10d46bbc3 100644
--- a/src/modules/m_spanningtree/override_modules.cpp
+++ b/src/modules/m_spanningtree/override_modules.cpp
@@ -27,12 +27,12 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters, User* user)
{
if (parameters.size() > 0)
{
if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0]))
- return 0;
+ return MOD_RES_PASSTHRU;
parameterlist params;
params.push_back(parameters[0]);
@@ -44,8 +44,8 @@ int ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters
}
else
user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp
index bee75975d..fe229d5cc 100644
--- a/src/modules/m_spanningtree/override_motd.cpp
+++ b/src/modules/m_spanningtree/override_motd.cpp
@@ -27,12 +27,12 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, User* user)
{
if (parameters.size() > 0)
{
if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0]))
- return 0;
+ return MOD_RES_PASSTHRU;
/* Remote MOTD, the server is within the 1st parameter */
parameterlist params;
@@ -46,8 +46,8 @@ int ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, U
}
else
user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp
index 829c69880..a13385cd1 100644
--- a/src/modules/m_spanningtree/override_squit.cpp
+++ b/src/modules/m_spanningtree/override_squit.cpp
@@ -27,7 +27,7 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user)
{
TreeServer* s = Utils->FindServerMask(parameters[0]);
if (s)
@@ -35,7 +35,7 @@ int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters,
if (s == Utils->TreeRoot)
{
user->WriteServ("NOTICE %s :*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick.c_str(),parameters[0].c_str());
- return 1;
+ return MOD_RES_DENY;
}
TreeSocket* sock = s->GetSocket();
@@ -56,6 +56,6 @@ int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters,
{
user->WriteServ("NOTICE %s :*** SQUIT: The server \002%s\002 does not exist on the network.",user->nick.c_str(),parameters[0].c_str());
}
- return 1;
+ return MOD_RES_DENY;
}
diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp
index 76522a3dd..ecffcf05e 100644
--- a/src/modules/m_spanningtree/override_stats.cpp
+++ b/src/modules/m_spanningtree/override_stats.cpp
@@ -28,12 +28,12 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, User* user)
{
if (parameters.size() > 1)
{
if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[1]))
- return 0;
+ return MOD_RES_PASSTHRU;
/* Remote STATS, the server is within the 2nd parameter */
parameterlist params;
@@ -51,12 +51,12 @@ int ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters,
{
user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[1].c_str());
}
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
-int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results)
+ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results)
{
if ((statschar == 'c') || (statschar == 'n'))
{
@@ -66,7 +66,7 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results
if (statschar == 'c')
results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i].Name.c_str());
}
- return 1;
+ return MOD_RES_DENY;
}
if (statschar == 'p')
@@ -87,6 +87,6 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results
" (server, " + transport + ")");
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp
index d8498cd02..bd9727498 100644
--- a/src/modules/m_spanningtree/override_time.cpp
+++ b/src/modules/m_spanningtree/override_time.cpp
@@ -27,7 +27,7 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, User* user)
{
if ((IS_LOCAL(user)) && (parameters.size() > 0))
{
@@ -36,7 +36,7 @@ int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, U
{
// we dont' override for local server
if (found == Utils->TreeRoot)
- return 0;
+ return MOD_RES_PASSTHRU;
parameterlist params;
params.push_back(found->GetName());
@@ -48,6 +48,6 @@ int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, U
user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str());
}
}
- return 1;
+ return MOD_RES_DENY;
}
diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp
index 68b0919c9..2d7199571 100644
--- a/src/modules/m_spanningtree/override_whois.cpp
+++ b/src/modules/m_spanningtree/override_whois.cpp
@@ -27,7 +27,7 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parameters, User* user)
+ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parameters, User* user)
{
if ((IS_LOCAL(user)) && (parameters.size() > 1))
{
@@ -37,15 +37,15 @@ int ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parame
parameterlist params;
params.push_back(remote->uuid);
Utils->DoOneToOne(user->uuid,"IDLE",params,remote->server);
- return 1;
+ return MOD_RES_DENY;
}
else if (!remote)
{
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str());
user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), parameters[1].c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp
index 86b31143e..94f98faf1 100644
--- a/src/modules/m_spanningtree/precommand.cpp
+++ b/src/modules/m_spanningtree/precommand.cpp
@@ -27,11 +27,11 @@
/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
-int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line)
+ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line)
{
/* If the command doesnt appear to be valid, we dont want to mess with it. */
if (!validated)
- return 0;
+ return MOD_RES_PASSTHRU;
if (command == "CONNECT")
{
@@ -55,7 +55,7 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
}
else if (command == "MAP")
{
- return this->HandleMap(parameters,user);
+ return this->HandleMap(parameters,user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
else if ((command == "TIME") && (parameters.size() > 0))
{
@@ -64,12 +64,12 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
else if (command == "LUSERS")
{
this->HandleLusers(parameters,user);
- return 1;
+ return MOD_RES_DENY;
}
else if (command == "LINKS")
{
this->HandleLinks(parameters,user);
- return 1;
+ return MOD_RES_DENY;
}
else if (command == "WHOIS")
{
@@ -82,12 +82,12 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
else if ((command == "VERSION") && (parameters.size() > 0))
{
this->HandleVersion(parameters,user);
- return 1;
+ return MOD_RES_DENY;
}
else if ((command == "MODULES") && (parameters.size() > 0))
{
return this->HandleModules(parameters,user);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index 297112f62..485c104b8 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -23,13 +23,13 @@ class ModuleSpy : public Module
ServerInstance->Modules->Attach(I_OnUserList, this);
}
- virtual int OnUserList(User* user, Channel* Ptr, CUList* &nameslist)
+ virtual ModResult OnUserList(User* user, Channel* Ptr, CUList* &nameslist)
{
/* User has priv and is NOT on the channel */
if (user->HasPrivPermission("channels/auspex") && !Ptr->HasUser(user))
- return -1;
+ return MOD_RES_ALLOW;
- return 0;
+ return MOD_RES_PASSTHRU;
}
void Prioritize()
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 93f2a71db..5d4b8c3c0 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -156,7 +156,7 @@ class ModuleSSLInfo : public Module
return false;
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
irc::string pcmd = command.c_str();
@@ -204,7 +204,7 @@ class ModuleSSLInfo : public Module
if (SSLOnly && !user->GetExt("ssl"))
{
user->WriteNumeric(491, "%s :This oper login name requires an SSL connection.", user->nick.c_str());
- return 1;
+ return MOD_RES_DENY;
}
/*
@@ -215,13 +215,13 @@ class ModuleSSLInfo : public Module
user->WriteNumeric(491, "%s :This oper login name requires a matching key fingerprint.",user->nick.c_str());
ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick.c_str());
ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
- return 1;
+ return MOD_RES_DENY;
}
}
}
// Let core handle it for extra stuff
- return 0;
+ return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index b05f73326..b19347ea7 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -79,24 +79,24 @@ class ModuleSSLModes : public Module
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if(chan && chan->IsModeSet('z'))
{
if(user->GetExt("ssl", dummy))
{
// Let them in
- return 0;
+ return MOD_RES_PASSTHRU;
}
else
{
// Deny
user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname);
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleSSLModes()
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index ce98103e1..cbbef75c6 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -98,10 +98,10 @@ class ModuleStripColor : public Module
}
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
bool active = false;
if (target_type == TYPE_USER)
@@ -117,10 +117,10 @@ class ModuleStripColor : public Module
// note: short circut logic here, don't wreck it. -- w00t
if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetStatus(user) == STATUS_OP)
{
- return 0;
+ return MOD_RES_PASSTHRU;
}
- active = t->IsModeSet('S') || t->GetExtBanStatus(user, 'S') < 0;
+ active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet('S'));
}
if (active)
@@ -128,10 +128,10 @@ class ModuleStripColor : public Module
this->ReplaceLine(text);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index e0bf5a54c..860774574 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -157,26 +157,26 @@ class ModuleSVSHold : public Module
}
- virtual int OnStats(char symbol, User* user, string_list &out)
+ virtual ModResult OnStats(char symbol, User* user, string_list &out)
{
if(symbol != 'S')
- return 0;
+ return MOD_RES_PASSTHRU;
ServerInstance->XLines->InvokeStats("SVSHOLD", 210, user, out);
- return 1;
+ return MOD_RES_DENY;
}
- virtual int OnUserPreNick(User *user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User *user, const std::string &newnick)
{
XLine *rl = ServerInstance->XLines->MatchesLine("SVSHOLD", newnick);
if (rl)
{
user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason.c_str());
- return 1;
+ return MOD_RES_DENY;
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual ~ModuleSVSHold()
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 75a0a4cdd..cf14be3e1 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -101,7 +101,7 @@ class ModuleSWhois : public Module
// :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games.
- int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
+ ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
{
/* We use this and not OnWhois because this triggers for remote, too */
if (numeric == 312)
@@ -115,7 +115,7 @@ class ModuleSWhois : public Module
}
/* Dont block anything */
- return 0;
+ return MOD_RES_PASSTHRU;
}
// Whenever the linking module wants to send out data, but doesnt know what the data
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index c27acbd38..cab7f8f6e 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -127,7 +127,7 @@ class ModuleTimedBans : public Module
TimedBanList.clear();
}
- virtual int OnDelBan(User* source, Channel* chan, const std::string &banmask)
+ virtual ModResult OnDelBan(User* source, Channel* chan, const std::string &banmask)
{
irc::string listitem = banmask.c_str();
irc::string thischan = chan->name.c_str();
@@ -141,7 +141,7 @@ class ModuleTimedBans : public Module
break;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnBackgroundTimer(time_t curtime)
diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp
index 70036d5a2..c72c6f814 100644
--- a/src/modules/m_uhnames.cpp
+++ b/src/modules/m_uhnames.cpp
@@ -48,7 +48,7 @@ class ModuleUHNames : public Module
output.append(" UHNAMES");
}
- virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+ virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
irc::string c = command.c_str();
/* We don't actually create a proper command handler class for PROTOCTL,
@@ -61,10 +61,10 @@ class ModuleUHNames : public Module
if ((parameters.size()) && (!strcasecmp(parameters[0].c_str(),"UHNAMES")))
{
user->Extend("UHNAMES");
- return 1;
+ return MOD_RES_DENY;
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 6d719d13d..c78bfa638 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -389,7 +389,7 @@ class Modulewatch : public Module
maxwatch = 32;
}
- virtual int OnSetAway(User *user, const std::string &awaymsg)
+ virtual ModResult OnSetAway(User *user, const std::string &awaymsg)
{
std::string numeric;
int inum;
@@ -415,7 +415,7 @@ class Modulewatch : public Module
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index e12f95d6b..889457ade 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -139,13 +139,13 @@ void Snomask::SendMessage(const std::string &message)
LastMessage = message;
std::string desc = this->Description;
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
char mysnomask = MySnomask;
ServerInstance->Logs->Log("snomask", DEFAULT, "%s: %s", desc.c_str(), message.c_str());
- FOREACH_RESULT(I_OnSendSnotice, OnSendSnotice(mysnomask, desc, message));
+ FIRST_MOD_RESULT(ServerInstance, OnSendSnotice, MOD_RESULT, (mysnomask, desc, message));
- LastBlocked = (MOD_RESULT == 1); // 1 blocks the message
+ LastBlocked = (MOD_RESULT == MOD_RES_DENY);
if (!LastBlocked)
{
diff --git a/src/users.cpp b/src/users.cpp
index fdad68e2a..35aa2cd30 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -970,10 +970,10 @@ void User::FullConnect()
ServerInstance->Users->unregistered_count--;
/* Trigger LUSERS output, give modules a chance too */
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
std::string command("LUSERS");
std::vector<std::string> parameters;
- FOREACH_RESULT(I_OnPreCommand, OnPreCommand(command, parameters, this, true, "LUSERS"));
+ FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, parameters, this, true, "LUSERS"));
if (!MOD_RESULT)
ServerInstance->CallCommandHandler(command, parameters, this);
@@ -1025,17 +1025,17 @@ void User::InvalidateCache()
bool User::ForceNickChange(const char* newnick)
{
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
this->InvalidateCache();
this->Extend("NICKForced");
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
+ FIRST_MOD_RESULT(ServerInstance, OnUserPreNick, MOD_RESULT, (this, newnick));
this->Shrink("NICKForced");
- if (MOD_RESULT)
+ if (MOD_RESULT == MOD_RES_DENY)
{
ServerInstance->stats->statsCollisions++;
return false;
@@ -1276,11 +1276,11 @@ void User::WriteNumeric(unsigned int numeric, const char* text, ...)
void User::WriteNumeric(unsigned int numeric, const std::string &text)
{
char textbuffer[MAXBUF];
- int MOD_RESULT = 0;
+ ModResult MOD_RESULT;
- FOREACH_RESULT(I_OnNumeric, OnNumeric(this, numeric, text));
+ FIRST_MOD_RESULT(ServerInstance, OnNumeric, MOD_RESULT, (this, numeric, text));
- if (MOD_RESULT)
+ if (MOD_RESULT == MOD_RES_DENY)
return;
snprintf(textbuffer,MAXBUF,":%s %03u %s",ServerInstance->Config->ServerName, numeric, text.c_str());
@@ -1538,9 +1538,9 @@ bool User::ChangeName(const char* gecos)
if (IS_LOCAL(this))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnChangeLocalUserGECOS,OnChangeLocalUserGECOS(this,gecos));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnChangeLocalUserGECOS, MOD_RESULT, (this,gecos));
+ if (MOD_RESULT == MOD_RES_DENY)
return false;
FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos));
}
@@ -1553,10 +1553,12 @@ void User::DoHostCycle(const std::string &quitline)
{
char buffer[MAXBUF];
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnHostCycle, OnHostCycle(this));
+ ModResult result = MOD_RES_PASSTHRU;
+ FIRST_MOD_RESULT(ServerInstance, OnHostCycle, result, (this));
- if (!ServerInstance->Config->CycleHosts || MOD_RESULT)
+ if (result == MOD_RES_DENY)
+ return;
+ if (result == MOD_RES_PASSTHRU && !ServerInstance->Config->CycleHosts)
return;
uniq_id++;
@@ -1602,9 +1604,9 @@ bool User::ChangeDisplayedHost(const char* shost)
if (IS_LOCAL(this))
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,shost));
- if (MOD_RESULT)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnChangeLocalUserHost, MOD_RESULT, (this,shost));
+ if (MOD_RESULT == MOD_RES_DENY)
return false;
}
@@ -1860,9 +1862,9 @@ void User::PurgeEmptyChannels()
chan_hash::iterator i2 = ServerInstance->chanlist->find(thischan->name);
if (i2 != ServerInstance->chanlist->end())
{
- int MOD_RESULT = 0;
- FOREACH_RESULT_I(ServerInstance,I_OnChannelPreDelete, OnChannelPreDelete(i2->second));
- if (MOD_RESULT == 1)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(ServerInstance, OnChannelPreDelete, MOD_RESULT, (i2->second));
+ if (MOD_RESULT == MOD_RES_DENY)
continue; // delete halted by module
FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(i2->second));
delete i2->second;