#include "s_assert.h"
#include "parse.h"
#include "msgbuf.h"
+#include "packet.h"
/* bitmasks for error returns, so we send once per call */
#define SM_ERR_NOTS 0x00000001 /* No TS on channel */
static struct ChModeChange mode_changes[BUFSIZE];
static int mode_count;
-static int mode_limit;
-static int mode_limit_simple;
static int mask_pos;
static int removed_mask_pos;
if(!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
return;
}
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
return;
}
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
break;
default:
- sendto_realops_snomask(SNO_GENERAL, L_ALL, "chm_ban() called with unknown type!");
+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "chm_ban() called with unknown type!");
return;
}
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
-
- if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
/* empty ban, or starts with ':' which messes up s2s, ignore it */
if (EmptyString(arg) || *arg == ':')
return;
return;
}
- if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
if(dir == MODE_ADD)
{
if(targ_p == source_p && mstptr->flags & CHFL_CHANOP)
return;
}
- if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
if(dir == MODE_ADD)
{
mode_changes[mode_count].letter = c;
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if (EmptyString(arg) || (limit = atoi(arg)) <= 0)
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if (sscanf(arg, "%d:%d", &joins, ×lice) < 2)
}
#endif
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if(EmptyString(arg))
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
key = LOCAL_COPY(arg);
int cur_len, mlen, paralen, paracount, arglen, len;
int i, j, flags;
int dir = MODE_ADD;
- int access_dir = MODE_QUERY;
+ bool changes = false;
+ bool privileged_query = false;
int parn = 1;
int errors = 0;
int alevel;
char c;
struct Client *fakesource_p;
int flags_list[3] = { ALL_MEMBERS, ONLY_CHANOPS, ONLY_OPERS };
+ int mode_limit = 0;
+ int mode_limit_simple = 0;
mask_pos = 0;
removed_mask_pos = 0;
mode_count = 0;
- mode_limit = 0;
- mode_limit_simple = 0;
/* Hide connecting server on netburst -- jilles */
if (ConfigServerHide.flatten_links && IsServer(source_p) && !has_id(source_p) && !HasSentEob(source_p))
continue;
}
+ if (MyClient(source_p))
+ {
+ if (use_arg && ++mode_limit > MAXMODEPARAMS)
+ continue;
+ if (!use_arg && ++mode_limit_simple > MAXMODES_SIMPLE)
+ continue;
+ }
+
char op = effective_dir == MODE_ADD ? '+' :
effective_dir == MODE_DEL ? '-' :
'=';
*mbuf++ = c;
- if (effective_dir != MODE_QUERY && access_dir == MODE_QUERY)
- access_dir = effective_dir;
+ if (effective_dir != MODE_QUERY)
+ changes = true;
if (effective_dir == MODE_QUERY && cm->flags & CHM_OPS_QUERY)
- access_dir = MODE_OP_QUERY;
+ privileged_query = true;
ms->cm = cm;
ms->dir = effective_dir;
/* XXX we could reject excess params here */
}
+ /* Finish the flood grace period if we were asked to do anything */
+ if (changes && MyClient(source_p) && !IsFloodDone(source_p))
+ {
+ flood_endgrace(source_p);
+ }
+
mend = ms;
if (parn > 1)
{
*mbuf = '\0';
}
+ int access_dir = privileged_query ? MODE_OP_QUERY :
+ changes ? MODE_ADD :
+ MODE_QUERY;
alevel = get_channel_access(source_p, chptr, msptr, access_dir, modebuf);
for (ms = modesets; ms < mend; ms++)