summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-09 00:34:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-09 00:34:34 +0000
commitf588391d5f3c7ca2c21f20d434dce78df5da35ce (patch)
treedefbe58d110413e83edc03d857e14660ac378cbf
parente28889304b2d2e4c0a79260a2980a2c66c8fdea5 (diff)
Changes to m_override
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5177 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modes/cmode_h.cpp5
-rw-r--r--src/modes/cmode_o.cpp5
-rw-r--r--src/modes/cmode_v.cpp5
-rw-r--r--src/modules/m_override.cpp140
4 files changed, 82 insertions, 73 deletions
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 667402ace..cb1f626b6 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -85,7 +85,10 @@ ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanr
* the return value and is always MODEACTION_DENY if the mode is supposed to have
* a parameter.
*/
- return MODEACTION_ALLOW;
+ if (parameter.length())
+ return MODEACTION_ALLOW;
+ else
+ return MODEACTION_DENY;
}
std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec *chan,int status)
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index b9fb0208b..a66818005 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -77,7 +77,10 @@ ModeAction ModeChannelOp::OnModeChange(userrec* source, userrec* dest, chanrec*
* the return value and is always MODEACTION_DENY if the mode is supposed to have
* a parameter.
*/
- return MODEACTION_ALLOW;
+ if (parameter.length())
+ return MODEACTION_ALLOW;
+ else
+ return MODEACTION_DENY;
}
std::string ModeChannelOp::AddOp(userrec *user,const char* dest,chanrec *chan,int status)
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 9fd5df7bd..497c4856f 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -76,7 +76,10 @@ ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanre
* the return value and is always MODEACTION_DENY if the mode is supposed to have
* a parameter.
*/
- return MODEACTION_ALLOW;
+ if (parameter.length())
+ return MODEACTION_ALLOW;
+ else
+ return MODEACTION_DENY;
}
std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *chan,int status)
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 7dd58d8c2..2e8ed797f 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -106,86 +106,86 @@ class ModuleOverride : public Module
// Fix by brain - allow the change if they arent on channel - rely on boolean short-circuit
// to not check the other items in the statement if they arent on the channel
int mode = channel->GetStatus(source);
- if ((!channel->HasUser(source)) || ((mode != STATUS_HOP) && (mode != STATUS_OP)))
+ switch (access_type)
{
- switch (access_type)
- {
- case AC_DEOP:
- if (CanOverride(source,"MODEDEOP"))
- {
+ case AC_DEOP:
+ if (CanOverride(source,"MODEDEOP"))
+ {
+ if ((!channel->HasUser(source)) || (mode != STATUS_OP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Deopped "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
-
- case AC_OP:
- if (CanOverride(source,"MODEOP"))
- {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
+ case AC_OP:
+ if (CanOverride(source,"MODEOP"))
+ {
+ if ((!channel->HasUser(source)) || (mode != STATUS_OP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Opped "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
-
- case AC_VOICE:
- if (CanOverride(source,"MODEVOICE"))
- {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
+ case AC_VOICE:
+ if (CanOverride(source,"MODEVOICE"))
+ {
+ if ((!channel->HasUser(source)) || (mode < STATUS_HOP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Voiced "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
-
- case AC_DEVOICE:
- if (CanOverride(source,"MODEDEVOICE"))
- {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
+ case AC_DEVOICE:
+ if (CanOverride(source,"MODEDEVOICE"))
+ {
+ if ((!channel->HasUser(source)) || (mode < STATUS_HOP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Devoiced "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
-
- case AC_HALFOP:
- if (CanOverride(source,"MODEHALFOP"))
- {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
+ case AC_HALFOP:
+ if (CanOverride(source,"MODEHALFOP"))
+ {
+ if ((!channel->HasUser(source)) || (mode != STATUS_OP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Halfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
-
- case AC_DEHALFOP:
- if (CanOverride(source,"MODEDEHALFOP"))
- {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
+ case AC_DEHALFOP:
+ if (CanOverride(source,"MODEDEHALFOP"))
+ {
+ if ((!channel->HasUser(source)) || (mode != STATUS_OP))
ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" Override-Dehalfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
- }
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
}
}
- }
- if (CanOverride(source,"OTHERMODE"))
- {
- return ACR_ALLOW;
- }
- else
- {
- return ACR_DEFAULT;
+ if (CanOverride(source,"OTHERMODE"))
+ {
+ if ((!channel->HasUser(source)) || (mode != STATUS_OP))
+ ServerInstance->SNO->WriteToSnoMask('O',"NOTICE: "+std::string(source->nick)+" changed modes on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
}
}