[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Faster/Multiserver Fix/UIDNEXT Revert
1998-08-12 Jim Radford <radford@robby.caltech.edu>
* imap4rev1.el (imap-parse-line):
* nnimap.el (nnimap-request-accept-article): I shouldn't have
allowed for large UIDNEXTs. We can't deal with large numbers
(UIDS) and until we can do it, it is pointless to quote them.
* nnimap.el (nnimap-retrieve-groups): Revive/rewrite. This
function gets called instead of nnimap-request-list when
gnus-read-active-file is 'some. This will speed things up, since
you shouldn't have to open every group on the server every time
you check for mail. Just once in the beginning.
* nnimap.el: (nnimap-request-list-mapper): Generalize so that
nnimap-retrieve-groups and nnimap-request-list can call.
* nnimap.el: (nnimap-retrieve-groups): Sync call call to
nnimap-request-list-mapper.
* nnimap.el (nnimap-status-message):
* nnimap.el (nnimap-server-opened):
* nnimap.el (nnimap-close-server): Make sure to use the real
server name for calling functions even if you are passed nil,
meaning the current server. Passing nil to `nnimap-close-server'
hosed `nnimap-server-buffer' when using multiple servers. Similar
for the others.
--- nnimap-0.3.20/nnimap.el Wed Aug 12 13:58:55 1998
+++ nnimap/nnimap.el Wed Aug 12 19:31:45 1998
@@ -36,6 +36,10 @@
;;; this means that you will have to use ~/iMail/ instead of ./iMail
;;; (or similair).
+;;; Note also that you shouldn't subscribe to goups on your nnimap
+;;; server from the server buffer if the server is your primary server
+;;; i.e. in `gnus-select-method'. I think this is a bug in Gnus.
+
;;; Todo (roughly in order of priority):
;;; o Verify that we don't use IMAP4rev1 specific things (RFC2060 App B)
@@ -87,7 +91,7 @@
(eval-when-compile (require 'cl))
-(gnus-declare-backend "nnimap" 'mail 'respool 'address 'prompt-address
+(gnus-declare-backend "nnimap" 'mail 'address 'prompt-address
'physical-address)
(nnoo-declare nnimap) ; we derive from no one
@@ -394,7 +401,9 @@
nil)))))))
(deffoo nnimap-close-server (&optional server)
- (let ((s-b (assoc server nnimap-server-buffer-alist)))
+ (let ((s-b (assoc
+ (setq server (or server (nnoo-current-server 'nnimap)))
+ nnimap-server-buffer-alist)))
(when s-b
(setq nnimap-server-buffer nil)
(setq nnimap-server-buffer-alist (delq s-b nnimap-server-buffer-alist))
@@ -408,8 +417,9 @@
(setq nnimap-server-buffer-alist nil))
(deffoo nnimap-server-opened (&optional server)
- (let ((buffer (if server (cdr (assoc server nnimap-server-buffer-alist))
- nnimap-server-buffer)))
+ (let ((buffer (cdr (assoc
+ (setq server (or server (nnoo-current-server 'nnimap)))
+ nnimap-server-buffer-alist))))
(if (and (gnus-buffer-live-p buffer)
(gnus-buffer-live-p nntp-server-buffer))
(let ((running (imap-server-opened buffer)))
@@ -422,9 +432,11 @@
; (imap-server-opened nnimap-server-buffer)))
(deffoo nnimap-status-message (&optional server)
- (let ((s-b (assoc server nnimap-server-buffer-alist)))
- (when s-b
- (with-current-buffer (cdr s-b)
+ (let ((buffer (cdr (assoc
+ (setq server (or server (nnoo-current-server 'nnimap)))
+ nnimap-server-buffer-alist))))
+ (when buffer
+ (with-current-buffer buffer
(or (cdr imap-last-status)
(nnoo-status-message 'nnimap server))))))
@@ -510,6 +522,8 @@
group
(gnus-group-prefixed-name group method))))
+;;; We need to optimize for no changes i.e. doing Q. We should
+;;; not touch the server.
(deffoo nnimap-close-group (group &optional server)
(when (nnimap-possibly-change-group group server)
(with-current-buffer nnimap-server-buffer
@@ -542,11 +556,11 @@
t))))
;;; Returns: GROUP HIGHEST LOWEST [ynmxj=]
-(defun nnimap-request-list-mapper (sym)
- (unless (or (member '\\NoSelect (imap-folder-get 'flags (symbol-name sym)))
+(defun nnimap-request-list-mapper (group)
+ (unless (or (member '\\NoSelect (imap-folder-get 'flags group))
;; We ignore groups with spaces (Gnus can't handle them)
- (string-match " " (symbol-name sym)))
- (let ((group (symbol-name sym)) high)
+ (string-match " " group))
+ (let (high)
(gnus-message 7 "Generating active list, group %s" group)
(cond
((eq nnimap-group-list-speed 'slow)
@@ -606,7 +620,8 @@
(car pattern) " "
(cdr pattern)))))
(gnus-message 5 "Generating active list for %s" server)
- (mapatoms 'nnimap-request-list-mapper imap-data-folder)))
+ (mapatoms (lambda (sym) (nnimap-request-list-mapper (symbol-name sym)))
+ imap-data-folder)))
(setq nnimap-group-alist (nnmail-get-active))
t))
@@ -618,28 +633,22 @@
;;; Interface functions, optional backend functions
-
-;; Note that request-scan gets called right before this
-;; from `read-active-file'.
-;; Switch to active format to convey READ-ONLY status???
-(deffoo nnimap-retrieve-----groups (groups &optional server)
- ;; comment this function out ----- until we see if it is needed, since
- ;; it really doesn't provide accurate info
- (with-current-buffer nntp-server-buffer (erase-buffer))
+;;; This gets called instead of `nnimap-request-list' when
+;;; `gnus-read-active-file' is 'some instead of t.
+;;; Returns: GROUP HIGHEST LOWEST [ynmxj=] ???
+(deffoo nnimap-retrieve-groups (groups &optional server)
(when (nnimap-possibly-change-server server)
+ (with-current-buffer nntp-server-buffer (erase-buffer))
(with-current-buffer nnimap-server-buffer
- (while groups
- (when (nnimap-send-command-wait (concat "STATUS " (car groups)
- " (MESSAGES UIDNEXT)"))
- (let* ((uidnext (imap-folder-get 'UIDNEXT (car groups)))
- (messages (imap-folder-get 'MESSAGES (car groups))))
- (with-current-buffer nntp-server-buffer
- ;; What should I return on empty???
- (if messages
- (insert (format "211 %d 1 %d %s\n"
- messages (- uidnext 1) (car groups)))))))
- (pop groups)))
- 'group))
+ ;; Force the slow method for now since this will only be called
+ ;; for subscribed groups.
+ (let (group (nnimap-group-list-speed 'slow)) ; ???
+ (gnus-message 5 "Generating active info for certain groups on %s"
+ server)
+ (while (setq group (pop groups))
+ (nnimap-request-list-mapper group)))
+ ;; (setq nnimap-group-alist (nnmail-get-active)))
+ 'active)))
;;; I really think this should update the active-info too???
(deffoo nnimap-request-update-info (group info &optional server)
@@ -912,8 +921,7 @@
;; Optional flags,date???
(list (format "APPEND %s " group) (current-buffer))
nnimap-server-buffer))
- (let ((high (string-to-number
- (imap-folder-get 'UIDNEXT group nnimap-server-buffer))))
+ (let ((high (imap-folder-get 'UIDNEXT group nnimap-server-buffer)))
(when high
(cons group high))))))
--- nnimap-0.3.20/imap4rev1.el Wed Aug 12 06:00:15 1998
+++ nnimap/imap4rev1.el Wed Aug 12 16:53:18 1998
@@ -644,7 +644,7 @@
(mapconcat 'identity
'("\"[^\"]*\"" ; quoted strings
"\\[\\|\\]" ; [] characters
- "\\(UIDNEXT\\|UIDVALIDITY\\|APPENDUID\\) \\([0123456789]+\\)"
+ "\\(UIDVALIDITY\\|APPENDUID\\) \\([0123456789]+\\)"
"\\." ; . characters
"\\#" ; # characters
"\\\\" ; \ characters