[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nnimap 0.127 -> 0.128 patches
- To: nnimap@extundo.com
- Subject: nnimap 0.127 -> 0.128 patches
- From: Simon Josefsson <jas@pdc.kth.se>
- Date: 12 Aug 1999 02:27:39 +0200
- User-Agent: Gnus/5.070095 (Pterodactyl Gnus v0.95) Emacs/20.4
Index: nnimap/ChangeLog
diff -u nnimap/ChangeLog:1.268 nnimap/ChangeLog:1.271
--- nnimap/ChangeLog:1.268 Sun Aug 8 18:26:59 1999
+++ nnimap/ChangeLog Wed Aug 11 17:19:02 1999
@@ -1,3 +1,34 @@
+1999-08-12 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap 0.128 released.
+
+ * nnimap.el (nnimap-callback-callback-function): New variable.
+ (nnimap-demule): Handle null argument.
+ (nnimap-callback): New function.
+ (nnimap-request-article-part): Use it.
+ (nnimap-asynchronous-p): New backend function.
+
+1999-08-11 Simon Josefsson <jas@pdc.kth.se>
+
+ * imap.el (imap-fetch-asynch): New function.
+ (imap-current-message): New function.
+
+1999-08-11 Simon Josefsson <jas@pdc.kth.se>
+
+ * imap.el (imap-search): Check that a SEARCH response was
+ received.
+
+ * nnimap.el (nnimap-retrieve-headers): Handle when there's no
+ articles to fetch.
+
+1999-08-10 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap.el (nnimap-request-list-method): Defvar.
+
+1999-08-09 Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
+
+ * imap.el (imap-cram-md5-auth): Use base64-{en,de}code-string.
+
1999-08-09 Simon Josefsson <jas@pdc.kth.se>
* nnimap 0.127 released.
Index: nnimap/imap.el
diff -u nnimap/imap.el:1.162 nnimap/imap.el:1.165
--- nnimap/imap.el:1.162 Sun Aug 8 18:17:22 1999
+++ nnimap/imap.el Wed Aug 11 16:27:25 1999
@@ -544,10 +544,10 @@
(list
"AUTHENTICATE CRAM-MD5"
(lambda (challenge)
- (let* ((decoded (base64-decode challenge))
+ (let* ((decoded (base64-decode-string challenge))
(hash (rfc2104-hash 'md5 64 16 passwd decoded))
(response (concat user " " hash))
- (encoded (base64-encode response)))
+ (encoded (base64-encode-string response)))
encoded))))))))
(defun imap-login-p (buffer)
@@ -959,6 +959,10 @@
;; Message functions:
+(defun imap-current-message (&optional buffer)
+ (with-current-buffer (or buffer (current-buffer))
+ imap-current-message))
+
(defun imap-list-to-message-set (list)
(mapconcat (lambda (item)
(number-to-string item))
@@ -967,6 +971,14 @@
(list list))
","))
+(defun imap-fetch-asynch (uids props &optional nouidfetch buffer)
+ (with-current-buffer (or buffer (current-buffer))
+ (imap-send-command (format "%sFETCH %s %s" (if nouidfetch "" "UID ")
+ (if (listp uids)
+ (imap-list-to-message-set uids)
+ uids)
+ props))))
+
(defun imap-fetch (uids props &optional receive nouidfetch buffer)
"Fetch properties PROPS from message set UIDS from server in
BUFFER. UIDS can be a string, number or a list of numbers. If RECEIVE
@@ -1061,9 +1073,11 @@
(defun imap-search (predicate &optional buffer)
(with-current-buffer (or buffer (current-buffer))
- (imap-mailbox-put 'search nil)
+ (imap-mailbox-put 'search 'dummy)
(when (imap-ok-p (imap-send-command-wait (concat "UID SEARCH " predicate)))
- (imap-mailbox-get 'search))))
+ (if (eq (imap-mailbox-get 'search) 'dummy)
+ (error "Missing SEARCH response to a SEARCH command")
+ (imap-mailbox-get 'search)))))
(defun imap-message-flag-permanent-p (flag &optional mailbox buffer)
"Return t iff FLAG can be permanently (between IMAP sessions) saved
Index: nnimap/nnimap.el
diff -u nnimap/nnimap.el:1.216 nnimap/nnimap.el:1.220
--- nnimap/nnimap.el:1.216 Sun Aug 8 18:28:40 1999
+++ nnimap/nnimap.el Wed Aug 11 16:48:43 1999
@@ -45,7 +45,6 @@
;; o Split up big fetches (1,* header especially) in smaller chunks
;; o What do I do with gnus-newsgroup-*?
;; o Tell Gnus about new groups (how can we tell?)
-;; o Add asynchronous support
;; o Respooling (fix Gnus?) (unnecessery?)
;; o Add support for the following: (if applicable)
;; request-list-newsgroups, request-regenerate
@@ -69,6 +68,7 @@
(require 'nnheader)
(require 'mm-util)
(require 'gnus)
+(require 'gnus-async)
(require 'gnus-range)
(require 'gnus-start)
(require 'gnus-int)
@@ -78,7 +78,7 @@
(gnus-declare-backend "nnimap" 'post-mail 'address 'prompt-address
'physical-address)
-(defconst nnimap-version "nnimap 0.127")
+(defconst nnimap-version "nnimap 0.128")
(defvoo nnimap-address nil
"Address of physical IMAP server. If nil, use the virtual server's name.")
@@ -253,7 +253,7 @@
before using data stored in NOV cache."
:type 'boolean)
-(deffoo nnimap-request-list-method 'imap-mailbox-list
+(defvar nnimap-request-list-method 'imap-mailbox-list
"Method to use to request a list of all folders from the server.
If this is 'imap-mailbox-lsub, then use a server-side subscription list to
restrict visible folders.")
@@ -268,6 +268,8 @@
(defvar nnimap-progress-chars '(?| ?/ ?- ?\\))
(defvar nnimap-progress-how-often 20)
(defvar nnimap-counter)
+(defvar nnimap-callback-callback-function nil
+ "Gnus callback the nnimap asynchronous callback should call.")
;; Various server variables.
@@ -483,33 +485,36 @@
(if (nnimap-use-nov-p group server)
(nnimap-retrieve-headers-from-server
(gnus-compress-sequence articles) group server)
- (let* ((uids (nnimap-retrieve-which-headers articles fetch-old))
- cached (low (car uids)) (high (car (last uids))))
- (if (setq cached (nnimap-retrieve-headers-from-file group server))
- (progn
- ;; fetch articles with uids before cache block
- (when (< low (car cached))
- (goto-char (point-min))
- (nnimap-retrieve-headers-from-server
- (cons low (1- (car cached))) group server))
- ;; fetch articles with uids after cache block
- (when (> high (cdr cached))
- (goto-char (point-max))
- (nnimap-retrieve-headers-from-server
- (cons (1+ (cdr cached)) high) group server))
- (when nnimap-prune-cache
- ;; remove nov's for articles which has expired on server
- (goto-char (point-min))
- (dolist (uid (gnus-set-difference articles uids))
- (when (re-search-forward (format "^%d\t" uid) nil t)
- (gnus-delete-line)))))
- ;; nothing cached, fetch whole range from server
- (nnimap-retrieve-headers-from-server (cons low high) group server))
- (when (buffer-modified-p)
- (nnmail-write-region 1 (point-max)
- (nnimap-group-overview-filename group server)
- nil 'nomesg))
- (nnheader-nov-delete-outside-range low high)))
+ (let (uids cached low high)
+ (when (setq uids (nnimap-retrieve-which-headers articles fetch-old)
+ low (car uids)
+ high (car (last uids)))
+ (if (setq cached (nnimap-retrieve-headers-from-file group server))
+ (progn
+ ;; fetch articles with uids before cache block
+ (when (< low (car cached))
+ (goto-char (point-min))
+ (nnimap-retrieve-headers-from-server
+ (cons low (1- (car cached))) group server))
+ ;; fetch articles with uids after cache block
+ (when (> high (cdr cached))
+ (goto-char (point-max))
+ (nnimap-retrieve-headers-from-server
+ (cons (1+ (cdr cached)) high) group server))
+ (when nnimap-prune-cache
+ ;; remove nov's for articles which has expired on server
+ (goto-char (point-min))
+ (dolist (uid (gnus-set-difference articles uids))
+ (when (re-search-forward (format "^%d\t" uid) nil t)
+ (gnus-delete-line)))))
+ ;; nothing cached, fetch whole range from server
+ (nnimap-retrieve-headers-from-server
+ (cons low high) group server))
+ (when (buffer-modified-p)
+ (nnmail-write-region
+ 1 (point-max) (nnimap-group-overview-filename group server)
+ nil 'nomesg))
+ (nnheader-nov-delete-outside-range low high))))
'nov)))
(defun nnimap-open-connection (server)
@@ -599,29 +604,46 @@
(subrp (symbol-function 'string-as-multibyte)))
'string-as-multibyte
'identity)
- string))
+ (or string "")))
+(defun nnimap-callback ()
+ (remove-hook 'imap-fetch-data-hook 'nnimap-callback)
+ (with-current-buffer gnus-async-prefetch-article-buffer
+ (insert
+ (with-current-buffer nnimap-server-buffer
+ (nnimap-demule (imap-message-get (imap-current-message) 'RFC822)))) ;xxx
+ (nnheader-ms-strip-cr)
+ (funcall nnimap-callback-callback-function t)))
+
(defun nnimap-request-article-part (article part prop
&optional group server to-buffer)
(when (nnimap-possibly-change-group group server)
- (with-current-buffer (or to-buffer nntp-server-buffer)
- (erase-buffer)
- (and (stringp article)
- (setq article (car-safe (imap-search
- (format "HEADER Message-Id %s" article)
- nnimap-server-buffer))))
+ (let ((article (if (stringp article)
+ (car-safe (imap-search
+ (format "HEADER Message-Id %s" article)
+ nnimap-server-buffer))
+ article)))
(when article
(gnus-message 9 "nnimap: Fetching (part of) article %d..." article)
- (insert (nnimap-demule
- (or (imap-fetch article part prop nil nnimap-server-buffer)
- "")))
- (nnheader-ms-strip-cr)
- (gnus-message 9 "nnimap: Fetching (part of) article %d...done"
- article))
- (if (bobp)
- (nnheader-report 'nnimap "No such article: %s"
- (imap-error-text nnimap-server-buffer))
- (cons group article)))))
+ (if (not nnheader-callback-function)
+ (with-current-buffer (or to-buffer nntp-server-buffer)
+ (erase-buffer)
+ (insert (nnimap-demule (imap-fetch article part prop nil
+ nnimap-server-buffer)))
+ (nnheader-ms-strip-cr)
+ (gnus-message 9 "nnimap: Fetching (part of) article %d...done"
+ article)
+ (if (bobp)
+ (nnheader-report 'nnimap "No such article: %s"
+ (imap-error-text nnimap-server-buffer))
+ (cons group article)))
+ (add-hook 'imap-fetch-data-hook 'nnimap-callback)
+ (setq nnimap-callback-callback-function nnheader-callback-function)
+ (imap-fetch-asynch article part nil nnimap-server-buffer)
+ (cons group article))))))
+
+(deffoo nnimap-asynchronous-p ()
+ t)
(deffoo nnimap-request-article (article &optional group server to-buffer)
(nnimap-request-article-part