Function: erc-cmd-MASSUNBAN

erc-cmd-MASSUNBAN is a byte-compiled function defined in erc.el.gz.

Signature

(erc-cmd-MASSUNBAN &rest ARGS)

Documentation

Remove all bans in the current channel.

Aliases

erc-cmd-MUB

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-MASSUNBAN (&rest args)
  "Remove all bans in the current channel."
  (let ((chnl (erc-default-target)))
    (cond
     ((not (erc-channel-p chnl))
      (erc-display-message nil 'notice 'active "You're not on a channel\n"))
     ((or (equal args '("-f"))
          (and (not erc--channel-banlist-synchronized-p)
               (not (get 'erc-channel-banlist 'received-from-server))))
      (erc-sync-banlist (erc--wrap-banlist-cmd #'erc-cmd-MASSUNBAN)))
     (t (let ((bans (mapcar #'cdr erc-channel-banlist)))
          (when bans
            ;; Glob the bans into groups of three, and carry out the unban.
            ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@*
            (mapc
             (lambda (x)
               (erc-server-send
                (format "MODE %s -%s %s" (erc-default-target)
                        (make-string (length x) ?b)
                        (mapconcat #'identity x " "))))
             (erc-group-list bans 3))))))
    (put 'erc-channel-banlist 'received-from-server nil)
    t))