diff options
| author | OGAWA Hirofumi | 2016-02-06 15:49:32 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-06 15:49:32 +1100 |
| commit | 691feae283223d94dde45f080f9c934e186dae91 (patch) | |
| tree | 5ac149bf84b177153a7a22421cae8de9377cf5c0 | |
| parent | 3ed423bc352b423960c643f297ec0f0fa3b7d2e1 (diff) | |
| download | emacs-691feae283223d94dde45f080f9c934e186dae91.tar.gz emacs-691feae283223d94dde45f080f9c934e186dae91.zip | |
Be consistent when using encoded strings in nnimap data
* lisp/gnus/nnimap.el (nnimap-encode-gnus-group): New function
(nnimap-request-list): Use it.
(nnimap-request-newgroups): Ditto.
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/gnus/nnimap.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 05251ed464a..c285befc760 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -113,6 +113,12 @@ some servers.") | |||
| 113 | 113 | ||
| 114 | (defvoo nnimap-current-infos nil) | 114 | (defvoo nnimap-current-infos nil) |
| 115 | 115 | ||
| 116 | (defun nnimap-decode-gnus-group (group) | ||
| 117 | (decode-coding-string group 'utf-8)) | ||
| 118 | |||
| 119 | (defun nnimap-encode-gnus-group (group) | ||
| 120 | (encode-coding-string group 'utf-8)) | ||
| 121 | |||
| 116 | (defvoo nnimap-fetch-partial-articles nil | 122 | (defvoo nnimap-fetch-partial-articles nil |
| 117 | "If non-nil, Gnus will fetch partial articles. | 123 | "If non-nil, Gnus will fetch partial articles. |
| 118 | If t, Gnus will fetch only the first part. If a string, it | 124 | If t, Gnus will fetch only the first part. If a string, it |
| @@ -794,9 +800,6 @@ textual parts.") | |||
| 794 | (incf num))) | 800 | (incf num))) |
| 795 | (nreverse parts))) | 801 | (nreverse parts))) |
| 796 | 802 | ||
| 797 | (defun nnimap-decode-gnus-group (group) | ||
| 798 | (decode-coding-string group 'utf-8)) | ||
| 799 | |||
| 800 | (deffoo nnimap-request-group (group &optional server dont-check info) | 803 | (deffoo nnimap-request-group (group &optional server dont-check info) |
| 801 | (setq group (nnimap-decode-gnus-group group)) | 804 | (setq group (nnimap-decode-gnus-group group)) |
| 802 | (let ((result (nnimap-change-group | 805 | (let ((result (nnimap-change-group |
| @@ -825,7 +828,7 @@ textual parts.") | |||
| 825 | (- (cdr active) (car active)) | 828 | (- (cdr active) (car active)) |
| 826 | (car active) | 829 | (car active) |
| 827 | (cdr active) | 830 | (cdr active) |
| 828 | group)) | 831 | (nnimap-encode-gnus-group group))) |
| 829 | t)))) | 832 | t)))) |
| 830 | 833 | ||
| 831 | (deffoo nnimap-request-group-scan (group &optional server info) | 834 | (deffoo nnimap-request-group-scan (group &optional server info) |
| @@ -860,7 +863,8 @@ textual parts.") | |||
| 860 | (erase-buffer) | 863 | (erase-buffer) |
| 861 | (insert | 864 | (insert |
| 862 | (format | 865 | (format |
| 863 | "211 %d %d %d %S\n" (1+ (- high low)) low high group)) | 866 | "211 %d %d %d %S\n" (1+ (- high low)) low high |
| 867 | (nnimap-encode-gnus-group group))) | ||
| 864 | t)))) | 868 | t)))) |
| 865 | 869 | ||
| 866 | (deffoo nnimap-request-create-group (group &optional server _args) | 870 | (deffoo nnimap-request-create-group (group &optional server _args) |
| @@ -1323,7 +1327,7 @@ If LIMIT, first try to limit the search to the N last articles." | |||
| 1323 | (let* ((sequence (car response)) | 1327 | (let* ((sequence (car response)) |
| 1324 | (response (cadr response)) | 1328 | (response (cadr response)) |
| 1325 | (group (cadr (assoc sequence sequences))) | 1329 | (group (cadr (assoc sequence sequences))) |
| 1326 | (egroup (encode-coding-string group 'utf-8))) | 1330 | (egroup (nnimap-encode-gnus-group group))) |
| 1327 | (when (and group | 1331 | (when (and group |
| 1328 | (equal (caar response) "OK")) | 1332 | (equal (caar response) "OK")) |
| 1329 | (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) | 1333 | (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) |
| @@ -1354,7 +1358,7 @@ If LIMIT, first try to limit the search to the N last articles." | |||
| 1354 | (nnimap-get-groups))) | 1358 | (nnimap-get-groups))) |
| 1355 | (unless (assoc group nnimap-current-infos) | 1359 | (unless (assoc group nnimap-current-infos) |
| 1356 | ;; Insert dummy numbers here -- they don't matter. | 1360 | ;; Insert dummy numbers here -- they don't matter. |
| 1357 | (insert (format "%S 0 1 y\n" (encode-coding-string group 'utf-8))))) | 1361 | (insert (format "%S 0 1 y\n" (nnimap-encode-gnus-group group))))) |
| 1358 | t))) | 1362 | t))) |
| 1359 | 1363 | ||
| 1360 | (deffoo nnimap-retrieve-group-data-early (server infos) | 1364 | (deffoo nnimap-retrieve-group-data-early (server infos) |
| @@ -1453,8 +1457,9 @@ If LIMIT, first try to limit the search to the N last articles." | |||
| 1453 | (active (gnus-active group))) | 1457 | (active (gnus-active group))) |
| 1454 | (when active | 1458 | (when active |
| 1455 | (insert (format "%S %d %d y\n" | 1459 | (insert (format "%S %d %d y\n" |
| 1456 | (decode-coding-string | 1460 | (nnimap-encode-gnus-group |
| 1457 | (gnus-group-real-name group) 'utf-8) | 1461 | (nnimap-decode-gnus-group |
| 1462 | (gnus-group-real-name group))) | ||
| 1458 | (cdr active) | 1463 | (cdr active) |
| 1459 | (car active)))))))))))) | 1464 | (car active)))))))))))) |
| 1460 | 1465 | ||
| @@ -1672,7 +1677,8 @@ If LIMIT, first try to limit the search to the N last articles." | |||
| 1672 | (nreverse result)))) | 1677 | (nreverse result)))) |
| 1673 | 1678 | ||
| 1674 | (defun nnimap-store-info (info active) | 1679 | (defun nnimap-store-info (info active) |
| 1675 | (let* ((group (gnus-group-real-name (gnus-info-group info))) | 1680 | (let* ((group (nnimap-decode-gnus-group |
| 1681 | (gnus-group-real-name (gnus-info-group info)))) | ||
| 1676 | (entry (assoc group nnimap-current-infos))) | 1682 | (entry (assoc group nnimap-current-infos))) |
| 1677 | (if entry | 1683 | (if entry |
| 1678 | (setcdr entry (list info active)) | 1684 | (setcdr entry (list info active)) |