#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 */
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;
*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++)
{
msptr = find_channel_membership(chptr, source_p);
- /* Finish the flood grace period... */
- if(MyClient(source_p) && !IsFloodDone(source_p))
- {
- if(!((parc == 3) && (parv[2][0] == 'b' || parv[2][0] == 'q') && (parv[2][1] == '\0')))
- flood_endgrace(source_p);
- }
-
set_channel_mode(client_p, source_p, chptr, msptr, parc - n, parv + n);
}
}