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. Peer is identified by the most precise label available at run time, starting with the network name, followed by the announced host name, and falling back to the dialed <server>:<port>.

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.  Peer is identified by the most precise label
available at run time, starting with the network name, followed by the
announced host name, and falling back to the dialed <server>:<port>."
  (when erc-debug-irc-protocol
    (let ((esid (or (and (fboundp 'erc-network)
                         (erc-network)
                         (erc-network-name))
                    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))))
      (with-current-buffer (get-buffer-create "*erc-protocol*")
        (save-excursion
          (goto-char (point-max))
          (let ((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)))))))