Index: lisp/nnimap.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/nnimap.el,v retrieving revision 7.59 diff -u -r7.59 nnimap.el --- lisp/nnimap.el 26 Jan 2009 15:23:27 -0000 7.59 +++ lisp/nnimap.el 8 Mar 2009 02:11:49 -0000 @@ -555,12 +555,12 @@ (or (null (imap-current-mailbox nnimap-server-buffer)) (imap-mailbox-unselect nnimap-server-buffer)))) -(defun nnimap-find-minmax-uid (group &optional examine) +(defun nnimap-find-minmax-uid (mailbox &optional examine) "Find lowest and highest active article number in GROUP. If EXAMINE is non-nil the group is selected read-only." (with-current-buffer nnimap-server-buffer - (when (or (string= group (imap-current-mailbox)) - (imap-mailbox-select group examine)) + (when (or (string= mailbox (imap-current-mailbox)) + (imap-mailbox-select mailbox examine)) (let (minuid maxuid) (when (> (imap-mailbox-get 'exists) 0) (imap-fetch-safe '("1,*" . "1,*:*") "UID" nil 'nouidfetch) @@ -574,12 +574,14 @@ "Make GROUP the current group, and SERVER the current server." (when (nnimap-possibly-change-server server) (with-current-buffer nnimap-server-buffer - (if (or (null group) (imap-current-mailbox-p group)) - imap-current-mailbox - (if (imap-mailbox-select group) + (if (or (null group) (imap-current-mailbox-p + (nnimap-group-to-mailbox group))) + (nnimap-mailbox-to-group imap-current-mailbox) + (if (imap-mailbox-select (nnimap-group-to-mailbox group)) (if (or (nnimap-verify-uidvalidity group (or server nnimap-current-server)) - (zerop (imap-mailbox-get 'exists group)) + (zerop (imap-mailbox-get 'exists + (nnimap-group-to-mailbox group))) t ;; for OGnus to see if ignoring uidvalidity ;; changes has any bad effects. (yes-or-no-p @@ -597,6 +599,20 @@ (setq string (replace-match " " t t string))) string)) +;; We use UTF-8 for the internal group names. +(defun nnimap-group-to-mailbox (group) + "Return the mailbox name corresponding to GROUP." + (if (and group (mm-coding-system-p 'utf-8)) + (mm-decode-coding-string group 'utf-8) + group)) + +;; We use UTF-8 for the internal group names. +(defun nnimap-mailbox-to-group (mailbox) + "Return the group name corresponding to MAILBOX." + (if (and mailbox (mm-coding-system-p 'utf-8)) + (mm-encode-coding-string mailbox 'utf-8) + mailbox)) + ;; Required backend functions (defun nnimap-retrieve-headers-progress () @@ -955,7 +971,8 @@ article))) (when article (gnus-message 10 "nnimap: Fetching (part of) article %d from %s..." - article (or group imap-current-mailbox + article (or group + imap-current-mailbox gnus-newsgroup-name)) (if (not nnheader-callback-function) (with-current-buffer (or to-buffer nntp-server-buffer) @@ -1018,7 +1035,8 @@ (nnimap-before-find-minmax-bugworkaround) (let (info) (cond (fast group) - ((null (setq info (nnimap-find-minmax-uid group t))) + ((null (setq info (nnimap-find-minmax-uid + (nnimap-group-to-mailbox group) t))) (nnheader-report 'nnimap "Could not get active info for %s" group)) (t @@ -1035,7 +1053,8 @@ (let ((old (gnus-gethash-safe (gnus-group-prefixed-name group server) nnimap-mailbox-info))) (list (nth 0 old) (nth 1 old) - (imap-mailbox-status group 'unseen nnimap-server-buffer) + (imap-mailbox-status (nnimap-group-to-mailbox group) 'unseen + nnimap-server-buffer) (nth 3 old))) nnimap-mailbox-info)) @@ -1084,7 +1103,9 @@ (when info (with-current-buffer nntp-server-buffer (insert (format "\"%s\" %d %d y\n" - mbx (or (nth 2 info) 0) + (mm-string-to-multibyte + (nnimap-mailbox-to-group mbx)) + (or (nth 2 info) 0) (max 1 (or (nth 1 info) 1))))))))))) (gnus-message 5 "nnimap: Generating active list%s...done" (if (> (length server) 0) (concat " for " server) "")) @@ -1145,7 +1166,8 @@ 'asyncgroups 'slowgroups) (list group (imap-mailbox-status-asynch - group '(uidvalidity uidnext unseen) + (nnimap-group-to-mailbox group) + '(uidvalidity uidnext unseen) nnimap-server-buffer)))) (dolist (asyncgroup asyncgroups) (let ((group (nth 0 asyncgroup)) @@ -1156,13 +1178,15 @@ (nth 0 (gnus-gethash (gnus-group-prefixed-name group server) nnimap-mailbox-info)) - (imap-mailbox-get 'uidvalidity group + (imap-mailbox-get 'uidvalidity + (nnimap-group-to-mailbox group) nnimap-server-buffer))) (not (string= (nth 1 (gnus-gethash (gnus-group-prefixed-name group server) nnimap-mailbox-info)) - (imap-mailbox-get 'uidnext group + (imap-mailbox-get 'uidnext + (nnimap-group-to-mailbox group) nnimap-server-buffer)))) (push (list group) slowgroups) (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name @@ -1172,14 +1196,19 @@ (if nnimap-retrieve-groups-asynchronous (setq group (car group))) (gnus-message 7 "nnimap: Mailbox %s modified" group) - (imap-mailbox-put 'uidnext nil group nnimap-server-buffer) - (or (member "\\NoSelect" (imap-mailbox-get 'list-flags group - nnimap-server-buffer)) - (let* ((info (nnimap-find-minmax-uid group 'examine)) + (imap-mailbox-put 'uidnext nil (nnimap-group-to-mailbox group) + nnimap-server-buffer) + (or (member "\\NoSelect" (imap-mailbox-get + 'list-flags + (nnimap-group-to-mailbox group) + nnimap-server-buffer)) + (let* ((info (nnimap-find-minmax-uid + (nnimap-group-to-mailbox group) 'examine)) (str (format "\"%s\" %d %d y\n" group (or (nth 2 info) 0) (max 1 (or (nth 1 info) 1))))) - (when (> (or (imap-mailbox-get 'recent group + (when (> (or (imap-mailbox-get 'recent + (nnimap-group-to-mailbox group) nnimap-server-buffer) 0) 0) (push (list (cons group 0)) nnmail-split-history)) @@ -1188,17 +1217,23 @@ (gnus-sethash (gnus-group-prefixed-name group server) (list (or (imap-mailbox-get - 'uidvalidity group nnimap-server-buffer) + 'uidvalidity (nnimap-group-to-mailbox group) + nnimap-server-buffer) (imap-mailbox-status - group 'uidvalidity nnimap-server-buffer)) + (nnimap-group-to-mailbox group) 'uidvalidity + nnimap-server-buffer)) (or (imap-mailbox-get - 'uidnext group nnimap-server-buffer) + 'uidnext (nnimap-group-to-mailbox group) + nnimap-server-buffer) (imap-mailbox-status - group 'uidnext nnimap-server-buffer)) + (nnimap-group-to-mailbox group) 'uidnext + nnimap-server-buffer)) (or (imap-mailbox-get - 'unseen group nnimap-server-buffer) + 'unseen (nnimap-group-to-mailbox group) + nnimap-server-buffer) (imap-mailbox-status - group 'unseen nnimap-server-buffer)) + (nnimap-group-to-mailbox group) 'unseen + nnimap-server-buffer)) str) nnimap-mailbox-info))))))) (gnus-message 5 "nnimap: Checking mailboxes...done") @@ -1268,7 +1303,8 @@ (when (nnimap-possibly-change-group group server) (with-current-buffer nnimap-server-buffer (let (action) - (gnus-message 7 "nnimap: Setting marks in %s..." group) + (gnus-message 7 "nnimap: Setting marks in %s..." + group) (while (setq action (pop actions)) (let ((range (nth 0 action)) (what (nth 1 action)) @@ -1309,7 +1345,8 @@ (imap-message-flags-set (imap-range-to-message-set range) (nnimap-mark-to-flag marks nil t))))))) - (gnus-message 7 "nnimap: Setting marks in %s...done" group)))) + (gnus-message 7 "nnimap: Setting marks in %s...done" + group)))) nil) (defun nnimap-split-fancy () @@ -1396,7 +1433,8 @@ article) (setq removeorig t)) ((imap-message-copy (number-to-string article) - to-group nil 'nocopyuid) + (nnimap-group-to-mailbox to-group) + nil 'nocopyuid) (message "IMAP split moved %s:%s:%d to %s" server inbox article to-group) (setq removeorig t) @@ -1460,8 +1498,10 @@ (deffoo nnimap-request-create-group (group &optional server args) (when (nnimap-possibly-change-server server) - (or (imap-mailbox-status group 'uidvalidity nnimap-server-buffer) - (imap-mailbox-create group nnimap-server-buffer) + (or (imap-mailbox-status (nnimap-group-to-mailbox group) 'uidvalidity + nnimap-server-buffer) + (imap-mailbox-create (nnimap-group-to-mailbox group) + nnimap-server-buffer) (nnheader-report 'nnimap "%S" (imap-error-text nnimap-server-buffer))))) @@ -1594,7 +1634,8 @@ nnimap-current-move-group) (imap-message-copy (number-to-string nnimap-current-move-article) - group 'dontcreate nil + (nnimap-group-to-mailbox group) + 'dontcreate nil nnimap-server-buffer)) (with-current-buffer (current-buffer) (goto-char (point-min)) @@ -1614,25 +1655,30 @@ ;; this 'or' is for Cyrus server bug (or (null (imap-current-mailbox nnimap-server-buffer)) (imap-mailbox-unselect nnimap-server-buffer)) - (imap-message-append group (current-buffer) nil nil + (imap-message-append (nnimap-group-to-mailbox group) + (current-buffer) nil nil nnimap-server-buffer))) (cons group (nth 1 uid)) (nnheader-report 'nnimap (imap-error-text nnimap-server-buffer)))))) (deffoo nnimap-request-delete-group (group force &optional server) (when (nnimap-possibly-change-server server) - (when (string= group (imap-current-mailbox nnimap-server-buffer)) + (when (string= (nnimap-group-to-mailbox group) + (imap-current-mailbox nnimap-server-buffer)) (imap-mailbox-unselect nnimap-server-buffer)) (with-current-buffer nnimap-server-buffer (if force - (or (null (imap-mailbox-status group 'uidvalidity)) - (imap-mailbox-delete group)) + (or (null (imap-mailbox-status (nnimap-group-to-mailbox group) + 'uidvalidity)) + (imap-mailbox-delete (nnimap-group-to-mailbox group))) ;; UNSUBSCRIBE? t)))) (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))) + (imap-mailbox-rename (nnimap-group-to-mailbox group) + (nnimap-group-to-mailbox new-name) + nnimap-server-buffer))) (defun nnimap-expunge (mailbox server) (when (nnimap-possibly-change-group mailbox server) Index: lisp/utf7.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/utf7.el,v retrieving revision 7.15 diff -u -r7.15 utf7.el --- lisp/utf7.el 22 Jan 2009 07:02:16 -0000 7.15 +++ lisp/utf7.el 8 Mar 2009 02:11:50 -0000 @@ -82,6 +82,10 @@ ;; Avoid versions with BOM. (= 2 (length (encode-coding-string "a" 'utf-16-be)))) 'utf-16-be) + ((and (mm-coding-system-p 'utf-16be) ; Emacs 21.3, Emacs 22 + ;; Avoid versions with BOM. + (= 2 (length (encode-coding-string "a" 'utf-16be)))) + 'utf-16be) ((mm-coding-system-p 'utf-16-be-nosig) ; ? 'utf-16-be-nosig)) "Coding system which encodes big endian UTF-16 without a BOM signature.")