Function: erc-update-modes
erc-update-modes is a byte-compiled function defined in erc.el.gz.
Signature
(erc-update-modes TGT MODE-STRING &optional NICK HOST LOGIN)
Documentation
Update the mode information for TGT, provided as MODE-STRING.
Optional arguments: NICK, HOST and LOGIN - the attributes of the person who changed the modes.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-update-modes (tgt mode-string &optional _nick _host _login)
"Update the mode information for TGT, provided as MODE-STRING.
Optional arguments: NICK, HOST and LOGIN - the attributes of the
person who changed the modes."
;; FIXME: neither of nick, host, and login are used!
(let* ((modes (erc-parse-modes mode-string))
(add-modes (nth 0 modes))
(remove-modes (nth 1 modes))
;; list of triples: (mode-char 'on/'off argument)
(arg-modes (nth 2 modes)))
;; now parse the modes changes and do the updates
(cond ((erc-channel-p tgt); channel modes
(let ((buf (and erc-server-process
(erc-get-buffer tgt erc-server-process))))
(when buf
;; FIXME! This used to have an original buffer
;; variable, but it never switched back to the original
;; buffer. Is this wanted behavior?
(set-buffer buf)
(if (not (boundp 'erc-channel-modes))
(setq erc-channel-modes nil))
(while remove-modes
(setq erc-channel-modes (delete (car remove-modes)
erc-channel-modes)
remove-modes (cdr remove-modes)))
(while add-modes
(setq erc-channel-modes (cons (car add-modes)
erc-channel-modes)
add-modes (cdr add-modes)))
(setq erc-channel-modes (erc-sort-strings erc-channel-modes))
(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 "^[Vv]" mode)
(erc-update-channel-member tgt arg arg nil onoff))
((string-match "^[hH]" mode)
(erc-update-channel-member tgt arg arg nil nil onoff))
((string-match "^[oO]" mode)
(erc-update-channel-member tgt arg arg nil nil nil onoff))
((string-match "^[aA]" mode)
(erc-update-channel-member tgt arg arg nil nil nil nil onoff))
((string-match "^[qQ]" mode)
(erc-update-channel-member tgt arg arg nil nil nil nil nil onoff))
((string-match "^[Ll]" mode)
(erc-update-channel-limit tgt onoff arg))
((string-match "^[Kk]" mode)
(erc-update-channel-key tgt onoff arg))
(t nil)); only ops are tracked now
(setq arg-modes (cdr arg-modes))))
(erc-update-mode-line buf))))
;; nick modes - ignored at this point
(t nil))))