summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorEric Abrahamsen <eric@ericabrahamsen.net>2021-05-03 09:14:24 -0700
committerEric Abrahamsen <eric@ericabrahamsen.net>2021-05-04 16:34:29 -0700
commitaeada12ebb1bf431af6f2b35424d732b632f305e (patch)
tree9ad0fca722914fa43927ecdd610fe33c666e0cf6 /lisp/gnus
parent3783e7fb4dbf4ed9620d6e3d54ef3462331e6660 (diff)
downloademacs-aeada12ebb1bf431af6f2b35424d732b632f305e.tar.gz
emacs-aeada12ebb1bf431af6f2b35424d732b632f305e.tar.bz2
emacs-aeada12ebb1bf431af6f2b35424d732b632f305e.zip
Add new defvoo nnimap-keepalive-intervals to Gnus nnimap servers
* lisp/gnus/nnimap.el (nnimap-keepalive-intervals): New per-server config for customizing when keepalive commands are sent. (nnimap-keepalive, nnimap-open-connection-1): Consult in these places. Additionally, use nnimap-streaming -> t when sending the keepalive NOOP, so we don't wait for the response. * doc/misc/gnus.texi (Customizing the IMAP Connection): Document.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/nnimap.el26
1 files changed, 20 insertions, 6 deletions
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 8990b2bebeb..570be49094f 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -136,6 +136,16 @@ will fetch all parts that have types that match that string. A
likely value would be \"text/\" to automatically fetch all
textual parts.")
+(defvoo nnimap-keepalive-intervals (cons (* 60 15)
+ (* 60 5))
+ "Configuration for the nnimap keepalive timer.
+The value is a cons of two integers (each representing a number
+of seconds): the first is how often to run the keepalive
+function, the second is the seconds of inactivity required to
+send the actual keepalive command.
+
+Set to nil to disable keepalive commands altogether.")
+
(defgroup nnimap nil
"IMAP for Gnus."
:group 'gnus)
@@ -405,15 +415,16 @@ during splitting, which may be slow."
nil)))
(defun nnimap-keepalive ()
- (let ((now (current-time)))
+ (let ((now (current-time))
+ ;; Set this so we don't wait for a response.
+ (nnimap-streaming t))
(dolist (buffer nnimap-process-buffers)
(when (buffer-live-p buffer)
(with-current-buffer buffer
(when (and nnimap-object
(nnimap-last-command-time nnimap-object)
(time-less-p
- ;; More than five minutes since the last command.
- (* 5 60)
+ (cdr nnimap-keepalive-intervals)
(time-subtract
now
(nnimap-last-command-time nnimap-object))))
@@ -448,9 +459,12 @@ during splitting, which may be slow."
port))
(defun nnimap-open-connection-1 (buffer)
- (unless nnimap-keepalive-timer
- (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15)
- #'nnimap-keepalive)))
+ (unless (or nnimap-keepalive-timer
+ (null nnimap-keepalive-intervals))
+ (setq nnimap-keepalive-timer (run-at-time
+ (car nnimap-keepalive-intervals)
+ (car nnimap-keepalive-intervals)
+ #'nnimap-keepalive)))
(with-current-buffer (nnimap-make-process-buffer buffer)
(let* ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)