[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
nnimap 0.98 -> 0.99 patches
- To: nnimap@extundo.com
- Subject: nnimap 0.98 -> 0.99 patches
- From: Simon Josefsson <jas@pdc.kth.se>
- Date: 09 May 1999 19:20:32 +0200
- User-Agent: Gnus/5.070083 (Pterodactyl Gnus v0.83) Emacs/20.3.8
Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.195 nnimap/ChangeLog:1.199
*** nnimap/ChangeLog:1.195 Sat May 1 12:14:31 1999
--- nnimap/ChangeLog Sun May 9 09:56:46 1999
***************
*** 1,3 ****
--- 1,52 ----
+ 1999-05-09 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap 0.99 released.
+
+ * imap.el (imap-message-put):
+ (imap-mailbox-put): Signal error instead of message.
+
+ * nnimap.el (nnimap-split-articles): Don't split unseen deleted
+ articles.
+
+ * imap.el (imap-message-copy): New param no-copyuid.
+ (nnimap-split-articles): Use it.
+
+ 1999-05-05 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap.el (nnimap-split-copy-delete-article):
+ (nnimap-split-move-article): Removed.
+ (nnimap-split-articles): Wait until article is successfully copied
+ to all groups before deleting it.
+
+ 1999-05-02 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap.el (nnimap-request-article-part): Protect null inserts.
+
+ 1999-05-02 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap.el (nnimap-request-delete-group):
+ (nnimap-request-rename-group):
+ (nnimap-request-post):
+ (nnimap-request-type): Rewrite.
+
+ * imap.el (imap-mailbox-delete):
+ (imap-mailbox-rename): New functions.
+
+ * nnimap.el (nnimap-request-group-description):
+ (nnimap-request-list-newsgroups):
+ (nnimap-request-newgroups): Removed.
+
+ 1999-05-01 Simon Josefsson <jas@pdc.kth.se>
+
+ * imap.el (imap-message-fetch): New argument, only fetch given
+ properties.
+
+ * nnimap.el (nnimap-demule): New function.
+ (nnimap-request-article-part):
+ (nnimap-request-article):
+ (nnimap-request-head):
+ (nnimap-request-body): Rewrite.
+
1999-05-01 Simon Josefsson <jas@pdc.kth.se>
* nnimap 0.98 released.
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.124 nnimap/imap.el:1.127
*** nnimap/imap.el:1.124 Sat May 1 12:05:55 1999
--- nnimap/imap.el Sun May 9 09:53:36 1999
***************
*** 660,667 ****
(if imap-mailbox-data
(put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
propname value)
! (message "Imap-mailbox-data is nil. Property %s value %s mailbox %s"
! propname value mailbox))
t))
(defun imap-mailbox-get (propname &optional mailbox buffer)
--- 660,667 ----
(if imap-mailbox-data
(put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
propname value)
! (error "Imap-mailbox-data is nil. Property %s value %s mailbox %s"
! propname value mailbox))
t))
(defun imap-mailbox-get (propname &optional mailbox buffer)
***************
*** 718,724 ****
t)))
(defun imap-mailbox-close (&optional buffer)
! "Expunge articles and close current folder in BUFFER."
(with-current-buffer (or buffer (current-buffer))
(when (imap-ok-p (imap-send-command-wait "CLOSE"))
(setq imap-current-mailbox nil
--- 718,725 ----
t)))
(defun imap-mailbox-close (&optional buffer)
! "Expunge articles and close current folder in BUFFER. If BUFFER is
! nil the current buffer is assumed."
(with-current-buffer (or buffer (current-buffer))
(when (imap-ok-p (imap-send-command-wait "CLOSE"))
(setq imap-current-mailbox nil
***************
*** 727,737 ****
t)))
(defun imap-mailbox-create (mailbox &optional buffer)
! "Create MAILBOX on server in BUFFER, if nil current buffer is assumed."
(with-current-buffer (or buffer (current-buffer))
(imap-ok-p
(imap-send-command-wait (list "CREATE " mailbox)))))
(defun imap-mailbox-lsub (&optional buffer reference)
"Clear the mailbox data and fill it with subscribed mailboxes on
server in BUFFER. REFERENCE is the implementation-specific string that
--- 728,753 ----
t)))
(defun imap-mailbox-create (mailbox &optional buffer)
! "Create MAILBOX on server in BUFFER. If BUFFER is nil the current
! buffer is assumed."
(with-current-buffer (or buffer (current-buffer))
(imap-ok-p
(imap-send-command-wait (list "CREATE " mailbox)))))
+ (defun imap-mailbox-delete (mailbox &optional buffer)
+ "Delete MAILBOX on server in BUFFER. If BUFFER is nil the current
+ buffer is assumed."
+ (with-current-buffer (or buffer (current-buffer))
+ (imap-ok-p
+ (imap-send-command-wait (list "DELETE " mailbox)))))
+
+ (defun imap-mailbox-rename (oldname newname &optional buffer)
+ "Rename mailbox OLDNAME to NEWNAME on server in BUFFER. If BUFFER is
+ nil the current buffer is assumed."
+ (with-current-buffer (or buffer (current-buffer))
+ (imap-ok-p
+ (imap-send-command-wait (list "RENAME " oldname " " newname)))))
+
(defun imap-mailbox-lsub (&optional buffer reference)
"Clear the mailbox data and fill it with subscribed mailboxes on
server in BUFFER. REFERENCE is the implementation-specific string that
***************
*** 836,844 ****
(list list))
","))
! (defun imap-message-fetch (uids props &optional buffer)
"Fetch properties PROPS from message set UIDS from server in
! BUFFER. UIDS is a list of articles"
(with-current-buffer (or buffer (current-buffer))
(let ((uids (if (or (stringp uids) (listp uids)) uids (list uids)))
(props (if (or (stringp props) (listp props)) props (list props))))
--- 852,861 ----
(list list))
","))
! (defun imap-message-fetch (uids props &optional receive buffer)
"Fetch properties PROPS from message set UIDS from server in
! BUFFER. UIDS is a list of articles. If RECEIVE is non-nil return
! theese properties."
(with-current-buffer (or buffer (current-buffer))
(let ((uids (if (or (stringp uids) (listp uids)) uids (list uids)))
(props (if (or (stringp props) (listp props)) props (list props))))
***************
*** 848,859 ****
(imap-list-to-message-set uids)
uids)
props)))
! (if (or (stringp uids) (stringp props))
t
(mapcar (lambda (uid)
(mapcar (lambda (prop)
(imap-message-get uid prop))
! props))
uids))))))
(defun imap-message-put (uid propname value &optional buffer)
--- 865,876 ----
(imap-list-to-message-set uids)
uids)
props)))
! (if (not (and receive (listp uids)))
t
(mapcar (lambda (uid)
(mapcar (lambda (prop)
(imap-message-get uid prop))
! (if (listp receive) receive (list receive))))
uids))))))
(defun imap-message-put (uid propname value &optional buffer)
***************
*** 861,868 ****
(if imap-message-data
(put (intern (number-to-string uid) imap-message-data)
propname value)
! (message "Imap-message-data is nil. Uid %d property %s value %s"
! uid propname value))
t))
(defun imap-message-get (uid propname &optional buffer)
--- 878,885 ----
(if imap-message-data
(put (intern (number-to-string uid) imap-message-data)
propname value)
! (error "Imap-message-data is nil. Uid %d property %s value %s"
! uid propname value))
t))
(defun imap-message-get (uid propname &optional buffer)
***************
*** 990,996 ****
(car (imap-message-map (lambda (uid prop) uid) 'UID)))
(imap-mailbox-select old-mailbox nil (eq state 'examine)))))))
! (defun imap-message-copy (articles mailbox &optional buffer dont-create)
"Copy ARTICLES (a string message set) to MAILBOX on server in
BUFFER, creating mailbox if it doesn't exist. If dont-create is
non-nil, it will not create a mailbox. On success, return a list with
--- 1007,1014 ----
(car (imap-message-map (lambda (uid prop) uid) 'UID)))
(imap-mailbox-select old-mailbox nil (eq state 'examine)))))))
! (defun imap-message-copy (articles mailbox
! &optional buffer dont-create no-copyuid)
"Copy ARTICLES (a string message set) to MAILBOX on server in
BUFFER, creating mailbox if it doesn't exist. If dont-create is
non-nil, it will not create a mailbox. On success, return a list with
***************
*** 1006,1012 ****
(imap-mailbox-get 'trycreate mailbox))
(imap-mailbox-create mailbox)
(imap-ok-p (imap-send-command-wait cmd)))))
! (imap-message-copyuid mailbox)))))
(defun imap-message-append (mailbox article &optional buffer flags date-time)
"Append ARTICLE (a buffer) to MAILBOX on server in BUFFER. FLAGS and
--- 1024,1031 ----
(imap-mailbox-get 'trycreate mailbox))
(imap-mailbox-create mailbox)
(imap-ok-p (imap-send-command-wait cmd)))))
! (or no-copyuid
! (imap-message-copyuid mailbox))))))
(defun imap-message-append (mailbox article &optional buffer flags date-time)
"Append ARTICLE (a buffer) to MAILBOX on server in BUFFER. FLAGS and
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.139 nnimap/nnimap.el:1.146
*** nnimap/nnimap.el:1.139 Sat May 1 12:06:33 1999
--- nnimap/nnimap.el Sun May 9 09:56:19 1999
***************
*** 93,99 ****
(nnoo-declare nnimap)
! (defconst nnimap-version "nnimap 0.98")
;; Splitting variables
--- 93,99 ----
(nnoo-declare nnimap)
! (defconst nnimap-version "nnimap 0.99")
;; Splitting variables
***************
*** 381,386 ****
--- 381,430 ----
(when (nnimap-possibly-change-server server)
(nnoo-status-message 'nnimap server)))
+ (defun nnimap-demule (string)
+ (funcall (if (and string
+ (fboundp 'string-as-multibyte)
+ (subrp (symbol-function 'string-as-multibyte)))
+ 'string-as-multibyte
+ 'identity)
+ string))
+
+ (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)
+ (insert (or (nnimap-demule
+ (car-safe
+ (car-safe
+ (imap-message-fetch
+ (if (stringp article)
+ (car-safe (imap-search
+ (format "HEADER Message-Id %s" article
+ nnimap-server-buffer)))
+ article)
+ part prop nnimap-server-buffer))))
+ ""))
+ (nnheader-ms-strip-cr)
+ (if (bobp)
+ (nnheader-report 'nnimap "No such article")
+ t))))
+
+ (deffoo nnimap-request-article (article &optional group server to-buffer)
+ (nnimap-request-article-part
+ article "RFC822.PEEK" 'RFC822 group server to-buffer))
+
+ (deffoo nnimap-request-head (article &optional group server to-buffer)
+ (nnimap-request-article-part
+ article "RFC822.HEADER" 'RFC822.HEADER group server to-buffer))
+
+ (deffoo nnimap-request-body (article &optional group server to-buffer)
+ (nnimap-request-article-part
+ article "RFC822.TEXT.PEEK" 'RFC822.TEXT group server to-buffer))
+
+ (deffoo nnimap-request-post (&optional server)
+ (nnheader-report 'nnimap "Nnimap doesn't support posting"))
+
(defun nnimap-body-lines (body)
"Return number of lines in article by looking at the mime bodystructure
BODY."
***************
*** 405,429 ****
(deffoo nnimap-request-scan (&optional group server)
(nnimap-split-articles group server))
- (defun nnimap-split-copy-delete-article (article group to-group server)
- "Move article ARTICLE from group GROUP on current server to group TO-GROUP."
- (when (nnimap-ok-p (nnimap-send-command-wait
- (format "UID COPY %d %s" article to-group)))
- (setq nnimap-need-expunge t)
- (if (imap-message-flags-add (format "%d" article) "\\Seen \\Deleted")
- (message "IMAP split moved %s:%s:%d to %s" server group
- article to-group)
- (error "IMAP flag store failed: you may have unread mail marked as read!"))))
-
- (defun nnimap-split-move-article (article group to-group server)
- (when to-group
- (unless (nnimap-split-copy-delete-article article group to-group server)
- (message "Could not find mailbox %s, creating..." to-group)
- (if (nnimap-ok-p (nnimap-send-command-wait
- (format "CREATE %s" to-group)))
- (nnimap-split-copy-delete-article article group to-group server)
- (message "Could not create mailbox %s." to-group)))))
-
;; This is from nnmail.el:nnmail-expand-newtext, written by Larsi.
(defun nnimap-expand-newtext (newtext)
(let ((len (length newtext))
--- 449,454 ----
***************
*** 497,519 ****
(defun nnimap-split-articles (&optional group server)
(when (nnimap-possibly-change-server server)
(with-current-buffer nnimap-server-buffer
! (let (rule inbox (inboxes (nnimap-split-find-inbox server)))
;; iterate over inboxes
(while (and (setq inbox (pop inboxes))
(nnimap-possibly-change-group inbox)) ;; SELECT
;; find split rule for this server / inbox
(when (setq rule (nnimap-split-find-rule server inbox))
;; iterate over articles
! (dolist (article (imap-search "UNSEEN"))
(when (nnimap-request-head article)
! ;; move article to right group(s)
! (dolist (to-group (nnimap-split-to-groups rule) t)
! (nnimap-split-move-article article inbox to-group server)))))
(when (imap-mailbox-select inbox) ;; just in case
;; todo: UID EXPUNGE (if available) to remove splitted articles
(nnimap-expunge-close-group)))
t))))
;; (nn)IMAP specific decisions:
;;
;; o dormant articles are also marked as ticked (for other imap clients)
--- 522,558 ----
(defun nnimap-split-articles (&optional group server)
(when (nnimap-possibly-change-server server)
(with-current-buffer nnimap-server-buffer
! (let (rule inbox removeorig (inboxes (nnimap-split-find-inbox server)))
;; iterate over inboxes
(while (and (setq inbox (pop inboxes))
(nnimap-possibly-change-group inbox)) ;; SELECT
;; find split rule for this server / inbox
(when (setq rule (nnimap-split-find-rule server inbox))
;; iterate over articles
! (dolist (article (imap-search "UNSEEN UNDELETED"))
(when (nnimap-request-head article)
! ;; copy article to right group(s)
! (setq removeorig t)
! (dolist (to-group (nnimap-split-to-groups rule))
! (if (imap-message-copy article to-group nil nil t)
! (message "IMAP split moved %s:%s:%d to %s" server inbox
! article to-group)
! (message "IMAP split failed to move %s:%s:%d to %s" server
! inbox article to-group)
! (setq removeorig nil)))
! ;; remove article on success
! (when removeorig
! (setq nnimap-need-expunge t)
! (imap-message-flags-add (format "%d" article)
! "\\Seen \\Deleted")))))
(when (imap-mailbox-select inbox) ;; just in case
;; todo: UID EXPUNGE (if available) to remove splitted articles
(nnimap-expunge-close-group)))
t))))
+ (deffoo nnimap-request-type (group &optional article)
+ 'mail)
+
;; (nn)IMAP specific decisions:
;;
;; o dormant articles are also marked as ticked (for other imap clients)
***************
*** 586,591 ****
--- 625,638 ----
(nnimap-request-expire-articles (list article) group server t))
result))))
+ (deffoo nnimap-request-delete-group (group force &optional server)
+ (when (and (nnimap-possibly-change-server server) force)
+ (imap-mailbox-delete group nnimap-server-buffer)))
+
+ (deffoo nnimap-request-rename-group (group new-name &optional server)
+ (when (nnimap-possibly-change-server server)
+ (imap-mailbox-rename group new-name nnimap-server-buffer)))
+
;;; Gnus functions
(defun gnus-group-nnimap-expunge (group)
***************
*** 735,779 ****
(delete-backward-char 1)))
'headers))))
- (deffoo nnimap-request-article (article &optional group server to-buffer)
- (nnimap-request-article-part 'RFC822 article group server to-buffer t))
- (deffoo nnimap-request-head (article &optional group server to-buffer)
- (nnimap-request-article-part 'RFC822.HEADER article group server to-buffer))
- (deffoo nnimap-request-body (article &optional group server to-buffer)
- (nnimap-request-article-part 'RFC822.TEXT article group server to-buffer t))
-
- (defun nnimap-request-article-part (part article &optional
- group server to-buffer add-peek)
- (when (nnimap-possibly-change-group group server)
- (with-current-buffer nnimap-server-buffer
- (when (stringp article)
- ;; Find the article number by Message-Id
- (let ((articles (imap-search (format "HEADER Message-Id %d" article))))
- (when (cdr articles)
- (message
- "IMAP Warning: Message Id search yielded more than one article %s"
- articles))
- (setq article (car articles))))
- (when article
- ;; Find the article by number
- (nnimap-send-command-wait (format "UID FETCH %d (%s%s)" article part
- (if add-peek ".PEEK" "")))
- (let ((text (funcall (if (and (fboundp 'string-as-multibyte)
- (subrp (symbol-function
- 'string-as-multibyte)))
- 'string-as-multibyte
- 'identity) (imap-message-get article part))))
- (with-current-buffer (or to-buffer nntp-server-buffer)
- (erase-buffer)
- (if (not text)
- (nnheader-report 'nnimap
- (format "Article %s does not exist." article))
- (insert text)
- (goto-char (point-min))
- (while (re-search-forward "\r$" nil t)
- (delete-backward-char 1))
- t)))))))
-
;;; Select GROUP and unless FAST return 211 EXISTS LOWEST HIGHEST GROUP
;;; The active info returned goes into the `gnus-active-hashtb'.
;;; Don't call this directly, call `gnus-activate-group'.
--- 782,787 ----
***************
*** 874,883 ****
(imap-mailbox-map 'nnimap-request-list-mapper))))
t)))
- ;;; IMAP doesn't support posting, but this must be defined
- (deffoo nnimap-request-post (&optional server)
- nil)
-
;;; Interface functions, optional backend functions
--- 882,887 ----
***************
*** 956,986 ****
gnus-article-mark-lists))))
info)
- ;; Respond to articles with mail
- (deffoo nnimap-request-type (group article)
- 'mail)
-
- ;; until everyone uses gnus >= 5.6.24
- (deffoo nnimap-request-group-description (group &optional server)
- (when (nnimap-possibly-change-server server)
- (with-current-buffer nntp-server-buffer
- (erase-buffer))
- t))
-
- ;; until everyone uses gnus >= 5.6.24
- (deffoo nnimap-request-list-newsgroups (&optional server)
- (when (nnimap-possibly-change-server server)
- (with-current-buffer nntp-server-buffer
- (erase-buffer))
- t))
-
- ;; until everyone uses gnus >= 5.6.24
- (deffoo nnimap-request-newgroups (date &optional server)
- (when (nnimap-possibly-change-server server)
- (with-current-buffer nntp-server-buffer
- (erase-buffer))
- t))
-
(defun nnimap-time-substract (time1 time2)
"Return TIME for TIME1 - TIME2."
(let* ((ms (- (car time1) (car time2)))
--- 960,965 ----
***************
*** 1068,1090 ****
;; (deffoo nnimap-request-replace-article -- IMAP does not support replacing
- (deffoo nnimap-request-delete-group (group force &optional server)
- (when (nnimap-possibly-change-server server)
- (nnimap-ok-p (nnimap-send-command-wait
- (concat "DELETE " group)
- nnimap-server-buffer))))
-
- (deffoo nnimap-request-rename-group (group new-name &optional server)
- (when (nnimap-possibly-change-server server)
- (when (string= "INBOX" group)
- (nnheader-report
- 'nnimap
- "Renaming INBOX will only move content to a newly created mailbox")
- (sit-for 1))
- (nnimap-ok-p (nnimap-send-command-wait
- (concat "RENAME " group " " new-name)
- nnimap-server-buffer))))
-
;;; Internal functions
--- 1047,1052 ----
***************
*** 1293,1299 ****
nnimap-split-move-article
nnimap-expand-newtext
nnimap-split-to-groups
! nnimap-split-find-rule
nnimap-split-find-inbox
nnimap-split-articles
nnimap-request-set-mark
--- 1255,1262 ----
nnimap-split-move-article
nnimap-expand-newtext
nnimap-split-to-groups
! ;nnimap-split-find-rule
! nnimap-demule
nnimap-split-find-inbox
nnimap-split-articles
nnimap-request-set-mark