X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnimap.el;h=e94a98e9a90c0891f7fa038f39fe22ab397a881d;hb=08f0aef5376ea79e44de232503c5a3159fc2350d;hp=a78346c60cfeb1ac9d38df662deb12d8137251a5;hpb=5d97eabba7d837af355df0e772bd9e2f585b7a22;p=gnus diff --git a/lisp/nnimap.el b/lisp/nnimap.el index a78346c60..e94a98e9a 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -82,7 +82,8 @@ back on `network'.") (defvoo nnimap-inbox nil "The mail box where incoming mail arrives and should be split out of. -For example, \"INBOX\".") +This can be a string or a list of strings +For example, \"INBOX\" or (\"INBOX\" \"SENT\").") (defvoo nnimap-split-methods nil "How mail is split. @@ -117,7 +118,7 @@ some servers.") (defvoo nnimap-fetch-partial-articles nil "If non-nil, Gnus will fetch partial articles. -If t, nnimap will fetch only the first part. If a string, it +If t, Gnus will fetch only the first part. If a string, it will fetch all parts that have types that match that string. A likely value would be \"text/\" to automatically fetch all textual parts.") @@ -201,7 +202,10 @@ textual parts.") (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n" (save-excursion - (or (re-search-forward "\\* [0-9]+ FETCH" nil t) + ;; Start of the header section. + (or (re-search-forward "] {[0-9]+}\r?\n" nil t) + ;; Start of the next FETCH. + (re-search-forward "\\* [0-9]+ FETCH" nil t) (point-max))) t) (setq size (string-to-number (match-string 1))) @@ -289,7 +293,7 @@ textual parts.") (defun nnimap-make-process-buffer (buffer) (with-current-buffer - (generate-new-buffer (format "*nnimap %s %s %s*" + (generate-new-buffer (format " *nnimap %s %s %s*" nnimap-address nnimap-server-port (gnus-buffer-exists-p buffer))) (mm-disable-multibyte) @@ -865,6 +869,7 @@ textual parts.") ;; Move the article to a different method. (let ((result (eval accept-form))) (when result + (nnimap-possibly-change-group group server) (nnimap-delete-article article) result))))))) @@ -1003,7 +1008,10 @@ textual parts.") nnimap-inbox nnimap-split-methods) (nnheader-message 7 "nnimap %s splitting mail..." server) - (nnimap-split-incoming-mail) + (if (listp nnimap-inbox) + (dolist (nnimap-inbox nnimap-inbox) + (nnimap-split-incoming-mail)) + (nnimap-split-incoming-mail)) (nnheader-message 7 "nnimap %s splitting mail...done" server))) (defun nnimap-marks-to-flags (marks) @@ -1187,7 +1195,8 @@ textual parts.") (dolist (response responses) (let* ((sequence (car response)) (response (cadr response)) - (group (cadr (assoc sequence sequences)))) + (group (cadr (assoc sequence sequences))) + (egroup (encode-coding-string group 'utf-8))) (when (and group (equal (caar response) "OK")) (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) @@ -1199,15 +1208,14 @@ textual parts.") (setq highest (1- (string-to-number (car uidnext))))) (cond ((null highest) - (insert (format "%S 0 1 y\n" (utf7-decode group t)))) + (insert (format "%S 0 1 y\n" egroup))) ((zerop exists) ;; Empty group. - (insert (format "%S %d %d y\n" - (utf7-decode group t) + (insert (format "%S %d %d y\n" egroup highest (1+ highest)))) (t ;; Return the widest possible range. - (insert (format "%S %d 1 y\n" (utf7-decode group t) + (insert (format "%S %d 1 y\n" egroup (or highest exists))))))))) t))))) @@ -1219,7 +1227,7 @@ textual parts.") (nnimap-get-groups))) (unless (assoc group nnimap-current-infos) ;; Insert dummy numbers here -- they don't matter. - (insert (format "%S 0 1 y\n" (utf7-encode group))))) + (insert (format "%S 0 1 y\n" (encode-coding-string group 'utf-8))))) t))) (deffoo nnimap-retrieve-group-data-early (server infos) @@ -1720,13 +1728,18 @@ textual parts.") (nnimap-wait-for-response nnimap-sequence)) nnimap-sequence) +(defvar nnimap-record-commands nil + "If non-nil, log commands to the \"*imap log*\" buffer.") + (defun nnimap-log-command (command) - (with-current-buffer (get-buffer-create "*imap log*") - (goto-char (point-max)) - (insert (format-time-string "%H:%M:%S") " " - (if nnimap-inhibit-logging - "(inhibited)\n" - command))) + (when nnimap-record-commands + (with-current-buffer (get-buffer-create "*imap log*") + (goto-char (point-max)) + (insert (format-time-string "%H:%M:%S") + " [" nnimap-address "] " + (if nnimap-inhibit-logging + "(inhibited)\n" + command)))) command) (defun nnimap-command (&rest args)