diff options
| author | F. Jason Park | 2022-03-13 01:34:10 -0800 |
|---|---|---|
| committer | F. Jason Park | 2022-06-30 15:03:26 -0700 |
| commit | 873499ce065144682852643b7d0e04cd45f7eac3 (patch) | |
| tree | 1a104630f8f34e4c1a0f62b45eb654a7e2e3a72d /lisp/erc | |
| parent | c5b78a337900fd2a8d29317df7a27dd4e7006e89 (diff) | |
| download | emacs-873499ce065144682852643b7d0e04cd45f7eac3.tar.gz emacs-873499ce065144682852643b7d0e04cd45f7eac3.zip | |
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-server-send'. This fix was fast tracked and summarily
incorporated into bug#48598 because users of the soju bouncer are all
affected. See update #5 in the bug's email thread under the section
entitled "Riders" for an explanation.
Diffstat (limited to 'lisp/erc')
| -rw-r--r-- | lisp/erc/erc-backend.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 13303c71f5f..5812fa41390 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el | |||
| @@ -815,11 +815,12 @@ Use DISPLAY-FN to show the results." | |||
| 815 | (erc-split-line text))) | 815 | (erc-split-line text))) |
| 816 | 816 | ||
| 817 | ;; From Circe, with modifications | 817 | ;; From Circe, with modifications |
| 818 | (defun erc-server-send (string &optional forcep target) | 818 | (defun erc-server-send (string &optional force target) |
| 819 | "Send STRING to the current server. | 819 | "Send STRING to the current server. |
| 820 | If FORCEP is non-nil, no flood protection is done - the string is | 820 | When FORCE is non-nil, bypass flood protection so that STRING is |
| 821 | sent directly. This might cause the messages to arrive in a wrong | 821 | sent directly without modifying the queue. When FORCE is the |
| 822 | order. | 822 | symbol `no-penalty', exempt this round from accumulating a |
| 823 | timeout penalty. | ||
| 823 | 824 | ||
| 824 | If TARGET is specified, look up encoding information for that | 825 | If TARGET is specified, look up encoding information for that |
| 825 | channel in `erc-encoding-coding-alist' or | 826 | channel in `erc-encoding-coding-alist' or |
| @@ -835,11 +836,11 @@ protection algorithm." | |||
| 835 | (if (erc-server-process-alive) | 836 | (if (erc-server-process-alive) |
| 836 | (erc-with-server-buffer | 837 | (erc-with-server-buffer |
| 837 | (let ((str (concat string "\r\n"))) | 838 | (let ((str (concat string "\r\n"))) |
| 838 | (if forcep | 839 | (if force |
| 839 | (progn | 840 | (progn |
| 840 | (setq erc-server-flood-last-message | 841 | (unless (eq force 'no-penalty) |
| 841 | (+ erc-server-flood-penalty | 842 | (cl-incf erc-server-flood-last-message |
| 842 | erc-server-flood-last-message)) | 843 | erc-server-flood-penalty)) |
| 843 | (erc-log-irc-protocol str 'outbound) | 844 | (erc-log-irc-protocol str 'outbound) |
| 844 | (condition-case nil | 845 | (condition-case nil |
| 845 | (progn | 846 | (progn |
| @@ -1469,7 +1470,7 @@ add things to `%s' instead." | |||
| 1469 | (let ((pinger (car (erc-response.command-args parsed)))) | 1470 | (let ((pinger (car (erc-response.command-args parsed)))) |
| 1470 | (erc-log (format "PING: %s" pinger)) | 1471 | (erc-log (format "PING: %s" pinger)) |
| 1471 | ;; ping response to the server MUST be forced, or you can lose big | 1472 | ;; ping response to the server MUST be forced, or you can lose big |
| 1472 | (erc-server-send (format "PONG :%s" pinger) t) | 1473 | (erc-server-send (format "PONG :%s" pinger) 'no-penalty) |
| 1473 | (when erc-verbose-server-ping | 1474 | (when erc-verbose-server-ping |
| 1474 | (erc-display-message | 1475 | (erc-display-message |
| 1475 | parsed 'error proc | 1476 | parsed 'error proc |