summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-04 14:30:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-04 14:30:08 +0000
commit3759fe0ba2420bd564abb4b034582ea0866907aa (patch)
tree23b261f13410ad3fefcd74c3ee06bf21a7bc95fe /src/mode.cpp
parentc78863d6037864781670723e66be8f3fb5c68450 (diff)
Where others charge, we give for free. Have fun and use wisely. With great power comes great responsbility.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6867 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 7a31038a6..8f74f92bf 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -490,6 +490,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
{
+ ServerInstance->Log(DEBUG,"Call mode watcher");
if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == false)
{
abort = true;
@@ -506,13 +507,28 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
if (abort)
continue;
}
+ else
+ {
+ /* Fix by brain: mode watchers not being called for parameterless modes */
+ for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
+ {
+ if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == false)
+ {
+ abort = true;
+ break;
+ }
+ }
+
+ if (abort)
+ continue;
+ }
/* It's an oper only mode, check if theyre an oper. If they arent,
* eat any parameter that came with the mode, and continue to next
*/
if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!*user->oper))
{
- user->WriteServ("481 %s :Permission Denied- Only IRC operators may %sset %s mode %c", user->nick,
+ user->WriteServ("481 %s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick,
adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user",
modehandlers[handler_id]->GetModeChar());
continue;
@@ -925,6 +941,7 @@ bool ModeParser::AddModeWatcher(ModeWatcher* mw)
pos = (mw->GetModeChar()-65) | mask;
modewatchers[pos].push_back(mw);
+
return true;
}