- /* Deop the current ops. (This will go in both directions on
- * the network, and revise the channel timestamp as it goes,
- * avoiding further traffic due to the JOIN.)
- */
- modebuf_init(&mbuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL | MODEBUF_DEST_HACK3 | MODEBUF_DEST_SERVER);
+ /* Wipe out the current modes on the channel. */
+ modebuf_init(&mbuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL | MODEBUF_DEST_HACK3);
+
+ modebuf_mode(&mbuf, MODE_DEL | chptr->mode.mode);
+ chptr->mode.mode &= MODE_BURSTADDED | MODE_WASDELJOINS;
+
+ if (chptr->mode.limit) {
+ modebuf_mode_uint(&mbuf, MODE_DEL | MODE_LIMIT, chptr->mode.limit);
+ chptr->mode.limit = 0;
+ }
+
+ if (chptr->mode.key[0]) {
+ modebuf_mode_string(&mbuf, MODE_DEL | MODE_KEY, chptr->mode.key, 0);
+ chptr->mode.key[0] = '\0';
+ }
+
+ if (chptr->mode.upass[0]) {
+ modebuf_mode_string(&mbuf, MODE_DEL | MODE_UPASS, chptr->mode.upass, 0);
+ chptr->mode.upass[0] = '\0';
+ }
+
+ if (chptr->mode.apass[0]) {
+ modebuf_mode_string(&mbuf, MODE_DEL | MODE_APASS, chptr->mode.apass, 0);
+ chptr->mode.apass[0] = '\0';
+ }
+