summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-26 20:48:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-26 20:48:58 +0000
commitefa08239271572e1c8024f808d61e02c7377ab54 (patch)
treeb031c47529b6a1d602755a0af419c46f4e9a6b72 /src
parentef3fba43349ca83b7a72051218eb233ba3dc2162 (diff)
Add new event for this with gauranteed delivery of message BEFORE the text is sent out
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8376 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_notice.cpp5
-rw-r--r--src/commands/cmd_privmsg.cpp5
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/m_delayjoin.cpp15
4 files changed, 15 insertions, 11 deletions
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 9cc846dd8..1f5b854e6 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -41,6 +41,7 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
parameters[1] = temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
+ FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
user->SendAll("NOTICE", "%s", parameters[1]);
@@ -90,6 +91,8 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
return CMD_FAILURE;
}
+ FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,parameters[1],status,except_list));
+
if (status)
{
if (ServerInstance->Config->UndernetMsgPrefix)
@@ -138,6 +141,8 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
}
parameters[1] = (char*)temp.c_str();
+ FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,parameters[1],0,exempt_list));
+
if (IS_LOCAL(dest))
{
// direct write, same server
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 96aff8392..474eb4b3d 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -41,6 +41,7 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
parameters[1] = temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
+ FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
user->SendAll("PRIVMSG", "%s", parameters[1]);
@@ -91,6 +92,8 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
return CMD_FAILURE;
}
+ FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,parameters[1],status,except_list));
+
if (status)
{
if (ServerInstance->Config->UndernetMsgPrefix)
@@ -146,6 +149,8 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
}
parameters[1] = (char*)temp.c_str();
+ FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,parameters[1],0,except_list));
+
if (IS_LOCAL(dest))
{
// direct write, same server
diff --git a/src/modules.cpp b/src/modules.cpp
index e801543fb..6ef0975d6 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -196,6 +196,7 @@ int Module::OnWhoisLine(User*, User*, int&, std::string&) { return 0; }
void Module::OnBuildExemptList(MessageType, Channel*, User*, char, CUList&, const std::string&) { }
void Module::OnGarbageCollect() { }
void Module::OnBufferFlushed(User*) { }
+void Module::OnText(User*, void*, int, std::string&, char, CUList&) { }
ModuleManager::ModuleManager(InspIRCd* Ins)
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index d968f34a2..9626d9780 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -170,15 +170,15 @@ class ModuleDelayJoin : public Module
}
}
- int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ void OnText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type != TYPE_CHANNEL)
- return 0;
+ return;
Channel* channel = (Channel*) dest;
if (!user->GetExt(std::string("delayjoin_")+channel->name))
- return 0;
+ return;
/* Display the join to everyone else (the user who joined got it earlier) */
channel->WriteAllExcept(user, false, 0, exempt_list, "JOIN %s", channel->name);
@@ -191,16 +191,9 @@ class ModuleDelayJoin : public Module
*/
for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
if (f->first->IsModeSet('D'))
- return 0;
+ return;
user->Shrink("delayjoin");
-
- return 0;
- }
-
- int 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);
}
};