Function: erc-set-modes

erc-set-modes is a byte-compiled function defined in erc.el.gz.

Signature

(erc-set-modes TGT MODE-STRING)

Documentation

Set the modes for the TGT provided as MODE-STRING.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-set-modes (tgt mode-string)
  "Set the modes for the TGT provided as MODE-STRING."
  (let* ((modes (erc-parse-modes mode-string))
         (add-modes (nth 0 modes))
         ;; list of triples: (mode-char 'on/'off argument)
         (arg-modes (nth 2 modes)))
    (cond ((erc-channel-p tgt); channel modes
           (let ((buf (and erc-server-process
                           (erc-get-buffer tgt erc-server-process))))
             (when buf
               (with-current-buffer buf
                 (setq erc-channel-modes add-modes)
                 (setq erc-channel-user-limit nil)
                 (setq erc-channel-key nil)
                 (while arg-modes
                   (let ((mode (nth 0 (car arg-modes)))
                         (onoff (nth 1 (car arg-modes)))
                         (arg (nth 2 (car arg-modes))))
                     (cond ((string-match "^[Ll]" mode)
                            (erc-update-channel-limit tgt onoff arg))
                           ((string-match "^[Kk]" mode)
                            (erc-update-channel-key tgt onoff arg))
                           (t nil)))
                   (setq arg-modes (cdr arg-modes)))
                 (erc-update-mode-line-buffer buf)))))
          ;; we do not keep our nick's modes yet
          ;;(t (setq erc-user-modes add-modes))
          )
    ))