summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-06-01 13:23:19 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-06-01 13:23:19 +0000
commit32cf50f38c39fb101b6ba0bc27316ac26f145a58 (patch)
treed43c4d502a623130a6692878b24d876e710035f4 /src/mode.cpp
parent06c7bb33fe210ad7ebf71c0028ca7b31707652b0 (diff)
Many linking fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1578 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 57db1d509..011fe513d 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -1173,9 +1173,14 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int
// based on sourcemodes, return true or false to determine if umode is a valid mode a user may set on themselves or others.
-bool allowed_umode(char umode, char* sourcemodes,bool adding)
+bool allowed_umode(char umode, char* sourcemodes,bool adding,bool serveroverride)
{
log(DEBUG,"Allowed_umode: %c %s",umode,sourcemodes);
+ // Servers can +o and -o arbitrarily
+ if ((serveroverride == true) && (umode == 'o'))
+ {
+ return true;
+ }
// RFC1459 specified modes
if ((umode == 'w') || (umode == 's') || (umode == 'i'))
{
@@ -1363,7 +1368,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
}
else
{
- if ((parameters[1][i] == 'i') || (parameters[1][i] == 'w') || (parameters[1][i] == 's') || (allowed_umode(parameters[1][i],user->modes,direction)))
+ if ((parameters[1][i] == 'i') || (parameters[1][i] == 'w') || (parameters[1][i] == 's') || (allowed_umode(parameters[1][i],user->modes,direction,false)))
{
can_change = 1;
}
@@ -1372,7 +1377,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
{
if (direction == 1)
{
- if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true)))
+ if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true,false)))
{
char umode = parameters[1][i];
if ((process_module_umode(umode, user, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
@@ -1392,7 +1397,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
}
else
{
- if ((allowed_umode(parameters[1][i],user->modes,false)) && (strchr(dmodes,parameters[1][i])))
+ if ((allowed_umode(parameters[1][i],user->modes,false,false)) && (strchr(dmodes,parameters[1][i])))
{
char umode = parameters[1][i];
if ((process_module_umode(umode, user, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
@@ -1632,7 +1637,7 @@ void server_mode(char **parameters, int pcnt, userrec *user)
if (direction == 1)
{
log(DEBUG,"umode %c being added",parameters[1][i]);
- if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true)))
+ if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true,true)))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -1651,7 +1656,7 @@ void server_mode(char **parameters, int pcnt, userrec *user)
{
// can only remove a mode they already have
log(DEBUG,"umode %c being removed",parameters[1][i]);
- if ((allowed_umode(parameters[1][i],user->modes,false)) && (strchr(dmodes,parameters[1][i])))
+ if ((allowed_umode(parameters[1][i],user->modes,false,true)) && (strchr(dmodes,parameters[1][i])))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -1828,7 +1833,7 @@ void merge_mode(char **parameters, int pcnt)
if (direction == 1)
{
log(DEBUG,"umode %c being added",parameters[1][i]);
- if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],"o",true)))
+ if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],"o",true,true)))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -1847,7 +1852,7 @@ void merge_mode(char **parameters, int pcnt)
{
// can only remove a mode they already have
log(DEBUG,"umode %c being removed",parameters[1][i]);
- if ((allowed_umode(parameters[1][i],"o",false)) && (strchr(dmodes,parameters[1][i])))
+ if ((allowed_umode(parameters[1][i],"o",false,true)) && (strchr(dmodes,parameters[1][i])))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -2019,7 +2024,7 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
if (direction == 1)
{
log(DEBUG,"umode %c being added",parameters[1][i]);
- if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true)))
+ if ((!strchr(dmodes,parameters[1][i])) && (allowed_umode(parameters[1][i],user->modes,true,false)))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -2039,7 +2044,7 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
{
// can only remove a mode they already have
log(DEBUG,"umode %c being removed",parameters[1][i]);
- if ((allowed_umode(parameters[1][i],user->modes,false)) && (strchr(dmodes,parameters[1][i])))
+ if ((allowed_umode(parameters[1][i],user->modes,false,false)) && (strchr(dmodes,parameters[1][i])))
{
char umode = parameters[1][i];
log(DEBUG,"umode %c is an allowed umode",umode);
@@ -2131,10 +2136,10 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
log(DEBUG,"merge_mode2: found channel %s",Ptr->name);
if (Ptr)
{
- if ((cstatus(user,Ptr) < STATUS_HOP) && (!is_uline(user->server)))
- {
- return;
- }
+ //if ((cstatus(user,Ptr) < STATUS_HOP) && (!is_uline(user->server)))
+ //{
+ // return;
+ //}
process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true);
}
}