Function: erc-cmd-MASSUNBAN

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

Signature

(erc-cmd-MASSUNBAN)

Documentation

Mass Unban.

Unban all currently banned users in the current channel.

Aliases

erc-cmd-MUB

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-MASSUNBAN ()
  "Mass Unban.

Unban all currently banned users 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"))

     ((not (get 'erc-channel-banlist 'received-from-server))
      (let ((old-367-hook erc-server-367-functions))
        (setq erc-server-367-functions 'erc-banlist-store)
        ;; fetch the ban list then callback
        (erc-with-server-buffer
          (erc-once-with-server-event
           368
           (lambda (_proc _parsed)
             (with-current-buffer chnl
               (put 'erc-channel-banlist 'received-from-server t)
               (setq erc-server-367-functions old-367-hook)
               (erc-cmd-MASSUNBAN)
               t)))
          (erc-server-send (format "MODE %s b" chnl)))))

     (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))))
        t))))