Function: erc--server-send
erc--server-send is a byte-compiled function defined in
erc-backend.el.gz.
Signature
(erc--server-send STRING FORCE TARGET)
Documentation
Encode and send STRING to erc-server-process.
Expect STRING, FORCE, and TARGET to originate from erc-server-send.
Implementations
(erc--server-send STRING FORCE TARGET) in `erc-backend.el'.
Encode and send STRING to `erc-server-process'. Expect STRING, FORCE, and TARGET to originate from `erc-server-send'.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(cl-defmethod erc--server-send (string force target)
"Encode and send STRING to `erc-server-process'.
Expect STRING, FORCE, and TARGET to originate from `erc-server-send'."
(erc-log (concat "erc-server-send: " string "(" (buffer-name) ")"))
(setq erc-server-last-sent-time (erc-current-time))
(let ((encoding (erc-coding-system-for-target target)))
(when (consp encoding)
(setq encoding (car encoding)))
(if (erc-server-process-alive)
(erc-with-server-buffer
(let ((str (concat string "\r\n")))
(if force
(progn
(unless (eq force 'no-penalty)
(cl-incf erc-server-flood-last-message
erc-server-flood-penalty))
(erc-log-irc-protocol str 'outbound)
(condition-case nil
(progn
;; Set encoding just before sending the string
(when (fboundp 'set-process-coding-system)
(set-process-coding-system erc-server-process
'raw-text encoding))
(if (and (eq force 'no-penalty))
(run-at-time nil nil #'process-send-string
erc-server-process str)
(process-send-string erc-server-process str)))
;; See `erc-server-send-queue' for full
;; explanation of why we need this condition-case
(error nil)))
(setq erc-server-flood-queue
(append erc-server-flood-queue
(list (cons str encoding))))
(run-at-time nil nil #'erc-server-send-queue (current-buffer))))
t)
(message "ERC: No process running")
nil)))