summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-26 17:26:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-26 17:26:16 +0000
commita9b90ecb4329498aba52da6aaa9812e3a70b8e11 (patch)
tree38053a6bfa07486c6fc5cc46ebddb5e32306014a
parentdab3dc93c177400a749400c61c9253be055b78e3 (diff)
Adding hook type checking to event calls to speed them up
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2653 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd_io.h4
-rw-r--r--include/modules.h32
-rw-r--r--src/channels.cpp22
-rw-r--r--src/cmd_eline.cpp4
-rw-r--r--src/cmd_gline.cpp4
-rw-r--r--src/cmd_info.cpp2
-rw-r--r--src/cmd_invite.cpp4
-rw-r--r--src/cmd_kill.cpp4
-rw-r--r--src/cmd_kline.cpp4
-rw-r--r--src/cmd_nick.cpp10
-rw-r--r--src/cmd_notice.cpp8
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/cmd_privmsg.cpp8
-rw-r--r--src/cmd_qline.cpp4
-rw-r--r--src/cmd_quit.cpp6
-rw-r--r--src/cmd_rehash.cpp2
-rw-r--r--src/cmd_stats.cpp2
-rw-r--r--src/cmd_topic.cpp4
-rw-r--r--src/cmd_user.cpp2
-rw-r--r--src/cmd_wallops.cpp2
-rw-r--r--src/cmd_zline.cpp4
-rw-r--r--src/command_parse.cpp4
-rw-r--r--src/commands.cpp4
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/inspircd.cpp8
-rw-r--r--src/message.cpp10
-rw-r--r--src/mode.cpp72
-rw-r--r--src/modules.cpp3
-rw-r--r--src/users.cpp18
29 files changed, 141 insertions, 114 deletions
diff --git a/include/inspircd_io.h b/include/inspircd_io.h
index 158794555..86ab543a5 100644
--- a/include/inspircd_io.h
+++ b/include/inspircd_io.h
@@ -251,6 +251,10 @@ class ServerConfig : public classbase
*/
int ports[255];
+ /** Boolean sets of which modules implement which functions
+ */
+ char implement_lists[255][255];
+
/** A list of ports claimed by IO Modules
*/
std::map<int,Module*> IOHookModule;
diff --git a/include/modules.h b/include/modules.h
index 4ce96a45d..28dbadb2e 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -61,6 +61,7 @@
#include <string>
#include <deque>
#include <sstream>
+#include <typeinfo>
class Server;
class ServerConfig;
@@ -79,7 +80,10 @@ typedef std::deque<userrec*> chanuserlist;
// loaded modules in a readable simple way, e.g.:
// 'FOREACH_MOD OnConnect(user);'
-#define FOREACH_MOD for (int _i = 0; _i <= MODCOUNT; _i++) modules[_i]->
+#define FOREACH_MOD(y,x) for (int _i = 0; _i <= MODCOUNT; _i++) { \
+ if (Config->implement_lists[_i][y]) \
+ modules[_i]->x ; \
+ }
// This define is similar to the one above but returns a result in MOD_RESULT.
// The first module to return a nonzero result is the value to be accepted,
@@ -87,12 +91,14 @@ typedef std::deque<userrec*> chanuserlist;
// *********************************************************************************************
-#define FOREACH_RESULT(x) { MOD_RESULT = 0; \
+#define FOREACH_RESULT(y,x) { MOD_RESULT = 0; \
for (int _i = 0; _i <= MODCOUNT; _i++) { \
- int res = modules[_i]->x ; \
- if (res != 0) { \
- MOD_RESULT = res; \
- break; \
+ if (Config->implement_lists[_i][y]) {\
+ int res = modules[_i]->x ; \
+ if (res != 0) { \
+ MOD_RESULT = res; \
+ break; \
+ } \
} \
} \
}
@@ -264,6 +270,18 @@ class ExtMode : public classbase
};
+enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw,
+ I_OnExtendedMode, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnInfo, I_OnWhois, I_OnUserPreInvite,
+ I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode,
+ I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData,
+ I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddGLine,
+ I_OnAddZLine, I_OnAddQLine, I_OnAddKLine, I_OnAddELine, I_OnDelGLine, I_OnDelZLine, I_OnDelKLine, I_OnDelELine, I_OnDelQLine,
+ I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule,
+ I_OnBackgroundTimer, I_OnSendList, I_OnPreCommand, I_OnCheckReady, I_OnUserRrgister, I_OnRawMode, I_OnCheckInvite,
+ I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange,
+ I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnGlobalConnect, I_OnAddBan, I_OnDelBan,
+ I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead };
+
/** Base class for all InspIRCd modules
* This class is the base class for InspIRCd modules. All modules must inherit from this class,
* its methods will be called when irc server events occur. class inherited from module must be
@@ -290,6 +308,8 @@ class Module : public classbase
*/
virtual Version GetVersion();
+ virtual void Implements(bool &Implements[255]);
+
/** Called when a user connects.
* The details of the connecting user are available to you in the parameter userrec *user
* @param user The user who is connecting
diff --git a/src/channels.cpp b/src/channels.cpp
index 0201ec7b4..1c1f15d80 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -208,7 +208,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
if (user->fd > -1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreJoin(user,NULL,cname));
+ FOREACH_RESULT(I_OnUserPreJoin,OnUserPreJoin(user,NULL,cname));
if (MOD_RESULT == 1)
return NULL;
}
@@ -238,7 +238,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
if (user->fd > -1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreJoin(user,Ptr,cname));
+ FOREACH_RESULT(I_OnUserPreJoin,OnUserPreJoin(user,Ptr,cname));
if (MOD_RESULT == 1)
{
return NULL;
@@ -248,7 +248,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
if (*Ptr->key)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnCheckKey(user, Ptr, key ? key : ""));
+ FOREACH_RESULT(I_OnCheckKey,OnCheckKey(user, Ptr, key ? key : ""));
if (!MOD_RESULT)
{
if (!key)
@@ -272,7 +272,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
{
MOD_RESULT = 0;
irc::string xname(Ptr->name);
- FOREACH_RESULT(OnCheckInvite(user, Ptr));
+ FOREACH_RESULT(I_OnCheckInvite,OnCheckInvite(user, Ptr));
if (!MOD_RESULT)
{
log(DEBUG,"add_channel: channel is +i");
@@ -292,7 +292,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
if (Ptr->limit)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnCheckLimit(user, Ptr));
+ FOREACH_RESULT(I_OnCheckLimit,OnCheckLimit(user, Ptr));
if (!MOD_RESULT)
{
if (usercount(Ptr) >= Ptr->limit)
@@ -306,7 +306,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
{
log(DEBUG,"add_channel: about to walk banlist");
MOD_RESULT = 0;
- FOREACH_RESULT(OnCheckBan(user, Ptr));
+ FOREACH_RESULT(I_OnCheckBan,OnCheckBan(user, Ptr));
if (!MOD_RESULT)
{
for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++)
@@ -386,7 +386,7 @@ chanrec* ForceChan(chanrec* Ptr,ucrec &a,userrec* user, int created)
}
userlist(user,Ptr);
WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
- FOREACH_MOD OnUserJoin(user,Ptr);
+ FOREACH_MOD(I_OnUserJoin,OnUserJoin(user,Ptr));
return Ptr;
}
@@ -406,7 +406,7 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool
if (!Ptr)
return NULL;
- FOREACH_MOD OnUserPart(user,Ptr);
+ FOREACH_MOD(I_OnUserPart,OnUserPart(user,Ptr));
log(DEBUG,"del_channel: removing: %s %s",user->nick,Ptr->name);
for (unsigned int i =0; i < user->chans.size(); i++)
@@ -473,7 +473,7 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason)
}
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(src,user,Ptr,AC_KICK));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,Ptr,AC_KICK));
if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
return;
@@ -497,12 +497,12 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason)
if (!is_uline(src->server))
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreKick(src,user,Ptr,reason));
+ FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,Ptr,reason));
if (MOD_RESULT)
return;
}
- FOREACH_MOD OnUserKick(src,user,Ptr,reason);
+ FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,Ptr,reason));
for (unsigned int i =0; i < user->chans.size(); i++)
{
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index bab583311..7927dcad1 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -52,7 +52,7 @@ void cmd_eline::Handle (char **parameters, int pcnt, userrec *user)
if (host_matches_everyone(parameters[0],user))
return;
add_eline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD OnAddELine(duration(parameters[1]), user, parameters[2], parameters[0]);
+ FOREACH_MOD(I_OnAddELine,OnAddELine(duration(parameters[1]), user, parameters[2], parameters[0]));
if (!duration(parameters[1]))
{
WriteOpers("*** %s added permenant E-line for %s.",user->nick,parameters[0]);
@@ -66,7 +66,7 @@ void cmd_eline::Handle (char **parameters, int pcnt, userrec *user)
{
if (del_eline(parameters[0]))
{
- FOREACH_MOD OnDelELine(user, parameters[0]);
+ FOREACH_MOD(I_OnDelELine,OnDelELine(user, parameters[0]));
WriteOpers("*** %s Removed E-line on %s.",user->nick,parameters[0]);
}
else
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 35cf82d88..f3d8ee170 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -52,7 +52,7 @@ void cmd_gline::Handle (char **parameters, int pcnt, userrec *user)
if (host_matches_everyone(parameters[0],user))
return;
add_gline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD OnAddGLine(duration(parameters[1]), user, parameters[2], parameters[0]);
+ FOREACH_MOD(I_OnAddGLine,OnAddGLine(duration(parameters[1]), user, parameters[2], parameters[0]));
if (!duration(parameters[1]))
{
WriteOpers("*** %s added permenant G-line for %s.",user->nick,parameters[0]);
@@ -67,7 +67,7 @@ void cmd_gline::Handle (char **parameters, int pcnt, userrec *user)
{
if (del_gline(parameters[0]))
{
- FOREACH_MOD OnDelGLine(user, parameters[0]);
+ FOREACH_MOD(I_OnDelGLine,OnDelGLine(user, parameters[0]));
WriteOpers("*** %s Removed G-line on %s.",user->nick,parameters[0]);
}
else
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index 77c7c7782..0f9abf8d5 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -74,7 +74,7 @@ void cmd_info::Handle (char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"371 %s :this software.",user->nick);
WriteServ(user->fd,"371 %s : ",user->nick);
WriteServ(user->fd,"371 %s :Best experienced with: An IRC client.",user->nick);
- FOREACH_MOD OnInfo(user);
+ FOREACH_MOD(I_OnInfo,OnInfo(user));
WriteServ(user->fd,"374 %s :End of /INFO list",user->nick);
}
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 931c684ce..b99f80db4 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -84,7 +84,7 @@ void cmd_invite::Handle (char **parameters, int pcnt, userrec *user)
}
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreInvite(user,u,c));
+ FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c));
if (MOD_RESULT == 1) {
return;
}
@@ -93,7 +93,7 @@ void cmd_invite::Handle (char **parameters, int pcnt, userrec *user)
u->InviteTo(xname);
WriteFrom(u->fd,user,"INVITE %s :%s",u->nick,c->name);
WriteServ(user->fd,"341 %s %s %s",user->nick,u->nick,c->name);
- FOREACH_MOD OnUserInvite(user,u,c);
+ FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c));
}
else
{
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index 36b348c56..d79adc901 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -56,7 +56,7 @@ void cmd_kill::Handle (char **parameters, int pcnt, userrec *user)
{
log(DEBUG,"into kill mechanism");
int MOD_RESULT = 0;
- FOREACH_RESULT(OnKill(user,u,parameters[1]));
+ FOREACH_RESULT(I_OnKill,OnKill(user,u,parameters[1]));
if (MOD_RESULT) {
log(DEBUG,"A module prevented the kill with result %d",MOD_RESULT);
return;
@@ -69,7 +69,7 @@ void cmd_kill::Handle (char **parameters, int pcnt, userrec *user)
snprintf(killreason,MAXBUF,"[%s] Killed (%s (%s))",Config->ServerName,user->nick,parameters[1]);
WriteCommonExcept(u,"QUIT :%s",killreason);
- FOREACH_MOD OnRemoteKill(user,u,killreason);
+ FOREACH_MOD(I_OnRemoteKill,OnRemoteKill(user,u,killreason));
user_hash::iterator iter = clientlist.find(u->nick);
if (iter != clientlist.end())
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index a14c2bf99..32dd865fe 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -69,7 +69,7 @@ void cmd_kline::Handle (char **parameters, int pcnt, userrec *user)
if (host_matches_everyone(parameters[0],user))
return;
add_kline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD OnAddKLine(duration(parameters[1]), user, parameters[2], parameters[0]);
+ FOREACH_MOD(I_OnAddKLine,OnAddKLine(duration(parameters[1]), user, parameters[2], parameters[0]));
if (!duration(parameters[1]))
{
WriteOpers("*** %s added permenant K-line for %s.",user->nick,parameters[0]);
@@ -84,7 +84,7 @@ void cmd_kline::Handle (char **parameters, int pcnt, userrec *user)
{
if (del_kline(parameters[0]))
{
- FOREACH_MOD OnDelKLine(user, parameters[0]);
+ FOREACH_MOD(I_OnDelKLine,OnDelKLine(user, parameters[0]));
WriteOpers("*** %s Removed K-line on %s.",user->nick,parameters[0]);
}
else
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 7779926e8..dd3850342 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -104,13 +104,13 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
log(DEBUG,"old nick is new nick, not updating hash (case change only)");
strlcpy(oldnick,user->nick,NICKMAX);
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreNick(user,parameters[0]));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
if (MOD_RESULT)
return;
strlcpy(user->nick,parameters[0],NICKMAX);
if (user->registered == 7)
WriteCommon(user,"NICK %s",parameters[0]);
- FOREACH_MOD OnUserPostNick(user,oldnick);
+ FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
return;
}
else
@@ -143,7 +143,7 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
if (user->registered == 7)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnUserPreNick(user,parameters[0]));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
if (MOD_RESULT) {
// if a module returns true, the nick change is silently forbidden.
return;
@@ -190,12 +190,12 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
if (user->registered == 3)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- FOREACH_MOD OnUserRegister(user);
+ FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
ConnectUser(user);
}
if (user->registered == 7)
{
- FOREACH_MOD OnUserPostNick(user,oldnick);
+ FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
}
}
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index c3354a4fa..0f968e0db 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -101,7 +101,7 @@ void cmd_notice::Handle (char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(OnUserPreNotice(user,chan,TYPE_CHANNEL,temp));
+ FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,chan,TYPE_CHANNEL,temp));
if (MOD_RESULT) {
return;
}
@@ -115,7 +115,7 @@ void cmd_notice::Handle (char **parameters, int pcnt, userrec *user)
ChanExceptSender(chan, user, "NOTICE %s :%s", chan->name, parameters[1]);
- FOREACH_MOD OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1]);
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1]));
}
else
{
@@ -131,7 +131,7 @@ void cmd_notice::Handle (char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(OnUserPreNotice(user,dest,TYPE_USER,temp));
+ FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,dest,TYPE_USER,temp));
if (MOD_RESULT) {
return;
}
@@ -143,7 +143,7 @@ void cmd_notice::Handle (char **parameters, int pcnt, userrec *user)
WriteTo(user, dest, "NOTICE %s :%s", dest->nick, parameters[1]);
}
- FOREACH_MOD OnUserNotice(user,dest,TYPE_USER,parameters[1]);
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,parameters[1]));
}
else
{
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index f5610c485..8ca165fa7 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -114,7 +114,7 @@ void cmd_oper::Handle (char **parameters, int pcnt, userrec *user)
{
strcat(user->modes,"o");
WriteServ(user->fd,"MODE %s :+o",user->nick);
- FOREACH_MOD OnOper(user,OperType);
+ FOREACH_MOD(I_OnOper,OnOper(user,OperType));
log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,OperType);
AddOper(user);
}
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 0e4003c2e..45a1e9dbc 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -101,7 +101,7 @@ void cmd_privmsg::Handle (char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(OnUserPreMessage(user,chan,TYPE_CHANNEL,temp));
+ FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,chan,TYPE_CHANNEL,temp));
if (MOD_RESULT) {
return;
}
@@ -114,7 +114,7 @@ void cmd_privmsg::Handle (char **parameters, int pcnt, userrec *user)
}
ChanExceptSender(chan, user, "PRIVMSG %s :%s", chan->name, parameters[1]);
- FOREACH_MOD OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1]);
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1]));
}
else
{
@@ -136,7 +136,7 @@ void cmd_privmsg::Handle (char **parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(OnUserPreMessage(user,dest,TYPE_USER,temp));
+ FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,dest,TYPE_USER,temp));
if (MOD_RESULT) {
return;
}
@@ -148,7 +148,7 @@ void cmd_privmsg::Handle (char **parameters, int pcnt, userrec *user)
WriteTo(user, dest, "PRIVMSG %s :%s", dest->nick, parameters[1]);
}
- FOREACH_MOD OnUserMessage(user,dest,TYPE_USER,parameters[1]);
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,parameters[1]));
}
else
{
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index ff43a6411..2b1361fcc 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -52,7 +52,7 @@ void cmd_qline::Handle (char **parameters, int pcnt, userrec *user)
if (nick_matches_everyone(parameters[0],user))
return;
add_qline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD OnAddQLine(duration(parameters[1]), user, parameters[2], parameters[0]);
+ FOREACH_MOD(I_OnAddQLine,OnAddQLine(duration(parameters[1]), user, parameters[2], parameters[0]));
if (!duration(parameters[1]))
{
WriteOpers("*** %s added permenant Q-line for %s.",user->nick,parameters[0]);
@@ -67,7 +67,7 @@ void cmd_qline::Handle (char **parameters, int pcnt, userrec *user)
{
if (del_qline(parameters[0]))
{
- FOREACH_MOD OnDelQLine(user, parameters[0]);
+ FOREACH_MOD(I_OnDelQLine,OnDelQLine(user, parameters[0]));
WriteOpers("*** %s Removed Q-line on %s.",user->nick,parameters[0]);
}
else
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index 0b7357417..6f83be574 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -97,7 +97,7 @@ void cmd_quit::Handle (char **parameters, int pcnt, userrec *user)
WriteOpers("*** Client exiting at %s: %s!%s@%s [%s]",user->server,user->nick,user->ident,user->host,parameters[0]);
WriteCommonExcept(user,"QUIT :%s",parameters[0]);
}
- FOREACH_MOD OnUserQuit(user,std::string(Config->PrefixQuit)+std::string(parameters[0]));
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,std::string(Config->PrefixQuit)+std::string(parameters[0])));
}
else
@@ -105,13 +105,13 @@ void cmd_quit::Handle (char **parameters, int pcnt, userrec *user)
Write(user->fd,"ERROR :Closing link (%s@%s) [QUIT]",user->ident,user->host);
WriteOpers("*** Client exiting: %s!%s@%s [Client exited]",user->nick,user->ident,user->host);
WriteCommonExcept(user,"QUIT :Client exited");
- FOREACH_MOD OnUserQuit(user,"Client exited");
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,"Client exited"));
}
AddWhoWas(user);
}
- FOREACH_MOD OnUserDisconnect(user);
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
/* push the socket on a stack of sockets due to be closed at the next opportunity */
if (user->fd > -1)
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index c18963db5..16fe3e058 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -75,7 +75,7 @@ void cmd_rehash::Handle (char **parameters, int pcnt, userrec *user)
WriteOpers("%s is rehashing config file %s",user->nick,CleanFilename(CONFIG_FILE));
Config->Read(false,user);
}
- FOREACH_MOD OnRehash(parameter);
+ FOREACH_MOD(I_OnRehash,OnRehash(parameter));
}
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index d45ce68d9..4a7547a3a 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -85,7 +85,7 @@ void cmd_stats::Handle (char **parameters, int pcnt, userrec *user)
}
- FOREACH_MOD OnStats(*parameters[0]);
+ FOREACH_MOD(I_OnStats,OnStats(*parameters[0]));
if (*parameters[0] == 'c')
{
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index 2cb646323..644c9ccc3 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -123,7 +123,7 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user)
if (user->fd > -1)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnLocalTopicChange(user,Ptr,topic));
+ FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
if (MOD_RESULT)
return;
}
@@ -134,7 +134,7 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user)
WriteChannel(Ptr,user,"TOPIC %s :%s",Ptr->name, Ptr->topic);
if (user->fd > -1)
{
- FOREACH_MOD OnPostLocalTopicChange(user,Ptr,topic);
+ FOREACH_MOD(I_OnPostLocalTopicChange,OnPostLocalTopicChange(user,Ptr,topic));
}
}
else
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 4e09d60ee..8c2b4fe64 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -91,7 +91,7 @@ void cmd_user::Handle (char **parameters, int pcnt, userrec *user)
if (user->registered == 3)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- FOREACH_MOD OnUserRegister(user);
+ FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
ConnectUser(user);
}
}
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index 6cb7e00aa..8cd1c60c5 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -65,7 +65,7 @@ extern userrec* fd_ref_table[65536];
void cmd_wallops::Handle (char **parameters, int pcnt, userrec *user)
{
WriteWallOps(user,false,"%s",parameters[0]);
- FOREACH_MOD OnWallops(user,parameters[0]);
+ FOREACH_MOD(I_OnWallops,OnWallops(user,parameters[0]));
}
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 45a4717db..99be92980 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -57,7 +57,7 @@ void cmd_zline::Handle (char **parameters, int pcnt, userrec *user)
if (ip_matches_everyone(parameters[0],user))
return;
add_zline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
- FOREACH_MOD OnAddZLine(duration(parameters[1]), user, parameters[2], parameters[0]);
+ FOREACH_MOD(I_OnAddZLine,OnAddZLine(duration(parameters[1]), user, parameters[2], parameters[0]));
if (!duration(parameters[1]))
{
WriteOpers("*** %s added permenant Z-line for %s.",user->nick,parameters[0]);
@@ -72,7 +72,7 @@ void cmd_zline::Handle (char **parameters, int pcnt, userrec *user)
{
if (del_zline(parameters[0]))
{
- FOREACH_MOD OnDelZLine(user, parameters[0]);
+ FOREACH_MOD(I_OnDelZLine,OnDelZLine(user, parameters[0]));
WriteOpers("*** %s Removed Z-line on %s.",user->nick,parameters[0]);
}
else
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index ff25ec878..76b4a44de 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -527,7 +527,7 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
}
int MOD_RESULT = 0;
- FOREACH_RESULT(OnPreCommand(command,command_p,items,user,false));
+ FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false));
if (MOD_RESULT == 1) {
return;
}
@@ -596,7 +596,7 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
}
int MOD_RESULT = 0;
- FOREACH_RESULT(OnPreCommand(command,command_p,items,user,true));
+ FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true));
if (MOD_RESULT == 1) {
return;
}
diff --git a/src/commands.cpp b/src/commands.cpp
index ccdb40858..b3b9d41ac 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -158,7 +158,7 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
}
if ((!signon) && (!idle))
{
- FOREACH_MOD OnWhois(user,dest);
+ FOREACH_MOD(I_OnWhois,OnWhois(user,dest));
}
if (!strcasecmp(user->server,dest->server))
{
@@ -202,7 +202,7 @@ bool is_uline(const char* server)
int operstrcmp(char* data,char* input)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnOperCompare(data,input))
+ FOREACH_RESULT(I_OnOperCompare,OnOperCompare(data,input))
log(DEBUG,"operstrcmp: %d",MOD_RESULT);
if (MOD_RESULT == 1)
return 0;
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 3bc2bb79a..71840a22a 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -366,7 +366,7 @@ void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...)
std::string GetServerDescription(char* servername)
{
std::string description = "";
- FOREACH_MOD OnGetServerDescription(servername,description);
+ FOREACH_MOD(I_OnGetServerDescription,OnGetServerDescription(servername,description));
if (description != "")
{
return description;
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index e65816f48..33190e171 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -67,6 +67,7 @@ int WHOWAS_MAX = 100; // default 100 people maximum in the WHOWAS list
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
+
std::vector<InspSocket*> module_sockets;
std::vector<userrec*> local_users;
@@ -293,7 +294,7 @@ bool InspIRCd::UnloadModule(const char* filename)
{
modules[j]->OnCleanup(TYPE_USER,u->second);
}
- FOREACH_MOD OnUnloadModule(modules[j],Config->module_names[j]);
+ FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(modules[j],Config->module_names[j]));
// found the module
log(DEBUG,"Deleting module...");
erase_module(j);
@@ -358,6 +359,7 @@ bool InspIRCd::LoadModule(const char* filename)
/* save the module and the module's classfactory, if
* this isnt done, random crashes can occur :/ */
Config->module_names.push_back(filename);
+ modules[MODCOUNT+1]->Implements(Config->implement_lists[MODCOUNT+1]);
}
else
{
@@ -375,7 +377,7 @@ bool InspIRCd::LoadModule(const char* filename)
}
#endif
MODCOUNT++;
- FOREACH_MOD OnLoadModule(modules[MODCOUNT],filename_str);
+ FOREACH_MOD(I_OnLoadModule,OnLoadModule(modules[MODCOUNT],filename_str));
return true;
}
@@ -430,7 +432,7 @@ int InspIRCd::Run()
if (((TIME % 8) == 0) && (!expire_run))
{
expire_lines();
- FOREACH_MOD OnBackgroundTimer(TIME);
+ FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME));
expire_run = true;
continue;
}
diff --git a/src/message.cpp b/src/message.cpp
index de6e012ac..264871623 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -146,7 +146,7 @@ void chop(char* str)
return;
}
string temp = str;
- FOREACH_MOD OnServerRaw(temp,false,NULL);
+ FOREACH_MOD(I_OnServerRaw,OnServerRaw(temp,false,NULL));
const char* str2 = temp.c_str();
snprintf(str,MAXBUF,"%s",str2);
if (strlen(str) >= 511)
@@ -213,10 +213,10 @@ void ChangeName(userrec* user, const char* gecos)
if (user->fd > -1)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnChangeLocalUserGECOS(user,gecos));
+ FOREACH_RESULT(I_OnChangeLocalUserGECOS,OnChangeLocalUserGECOS(user,gecos));
if (MOD_RESULT)
return;
- FOREACH_MOD OnChangeName(user,gecos);
+ FOREACH_MOD(I_OnChangeName,OnChangeName(user,gecos));
}
strlcpy(user->fullname,gecos,MAXBUF);
}
@@ -226,10 +226,10 @@ void ChangeDisplayedHost(userrec* user, const char* host)
if (user->fd > -1)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnChangeLocalUserHost(user,host));
+ FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(user,host));
if (MOD_RESULT)
return;
- FOREACH_MOD OnChangeHost(user,host);
+ FOREACH_MOD(I_OnChangeHost,OnChangeHost(user,host));
}
strlcpy(user->dhost,host,160);
}
diff --git a/src/mode.cpp b/src/mode.cpp
index 83e79c243..e1bfe56e2 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -81,7 +81,7 @@ char* ModeParser::GiveOps(userrec *user,char *dest,chanrec *chan,int status)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_OP));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_OP));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -141,7 +141,7 @@ char* ModeParser::GiveHops(userrec *user,char *dest,chanrec *chan,int status)
else
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_HALFOP));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_HALFOP));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -197,7 +197,7 @@ char* ModeParser::GiveVoice(userrec *user,char *dest,chanrec *chan,int status)
else
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_VOICE));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_VOICE));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -255,7 +255,7 @@ char* ModeParser::TakeOps(userrec *user,char *dest,chanrec *chan,int status)
else
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_DEOP));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEOP));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -312,7 +312,7 @@ char* ModeParser::TakeHops(userrec *user,char *dest,chanrec *chan,int status)
else
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_DEHALFOP));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEHALFOP));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -369,7 +369,7 @@ char* ModeParser::TakeVoice(userrec *user,char *dest,chanrec *chan,int status)
else
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,d,chan,AC_DEVOICE));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEVOICE));
if (MOD_RESULT == ACR_DENY)
return NULL;
@@ -445,7 +445,7 @@ char* ModeParser::AddBan(userrec *user,char *dest,chanrec *chan,int status)
log(DEBUG,"AddBan: %s %s",chan->name,user->nick);
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAddBan(user,chan,dest));
+ FOREACH_RESULT(I_OnAddBan,OnAddBan(user,chan,dest));
if (MOD_RESULT)
return NULL;
@@ -479,7 +479,7 @@ char* ModeParser::TakeBan(userrec *user,char *dest,chanrec *chan,int status)
if (!strcasecmp(i->data,dest))
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnDelBan(user,chan,dest));
+ FOREACH_RESULT(I_OnDelBan,OnDelBan(user,chan,dest));
if (MOD_RESULT)
return NULL;
chan->bans.erase(i);
@@ -562,7 +562,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,NULL,chan,AC_GENERAL_MODE));
+ FOREACH_RESULT(I_OnAccessCheck(user,NULL,chan,AC_GENERAL_MODE));
if (MOD_RESULT == ACR_DENY)
return;
@@ -633,7 +633,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (mdir == 1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'o', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'o', parameters[param], true, 1));
if (!MOD_RESULT)
{
log(DEBUG,"calling GiveOps");
@@ -644,7 +644,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
else
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'o', parameters[param], false, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'o', parameters[param], false, 1));
if (!MOD_RESULT)
{
log(DEBUG,"calling TakeOps");
@@ -664,7 +664,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (mdir == 1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'h', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'h', parameters[param], true, 1));
if (!MOD_RESULT)
{
r = GiveHops(user,parameters[param++],chan,status);
@@ -674,7 +674,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
else
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'h', parameters[param], false, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'h', parameters[param], false, 1));
if (!MOD_RESULT)
{
r = TakeHops(user,parameters[param++],chan,status);
@@ -694,7 +694,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (mdir == 1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'v', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'v', parameters[param], true, 1));
if (!MOD_RESULT)
{
r = GiveVoice(user,parameters[param++],chan,status);
@@ -704,7 +704,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
else
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'v', parameters[param], false, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'v', parameters[param], false, 1));
if (!MOD_RESULT)
{
r = TakeVoice(user,parameters[param++],chan,status);
@@ -723,7 +723,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (mdir == 1)
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'b', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'b', parameters[param], true, 1));
if (!MOD_RESULT)
{
r = AddBan(user,parameters[param++],chan,status);
@@ -733,7 +733,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
else
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'b', parameters[param], false, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'b', parameters[param], false, 1));
if (!MOD_RESULT)
{
r = TakeBan(user,parameters[param++],chan,status);
@@ -764,7 +764,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (!strcmp(chan->key,""))
{
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'k', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'k', parameters[param], true, 1));
if (!MOD_RESULT)
{
strcat(outlist,"k");
@@ -787,7 +787,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
char key[MAXBUF];
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'k', parameters[param], false, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'k', parameters[param], false, 1));
if (!MOD_RESULT)
{
strlcpy(key,parameters[param++],32);
@@ -810,7 +810,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
break;
previously_unset_l = true;
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'l', "", false, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'l', "", false, 0));
if (!MOD_RESULT)
{
if (chan->limit)
@@ -846,7 +846,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
break;
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'l', parameters[param], true, 1));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'l', parameters[param], true, 1));
if (!MOD_RESULT)
{
@@ -868,7 +868,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 'i':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'i', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'i', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -886,7 +886,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 't':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 't', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 't', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -904,7 +904,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 'n':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'n', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'n', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -922,7 +922,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 'm':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'm', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'm', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -940,7 +940,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 's':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 's', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 's', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -966,7 +966,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
case 'p':
MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, chan, 'p', "", mdir, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'p', "", mdir, 0));
if (!MOD_RESULT)
{
if (mdir)
@@ -1036,7 +1036,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
std::string para = "";
if (p.size())
para = p[0];
- FOREACH_RESULT(OnRawMode(user, chan, modechar, para, mdir, pcnt));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, modechar, para, mdir, pcnt));
if (!MOD_RESULT)
{
for (int i = 0; i <= MODCOUNT; i++)
@@ -1121,7 +1121,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
log(DEBUG,"Local mode change");
WriteChannelLocal(chan, user, "MODE %s %s",chan->name,outstr);
- FOREACH_MOD OnMode(user, chan, TYPE_CHANNEL, outstr);
+ FOREACH_MOD(I_OnMode,OnMode(user, chan, TYPE_CHANNEL, outstr));
}
else
{
@@ -1138,7 +1138,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (!silent)
{
WriteChannel(chan,user,"MODE %s %s",chan->name,outstr);
- FOREACH_MOD OnMode(user, chan, TYPE_CHANNEL, outstr);
+ FOREACH_MOD(I_OnMode,OnMode(user, chan, TYPE_CHANNEL, outstr));
}
}
}
@@ -1365,7 +1365,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
outpars[r] = parameters[1][i];
if (parameters[1][i] == 'o')
{
- FOREACH_MOD OnGlobalOper(dest);
+ FOREACH_MOD(I_OnGlobalOper,OnGlobalOper(dest));
}
}
}
@@ -1443,7 +1443,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
if (strcmp(b,""))
{
WriteTo(user, dest, "MODE %s :%s", dest->nick, b);
- FOREACH_MOD OnMode(user, dest, TYPE_USER, b);
+ FOREACH_MOD(I_OnMode,OnMode(user, dest, TYPE_USER, b));
}
if (strlen(dmodes)>MAXMODES)
@@ -1476,7 +1476,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
if (*mode == '+')
mode++;
int MOD_RESULT = 0;
- FOREACH_RESULT(OnRawMode(user, Ptr, *mode, "", false, 0));
+ FOREACH_RESULT(I_OnRawMode,OnRawMode(user, Ptr, *mode, "", false, 0));
if (!MOD_RESULT)
{
if (*mode == 'b')
@@ -1493,7 +1493,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
{
// list of items for an extmode
log(DEBUG,"Calling OnSendList for all modules, list output for mode %c",*mode);
- FOREACH_MOD OnSendList(user,Ptr,*mode);
+ FOREACH_MOD(I_OnSendList,OnSendList(user,Ptr,*mode));
return;
}
}
@@ -1508,7 +1508,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
if (Ptr)
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,NULL,Ptr,AC_GENERAL_MODE));
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,NULL,Ptr,AC_GENERAL_MODE));
if (MOD_RESULT == ACR_DENY)
return;
@@ -1697,7 +1697,7 @@ void ModeParser::ServerMode(char **parameters, int pcnt, userrec *user)
if (strcmp(b,""))
{
WriteTo(user, dest, "MODE %s :%s", dest->nick, b);
- FOREACH_MOD OnMode(user, dest, TYPE_USER, b);
+ FOREACH_MOD(I_OnMode,OnMode(user, dest, TYPE_USER, b));
}
if (strlen(dmodes)>MAXMODES)
diff --git a/src/modules.cpp b/src/modules.cpp
index c175d7a57..01aef0802 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -204,7 +204,7 @@ Module* Event::GetSource()
char* Event::Send()
{
- FOREACH_MOD OnEvent(this);
+ FOREACH_MOD(I_OnEvent,OnEvent(this));
return NULL;
}
@@ -296,6 +296,7 @@ void Module::OnDelKLine(userrec* source, std::string hostmask) { };
void Module::OnDelQLine(userrec* source, std::string nickmask) { };
void Module::OnDelELine(userrec* source, std::string hostmask) { };
void Module::OnCleanup(int target_type, void* item) { };
+void Module::Implements(bool &Implements[255]) { for (int j = 0; j < 255; j++) Implements[j] = false; };
/* server is a wrapper class that provides methods to all of the C-style
* exports in the core
diff --git a/src/users.cpp b/src/users.cpp
index 9abd2df35..a9f927f3f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -2,7 +2,7 @@
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ * Inspire is copyright (C) 2002-2006 ChatSpike-Dev.
* E-mail:
* <brain@chatspike.net>
* <Craig@chatspike.net>
@@ -353,13 +353,13 @@ void kill_link(userrec *user,const char* r)
log(DEBUG,"closing fd %lu",(unsigned long)user->fd);
if (user->registered == 7) {
- FOREACH_MOD OnUserQuit(user,reason);
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,reason));
WriteCommonExcept(user,"QUIT :%s",reason);
}
user->FlushWriteBuf();
- FOREACH_MOD OnUserDisconnect(user);
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
if (user->fd > -1)
{
@@ -418,11 +418,11 @@ void kill_link_silent(userrec *user,const char* r)
user->FlushWriteBuf();
if (user->registered == 7) {
- FOREACH_MOD OnUserQuit(user,reason);
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,reason));
WriteCommonExcept(user,"QUIT :%s",reason);
}
- FOREACH_MOD OnUserDisconnect(user);
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
if (user->fd > -1)
{
@@ -686,7 +686,7 @@ void FullConnectUser(userrec* user)
v << " TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=20 AWAYLEN=" << MAXAWAY << " CHANMODES=ohvb,k,l,psmnti NETWORK=";
v << Config->Network;
std::string data005 = v.str();
- FOREACH_MOD On005Numeric(data005);
+ FOREACH_MOD(I_On005Numeric,On005Numeric(data005));
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
// so i'd better split it :)
std::stringstream out(data005);
@@ -709,8 +709,8 @@ void FullConnectUser(userrec* user)
// fix 3 by brain, move registered = 7 below these so that spurious modes and host changes dont go out
// onto the network and produce 'fake direction'
- FOREACH_MOD OnUserConnect(user);
- FOREACH_MOD OnGlobalConnect(user);
+ FOREACH_MOD(I_OnUserConnect,OnUserConnect(user));
+ FOREACH_MOD(I_OnGlobalConnect,OnGlobalConnect(user));
user->registered = 7;
WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,user->ip);
}
@@ -762,7 +762,7 @@ void force_nickchange(userrec* user,const char* newnick)
*nick = 0;
- FOREACH_RESULT(OnUserPreNick(user,newnick));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,newnick));
if (MOD_RESULT) {
ServerInstance->stats->statsCollisions++;
kill_link(user,"Nickname collision");