2000-03-30 Kevin L. Mitchell <klmitch@mit.edu>
+ * ircd/m_clearmode.c (do_clearmode): do_clearmode() would remove
+ +k and +l even if they weren't set...
+
+ * ircd/m_opmode.c: implement the OPMODE command using mode_parse()
+
+ * ircd/channel.c: make mode_process_clients() clear the DEOPPED
+ flag; fix +s+p exclusivity; add MODE_ADD/MODE_DEL to flag list
+ for; test the 0-th member, not the i-th member, of the client
+ change state stuff
+
* ircd/m_clearmode.c (do_clearmode): use the new
mode_invite_clear() function
#
# ChangeLog for ircu2.10.11
#
-# $Id: ChangeLog,v 1.43 2000-03-30 18:36:24 kev Exp $
+# $Id: ChangeLog,v 1.44 2000-03-30 19:57:22 kev Exp $
#
# Insert new changes at beginning of the change list.
#
struct Membership *member;
for (i = 0; state->cli_change[i].flag; i++) {
+ assert(0 != state->cli_change[i].client);
+
/* look up member link */
if (!(member = find_member_link(state->chptr,
state->cli_change[i].client)) ||
/* actually effect the change */
if (state->flags & MODE_PARSE_SET) {
- if (state->cli_change[i].flag & MODE_ADD)
+ if (state->cli_change[i].flag & MODE_ADD) {
member->status |= (state->cli_change[i].flag &
(MODE_CHANOP | MODE_VOICE));
- else
+ if (state->cli_change[i].flag & MODE_CHANOP)
+ ClearDeopped(member);
+ } else
member->status &= ~(state->cli_change[i].flag &
(MODE_CHANOP | MODE_VOICE));
}
/* make +p and +s mutually exclusive */
if (state->dir == MODE_ADD && flag_p[0] & (MODE_SECRET | MODE_PRIVATE)) {
- if (flag_p[0] == MODE_SECRET)
- modebuf_mode(state->mbuf, MODE_DEL | MODE_SECRET);
- else
+ if (flag_p[0] == MODE_SECRET && (state->chptr->mode.mode & MODE_PRIVATE))
modebuf_mode(state->mbuf, MODE_DEL | MODE_PRIVATE);
+ else if (flag_p[0] == MODE_PRIVATE &&
+ (state->chptr->mode.mode & MODE_SECRET))
+ modebuf_mode(state->mbuf, MODE_DEL | MODE_SECRET);
}
if (state->flags & MODE_PARSE_SET) { /* set the flags */
MODE_KEY, 'k',
MODE_BAN, 'b',
MODE_LIMIT, 'l',
+ MODE_ADD, '+',
+ MODE_DEL, '-',
0x0, 0x0
};
int i;
switch (*modestr) {
case '+': /* switch direction to MODE_ADD */
- state.dir = MODE_ADD;
- break;
case '-': /* switch direction to MODE_DEL */
- state.dir = MODE_DEL;
+ state.dir = flag_p[0];
break;
case 'l': /* deal with limits */
mode_process_bans(&state);
/* process client changes */
- if (state.cli_change[i].flag)
+ if (state.cli_change[0].flag)
mode_process_clients(&state);
return state.args_used; /* tell our parent how many args we gobbled */
* If we're removing the key, note that; note that we can't clear
* the key until after modebuf_* are done with it
*/
- if (del_mode & MODE_KEY)
+ if (del_mode & MODE_KEY && chptr->mode.mode & MODE_KEY)
modebuf_mode_string(&mbuf, MODE_DEL | MODE_KEY, chptr->mode.key);
/* If we're removing the limit, note that and clear the limit */
- if (del_mode & MODE_LIMIT) {
+ if (del_mode & MODE_LIMIT && chptr->mode.mode & MODE_KEY) {
modebuf_mode_uint(&mbuf, MODE_DEL | MODE_LIMIT, chptr->mode.limit);
chptr->mode.limit = 0; /* not referenced, so safe */
}
*/
int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
+ struct Channel *chptr = 0;
+ struct ModeBuf mbuf;
+
+ if (parc < 3)
+ return need_more_params(sptr, "OPMODE");
+
+ if (IsLocalChannel(parv[1]))
+ return 0;
+
+ if ('#' != *parv[1] || !(chptr = FindChannel(parv[1])))
+ return send_error_to_client(sptr, ERR_NOSUCHCHANNEL, parv[1]);
+
+ modebuf_init(&mbuf, sptr, cptr, chptr,
+ (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */
+ MODEBUF_DEST_SERVER | /* And to server */
+ MODEBUF_DEST_OPMODE | /* Use OPMODE */
+ MODEBUF_DEST_HACK4)); /* Generate a HACK(4) notice */
+
+ mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2,
+ (MODE_PARSE_SET | /* Set the modes on the channel */
+ MODE_PARSE_STRICT | /* Be strict about it */
+ MODE_PARSE_FORCE)); /* And force them to be accepted */
+
+ modebuf_flush(&mbuf); /* flush the modes */
+
return 0;
}
*/
int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
+ struct Channel *chptr = 0;
+ struct ModeBuf mbuf;
+ struct Membership *member;
+
+ if (parc < 3)
+ return need_more_params(sptr, "OPMODE");
+
+ if (('#' != *parv[1] && '&' != *parv[1]) || !(chptr = FindChannel(parv[1])))
+ return send_error_to_client(sptr, ERR_NOSUCHCHANNEL, parv[1]);
+
+ if (!(member = find_member_link(chptr, sptr)))
+ return send_error_to_client(sptr, ERR_NOTONCHANNEL, chptr->chname);
+
+ modebuf_init(&mbuf, sptr, cptr, chptr,
+ (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */
+ MODEBUF_DEST_SERVER | /* And to server */
+ MODEBUF_DEST_OPMODE | /* Use OPMODE */
+ MODEBUF_DEST_HACK4)); /* Generate a HACK(4) notice */
+
+ mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2,
+ (MODE_PARSE_SET | /* set the modes on the channel */
+ MODE_PARSE_FORCE)); /* And force them to be accepted */
+
+ modebuf_flush(&mbuf); /* flush the modes */
+
return 0;
}