[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix/bug-48598 8b7760d301 07/27: Allow exemption from flood penalty in er
From: |
F. Jason Park |
Subject: |
fix/bug-48598 8b7760d301 07/27: Allow exemption from flood penalty in erc-backend |
Date: |
Fri, 8 Apr 2022 03:06:47 -0400 (EDT) |
branch: fix/bug-48598
commit 8b7760d301a30d07e88f4eca04ab2eded36bdd08
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Allow exemption from flood penalty in erc-backend
* lisp/erc/erc-backend (erc-server-send, erc-server-PING): Change name
of param `forcep' in `erc-server-send' to `force' and change its type
to the union of the symbol `no-penalty' and the set of all other
non-nil values. In `erc-server-PING', use this exemption when calling
`erc-send-server'.
---
lisp/erc/erc-backend.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 150c430e6a..546b51c282 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -810,11 +810,11 @@ Use DISPLAY-FN to show the results."
(erc-split-line text)))
;; From Circe, with modifications
-(defun erc-server-send (string &optional forcep target)
+(defun erc-server-send (string &optional force target)
"Send STRING to the current server.
-If FORCEP is non-nil, no flood protection is done - the string is
-sent directly. This might cause the messages to arrive in a wrong
-order.
+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.
If TARGET is specified, look up encoding information for that
channel in `erc-encoding-coding-alist' or
@@ -830,11 +830,11 @@ protection algorithm."
(if (erc-server-process-alive)
(erc-with-server-buffer
(let ((str (concat string "\r\n")))
- (if forcep
+ (if force
(progn
- (setq erc-server-flood-last-message
- (+ erc-server-flood-penalty
- erc-server-flood-last-message))
+ (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
@@ -1464,7 +1464,7 @@ add things to `%s' instead."
(let ((pinger (car (erc-response.command-args parsed))))
(erc-log (format "PING: %s" pinger))
;; ping response to the server MUST be forced, or you can lose big
- (erc-server-send (format "PONG :%s" pinger) t)
+ (erc-server-send (format "PONG :%s" pinger) 'no-penalty)
(when erc-verbose-server-ping
(erc-display-message
parsed 'error proc
- branch fix/bug-48598 created (now ab2d93e564), F. Jason Park, 2022/04/08
- fix/bug-48598 b16a07dce1 03/27: Accept user keyword arg in ERC entry-point commands, F. Jason Park, 2022/04/08
- fix/bug-48598 8b7760d301 07/27: Allow exemption from flood penalty in erc-backend,
F. Jason Park <=
- fix/bug-48598 57eedf46ae 04/27: Add some ERC test helpers, F. Jason Park, 2022/04/08
- fix/bug-48598 911481d449 13/27: Add helper to determine local channels in ERC, F. Jason Park, 2022/04/08
- fix/bug-48598 eee86bc7d7 16/27: Add ERC test server and related resources, F. Jason Park, 2022/04/08
- fix/bug-48598 7cb4eec8a1 23/27: SQUASH-ME: Add ERC test scenarios for identity-aware autojoin, F. Jason Park, 2022/04/08
- fix/bug-48598 447bc23d7b 21/27: SQUASH-ME: Add ERC scenarios for identity-aware msg handlers, F. Jason Park, 2022/04/08
- fix/bug-48598 a999ff61fa 19/27: Register erc-kill-buffer-function locally, F. Jason Park, 2022/04/08
- fix/bug-48598 e0bf4383d7 24/27: Standardize auth-source queries in ERC, F. Jason Park, 2022/04/08
- fix/bug-48598 1978c3178c 10/27: Update ISUPPORT handling in ERC, F. Jason Park, 2022/04/08
- fix/bug-48598 6ee4329b46 02/27: Initialize erc-server-filter-data in erc-backend, F. Jason Park, 2022/04/08
- fix/bug-48598 3c6694d114 20/27: Don't call erc-auto-query twice on PRIVMSG, F. Jason Park, 2022/04/08