From 576399edeb653fcbe17202823ab9bd2a92406ff8 Mon Sep 17 00:00:00 2001 From: om Date: Sun, 14 Jan 2007 19:02:28 +0000 Subject: Add return statement at the end of the special-case block for listing listmodes. Make ModeWatchers get called (with an empty parameter and adding = true) if their mode is a listmode and it gets listed git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6329 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mode.cpp b/src/mode.cpp index 1ae8dce07..fcec6096f 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -293,6 +293,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool ServerInstance->Log(DEBUG,"Spool list"); const char* mode = parameters[1]; + mask = MASK_CHANNEL; + while (mode && *mode) { if (*mode == '+') @@ -305,11 +307,25 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if ((mh) && (mh->IsListMode())) { - mh->DisplayList(user, targetchannel); + /** See below for a description of what craq this is :D + */ + unsigned char handler_id = (*mode - 65) | mask; + + for(ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) + { + std::string dummyparam; + + if((*watchers)->BeforeMode(user, NULL, targetchannel, dummyparam, true, MODETYPE_CHANNEL) == MODEACTION_ALLOW) + { + mh->DisplayList(user, targetchannel); + } + } } mode++; } + + return; } if (pcnt == 1) @@ -456,6 +472,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } bool had_parameter = !parameter.empty(); + for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) { if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == MODEACTION_DENY) -- cgit v1.2.3