Function: erc-log-irc-protocol
erc-log-irc-protocol is a byte-compiled function defined in erc.el.gz.
Signature
(erc-log-irc-protocol STRING &optional OUTBOUND)
Documentation
Append STRING to the buffer *erc-protocol*.
This only has any effect if erc-debug-irc-protocol is non-nil.
The buffer is created if it doesn't exist.
If OUTBOUND is non-nil, STRING is being sent to the IRC server and
appears in face erc-input-face in the buffer. Lines must already
contain CRLF endings. A peer is identified by the most precise label
available, starting with the session ID followed by the server-reported
hostname, and falling back to the dialed <server>:<port> pair.
When capturing logs for multiple peers and sorting them into buckets,
such inconsistent labeling may pose a problem until the MOTD is
received. Setting a fixed erc-networks--id can serve as a
workaround.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-log-irc-protocol (string &optional outbound)
"Append STRING to the buffer *erc-protocol*.
This only has any effect if `erc-debug-irc-protocol' is non-nil.
The buffer is created if it doesn't exist.
If OUTBOUND is non-nil, STRING is being sent to the IRC server and
appears in face `erc-input-face' in the buffer. Lines must already
contain CRLF endings. A peer is identified by the most precise label
available, starting with the session ID followed by the server-reported
hostname, and falling back to the dialed <server>:<port> pair.
When capturing logs for multiple peers and sorting them into buckets,
such inconsistent labeling may pose a problem until the MOTD is
received. Setting a fixed `erc-networks--id' can serve as a
workaround."
(when erc-debug-irc-protocol
(let ((esid (if-let ((erc-networks--id)
(esid (erc-networks--id-symbol erc-networks--id)))
(symbol-name esid)
(or erc-server-announced-name
(format "%s:%s" erc-session-server erc-session-port))))
(ts (when erc-debug-irc-protocol-time-format
(format-time-string erc-debug-irc-protocol-time-format))))
(when (and outbound erc--debug-irc-protocol-mask-secrets)
(setq string (erc--mask-secrets string)))
(with-current-buffer (get-buffer-create "*erc-protocol*")
(save-excursion
(goto-char (point-max))
(let ((buffer-undo-list t)
(inhibit-read-only t))
(insert (if outbound
(concat ts esid " >> " string)
;; Cope with multi-line messages
(let ((lines (split-string string "[\r\n]+" t))
result)
(dolist (line lines)
(setq result (concat result ts esid
" << " line "\r\n")))
result)))))
(let ((orig-win (selected-window))
(debug-buffer-window (get-buffer-window (current-buffer) t)))
(when debug-buffer-window
(select-window debug-buffer-window)
(when (= 1 (count-lines (point) (point-max)))
(goto-char (point-max))
(recenter -1))
(select-window orig-win)))))))