From c7e6891b8b32f82a58bfc5b8a844ffdcff7bfc2a Mon Sep 17 00:00:00 2001 From: dmaus Date: Sun, 29 May 2011 12:34:48 +0000 Subject: [PATCH] Add optional fourth argument, return number of appended message if possible * elmo.el (elmo-folder-append-buffer): Add optional fourth argument, return number of appended message if possible. * elmo-pipe.el (elmo-folder-append-buffer): Dto. * elmo-maildir.el (elmo-folder-append-buffer): Dto. * elmo-flag.el (elmo-folder-append-buffer): Dto. * elmo-localdir.el (elmo-folder-append-buffer): Dto. * elmo-filter.el (elmo-folder-append-buffer): Dto. * elmo-cache.el (elmo-folder-append-buffer): Dto. * elmo-archive.el (elmo-folder-append-buffer) (elmo-archive-folder-append-buffer): Dto. --- elmo/ChangeLog | 13 +++++++++++++ elmo/elmo-archive.el | 7 ++++--- elmo/elmo-cache.el | 3 ++- elmo/elmo-filter.el | 5 +++-- elmo/elmo-flag.el | 3 ++- elmo/elmo-imap4.el | 2 +- elmo/elmo-localdir.el | 3 ++- elmo/elmo-maildir.el | 3 ++- elmo/elmo-pipe.el | 5 +++-- elmo/elmo.el | 5 ++++- 10 files changed, 36 insertions(+), 13 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e0456a5..d746c4f 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,16 @@ +2011-05-29 David Maus + + * elmo.el (elmo-folder-append-buffer): Add optional fourth + argument, return number of appended message if possible. + * elmo-pipe.el (elmo-folder-append-buffer): Dto. + * elmo-maildir.el (elmo-folder-append-buffer): Dto. + * elmo-flag.el (elmo-folder-append-buffer): Dto. + * elmo-localdir.el (elmo-folder-append-buffer): Dto. + * elmo-filter.el (elmo-folder-append-buffer): Dto. + * elmo-cache.el (elmo-folder-append-buffer): Dto. + * elmo-archive.el (elmo-folder-append-buffer) + (elmo-archive-folder-append-buffer): Dto. + 2010-08-31 David Maus * elmo-imap4.el (elmo-folder-delete-messages-plugged): Use smarter diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 274bde1..fb71e1a 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -573,11 +573,12 @@ TYPE specifies the archiver's symbol." (elmo-archive-message-fetch-internal folder number)) (luna-define-method elmo-folder-append-buffer ((folder elmo-archive-folder) - &optional flags number) - (elmo-archive-folder-append-buffer folder flags number)) + &optional flags number + return-number) + (elmo-archive-folder-append-buffer folder flags number return-number)) ;; verrrrrry slow!! -(defun elmo-archive-folder-append-buffer (folder flags number) +(defun elmo-archive-folder-append-buffer (folder flags number return-number) (let* ((type (elmo-archive-folder-archive-type-internal folder)) (prefix (elmo-archive-folder-archive-prefix-internal folder)) (arc (elmo-archive-get-archive-name folder)) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 37f506c..bd2df5f 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -108,7 +108,8 @@ new-msgdb)) (luna-define-method elmo-folder-append-buffer ((folder elmo-cache-folder) - &optional flags number) + &optional flags number + return-number) ;; dir-name is changed according to msgid. (unless (elmo-cache-folder-dir-name-internal folder) (let ((msgid (std11-field-body "message-id")) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 65aacfa..11b736d 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -221,10 +221,11 @@ type)) (luna-define-method elmo-folder-append-buffer ((folder elmo-filter-folder) - &optional flag number) + &optional flag number + return-number) (elmo-folder-append-buffer (elmo-filter-folder-target-internal folder) - flag number)) + flag number return-number)) (defun elmo-folder-append-messages-filter-* (dst-folder src-folder diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index 7765a8a..6c3dc7b 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -212,7 +212,8 @@ numbers) (luna-define-method elmo-folder-append-buffer ((folder elmo-flag-folder) - &optional flag number) + &optional flag number + return-number) (error "Cannot append to the flag folder")) (luna-define-method elmo-folder-unset-flag :before ((folder elmo-flag-folder) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 20b2fa2..9feda9e 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -2715,7 +2715,7 @@ If optional argument REMOVE is non-nil, remove FLAG." imap-flag)) (luna-define-method elmo-folder-append-buffer - ((folder elmo-imap4-folder) &optional flags number) + ((folder elmo-imap4-folder) &optional flags number return-number) (if (elmo-folder-plugged-p folder) (let ((session (elmo-imap4-get-session folder)) send-buffer result) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 78a30f1..5285659 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -191,7 +191,8 @@ (sort flist '<)))) (luna-define-method elmo-folder-append-buffer ((folder elmo-localdir-folder) - &optional flags number) + &optional flags number + return-number) (let ((filename (elmo-message-file-name folder (or number diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 2c29937..c185b5f 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -430,7 +430,8 @@ file name for maildir directories." (rename-file src dst))) (luna-define-method elmo-folder-append-buffer ((folder elmo-maildir-folder) - &optional flags number) + &optional flags number + return-number) (let ((basedir (elmo-maildir-folder-directory-internal folder)) (src-buf (current-buffer)) dst-buf filename) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index 68bb479..2ae9626 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -103,9 +103,10 @@ same-number)) (luna-define-method elmo-folder-append-buffer ((folder elmo-pipe-folder) - &optional flag number) + &optional flag number + return-number) (elmo-folder-append-buffer (elmo-pipe-folder-dst-internal folder) - flag number)) + flag number return-number)) (luna-define-method elmo-message-fetch ((folder elmo-pipe-folder) number strategy diff --git a/elmo/elmo.el b/elmo/elmo.el index c3c0bd7..1a92c4d 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -427,7 +427,7 @@ If optional IS-LOCAL is non-nil, update only local (not server) status.") FOLDER is the ELMO folder structure.") (luna-define-generic elmo-folder-append-buffer (folder &optional flags - number) + number return-number) "Append current buffer as a new message. FOLDER is the destination folder (ELMO folder structure). FLAGS is the flag list for the appended message (list of symbols). @@ -435,6 +435,9 @@ If FLAGS contain `read', the message is appended as `not-unread'. If it is nil, the appended message will be treated as `new'. If optional argument NUMBER is specified, the new message number is set \(if possible\). +If optional argument RETURN-NUMBER is non-nil, return the number +of the appended message if possible. If the number could not be +obtained return t. Return nil on failure.") (luna-define-generic elmo-folder-pack-numbers (folder) -- 1.7.10.4