When FORCE is non-nil, bypass flood protection so that STRING is
sent directly without modifying the queue. When FORCE is the
symbol `no-penalty', exempt this round from accumulating a
-timeout penalty.
+timeout penalty and schedule it to run ASAP instead of blocking.
If TARGET is specified, look up encoding information for that
channel in `erc-encoding-coding-alist' or
See `erc-server-flood-margin' for an explanation of the flood
protection algorithm."
+ (erc--server-send string force target))
+
+(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 (fboundp 'set-process-coding-system)
(set-process-coding-system erc-server-process
'raw-text encoding))
- (process-send-string erc-server-process str))
+ (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))))
- (erc-server-send-queue (current-buffer))))
+ (run-at-time nil nil #'erc-server-send-queue (current-buffer))))
t)
(message "ERC: No process running")
nil)))