summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-27 17:03:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-27 17:03:47 +0000
commitee3a514fe2e12ec326b4505e6c5bec19f074a899 (patch)
tree2614e1a39760a5089bb076e81d2de5157eac97cc /src
parent8ccfa4fa39dff91adb4f53f078deac5c1a6d2317 (diff)
Add exception lists to OnUserMessage and OnUserNotice, to be used for smarter routing of messages in spanningtree amongst other things
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5817 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_notice.cpp6
-rw-r--r--src/cmd_privmsg.cpp6
-rw-r--r--src/modules.cpp4
-rw-r--r--src/modules/m_messageflood.cpp4
-rw-r--r--src/modules/m_spanningtree.cpp17
5 files changed, 19 insertions, 18 deletions
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index c9c06ff67..385219c1e 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -52,7 +52,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
user->NoticeAll("%s",parameters[1]);
}
- FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0));
+ FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list));
return CMD_SUCCESS;
}
char status = 0;
@@ -100,7 +100,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name, parameters[1]);
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1],status));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1],status,exempt_list));
}
else
{
@@ -129,7 +129,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteTo(dest, "NOTICE %s :%s", dest->nick, parameters[1]);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,parameters[1],0));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,parameters[1],0,exempt_list));
}
else
{
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index d3d7e483e..896aa4c3e 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -54,7 +54,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
ServerInstance->ServerPrivmsgAll("%s",parameters[1]);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list));
return CMD_SUCCESS;
}
char status = 0;
@@ -100,7 +100,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
}
chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, parameters[1]);
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1],status));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1],status,except_list));
}
else
{
@@ -135,7 +135,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, parameters[1]);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,parameters[1],0));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,parameters[1],0,except_list));
}
else
{
diff --git a/src/modules.cpp b/src/modules.cpp
index a8e7a2f75..454268964 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -157,8 +157,8 @@ void Module::OnRawSocketAccept(int fd, const std::string &ip, int localport) {
int Module::OnRawSocketWrite(int fd, const char* buffer, int count) { return 0; };
void Module::OnRawSocketClose(int fd) { };
int Module::OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult) { return 0; };
-void Module::OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status) { };
-void Module::OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status) { };
+void Module::OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) { };
+void Module::OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) { };
void Module::OnRemoteKill(userrec* source, userrec* dest, const std::string &reason) { };
void Module::OnUserInvite(userrec* source,userrec* dest,chanrec* channel) { };
void Module::OnPostLocalTopicChange(userrec* user, chanrec* chan, const std::string &topic) { };
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index d01b01ad9..436e57867 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -246,7 +246,7 @@ class ModuleMsgFlood : public Module
}
}
- virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status)
+ virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
@@ -254,7 +254,7 @@ class ModuleMsgFlood : public Module
}
}
- virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status)
+ virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index b5c4ce92d..42a939a7d 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -182,7 +182,7 @@ class SpanningTreeUtilities
void AddThisServer(TreeServer* server, std::deque<TreeServer*> &list);
/** Compile a list of servers which contain members of channel c
*/
- void GetListOfServersForChannel(chanrec* c, std::deque<TreeServer*> &list);
+ void GetListOfServersForChannel(chanrec* c, std::deque<TreeServer*> &list, const CUList &exempt_list);
/** Find a server by name
*/
TreeServer* FindServer(const std::string &ServerName);
@@ -3789,12 +3789,12 @@ void SpanningTreeUtilities::AddThisServer(TreeServer* server, std::deque<TreeSer
}
/** returns a list of DIRECT servernames for a specific channel */
-void SpanningTreeUtilities::GetListOfServersForChannel(chanrec* c, std::deque<TreeServer*> &list)
+void SpanningTreeUtilities::GetListOfServersForChannel(chanrec* c, std::deque<TreeServer*> &list, const CUList &exempt_list)
{
CUList *ulist = c->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if (i->second->GetFd() < 0)
+ if ((i->second->GetFd() < 0) && (exempt_list.find(i->second) == exempt_list.end()))
{
TreeServer* best = this->BestRouteTo(i->second->server);
if (best)
@@ -3842,8 +3842,9 @@ bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, cons
chanrec* c = ServerInstance->FindChan(params[0]);
if (c)
{
+ CUList empty;
std::deque<TreeServer*> list;
- GetListOfServersForChannel(c,list);
+ GetListOfServersForChannel(c,list,empty);
unsigned int lsize = list.size();
for (unsigned int i = 0; i < lsize; i++)
{
@@ -4783,7 +4784,7 @@ class ModuleSpanningTree : public Module
}
}
- virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status)
+ virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
{
if (target_type == TYPE_USER)
{
@@ -4808,7 +4809,7 @@ class ModuleSpanningTree : public Module
if (status)
cname = status + cname;
std::deque<TreeServer*> list;
- Utils->GetListOfServersForChannel(c,list);
+ Utils->GetListOfServersForChannel(c,list,exempt_list);
unsigned int ucount = list.size();
for (unsigned int i = 0; i < ucount; i++)
{
@@ -4832,7 +4833,7 @@ class ModuleSpanningTree : public Module
}
}
- virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status)
+ virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
{
if (target_type == TYPE_USER)
{
@@ -4859,7 +4860,7 @@ class ModuleSpanningTree : public Module
if (status)
cname = status + cname;
std::deque<TreeServer*> list;
- Utils->GetListOfServersForChannel(c,list);
+ Utils->GetListOfServersForChannel(c,list,exempt_list);
unsigned int ucount = list.size();
for (unsigned int i = 0; i < ucount; i++)
{