diff options
| author | Gnus developers | 2010-09-27 23:07:47 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-09-27 23:07:47 +0000 |
| commit | 9f2d52e714dfa161c9c9393075a3bcdf056a4ac8 (patch) | |
| tree | 8649a201af266f32ee5d582c328cb20aef1b33cc | |
| parent | 8ea189f7bfe01e5313e0b95078171718ea5e0d4f (diff) | |
| download | emacs-9f2d52e714dfa161c9c9393075a3bcdf056a4ac8.tar.gz emacs-9f2d52e714dfa161c9c9393075a3bcdf056a4ac8.zip | |
Merge changes made in Gnus trunk.
sieve-manage.el (sieve-manage-default-stream): Make default stream customizable.
nnimap.el (nnimap-request-accept-article): Send a "." at the end, which may or may not help.
nnimap.el (nnimap-open-connection): Have the `network' nnimap connection use STARTTLS opportunistically.
gnus-sum.el (gnus-summary-insert-new-articles): Copy the old-high watermark so that nothing alters it while scanning for new messages.
nnimap.el (nnimap-request-accept-article): Remove the "." at the end, since some servers don't like it.
nnimap.el (nnimap-open-connection): Forget credentials if the server says the password was wrong.
nnimap.el (nnimap-parse-line): Protect against invalid data.
gnus-art.el, gnus-sum.el, nnimap.el: Allow setting the partial fetch per server instead of globally.
message.el (message-cite-prefix-regexp): Revert last edit.
nnmairix.el: Make it work with latest changes in nnimap.
gnus-sum.el (gnus-summary-move-article): Don't alter gnus-newsgroup-active.
gnus-sum.el (gnus-summary-exit): Kill the article buffer later, so that you don't get flashes of other buffers.
nnimap.el: Fix up partial nnimap fetching.
gnus-sum.el: Rework the `/ N' based on the new gnus-newsgroup-highest variable.
| -rw-r--r-- | lisp/gnus/ChangeLog | 61 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 16 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 52 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 224 | ||||
| -rw-r--r-- | lisp/gnus/nnmairix.el | 87 | ||||
| -rw-r--r-- | lisp/gnus/sieve-manage.el | 7 |
6 files changed, 279 insertions, 168 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 35cd001798d..4fcf1af9ae2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,64 @@ | |||
| 1 | 2010-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org> | 1 | 2010-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * gnus-sum.el (gnus-summary-read-group-1): Set gnus-newsgroup-highest. | ||
| 4 | (gnus-summary-insert-new-articles): Use gnus-newsgroup-highest to get | ||
| 5 | new articles. | ||
| 6 | |||
| 7 | * nnimap.el (nnimap-request-article): Don't partial-fetch single-part | ||
| 8 | parts. | ||
| 9 | (nnimap-request-article): Work with the t setting, too. | ||
| 10 | |||
| 11 | * gnus-sum.el (gnus-summary-exit): Kill the article buffer later, so | ||
| 12 | that you don't get flashes of other buffers. | ||
| 13 | (gnus-summary-show-complete-article): Intern before setting. | ||
| 14 | |||
| 15 | 2010-09-27 David Engster <dengste@eml.cc> | ||
| 16 | |||
| 17 | * nnmairix.el: (nnmairix-replace-group-and-numbers): Deal with NOV as | ||
| 18 | well as HEADERS. | ||
| 19 | (nnmairix-retrieve-headers): Provide new argument for the above. | ||
| 20 | |||
| 21 | 2010-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 22 | |||
| 23 | * gnus-sum.el (gnus-summary-move-article): Don't alter | ||
| 24 | gnus-newsgroup-active. This makes `/ N' work after copying to the same | ||
| 25 | group. | ||
| 26 | |||
| 27 | * nnimap.el (nnimap-update-info): Don't destructively alter active. | ||
| 28 | |||
| 29 | * message.el (message-cite-prefix-regexp): Revert my last edit. | ||
| 30 | |||
| 31 | * gnus-sum.el (gnus-summary-show-complete-article): Bind the server | ||
| 32 | variable instead of the Gnus variable. | ||
| 33 | |||
| 34 | * nnimap.el (nnimap-find-wanted-parts-1): Use it. | ||
| 35 | |||
| 36 | * gnus-art.el (gnus-fetch-partial-articles): Moved back to nnimap | ||
| 37 | again. | ||
| 38 | |||
| 39 | * nnimap.el (nnimap-request-accept-article): Remove the "." at the end, | ||
| 40 | since some servers don't like it. | ||
| 41 | (nnimap-open-connection): Forget credentials if the server says the | ||
| 42 | password was wrong. | ||
| 43 | (nnimap-parse-line): Protect against invalid data. | ||
| 44 | |||
| 45 | * gnus-sum.el (gnus-summary-move-article): Add comment. | ||
| 46 | (gnus-summary-insert-new-articles): Copy the old-high watermark so that | ||
| 47 | nothing alters it while scanning for new messages. | ||
| 48 | |||
| 49 | * nnimap.el (nnimap-request-accept-article): Send a "." at the end, | ||
| 50 | which may or may not help. | ||
| 51 | (nnimap-open-connection): If we're doing a stream connection, and then | ||
| 52 | discover we're on a STARTTLS-capable server, then open a STARTTLS | ||
| 53 | connection instead. | ||
| 54 | |||
| 55 | 2010-09-27 Florian Ragwitz <rafl@debian.org> (tiny change) | ||
| 56 | |||
| 57 | * sieve-manage.el (sieve-manage-default-stream): Make default stream | ||
| 58 | customizable. | ||
| 59 | |||
| 60 | 2010-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 61 | |||
| 3 | * nnimap.el (utf7): Required. | 62 | * nnimap.el (utf7): Required. |
| 4 | 63 | ||
| 5 | * message.el (message-cite-prefix-regexp): Remove "}" from citation | 64 | * message.el (message-cite-prefix-regexp): Remove "}" from citation |
| @@ -18,7 +77,7 @@ | |||
| 18 | 77 | ||
| 19 | * gnus-art.el (gnus-mime-delete-part): Fix Lisp type of byte(s). | 78 | * gnus-art.el (gnus-mime-delete-part): Fix Lisp type of byte(s). |
| 20 | 79 | ||
| 21 | 2010-09-26 Florian Ragwitz <rafl@debian.org> | 80 | 2010-09-26 Florian Ragwitz <rafl@debian.org> (tiny change) |
| 22 | 81 | ||
| 23 | * gnus-html.el (gnus-html-wash-tags): Decode URL entities to avoid | 82 | * gnus-html.el (gnus-html-wash-tags): Decode URL entities to avoid |
| 24 | handing broken links to browse-url. | 83 | handing broken links to browse-url. |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 221af8c06cd..6e5cd4d8d13 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -257,22 +257,6 @@ This can also be a list of the above values." | |||
| 257 | (regexp :value ".*")) | 257 | (regexp :value ".*")) |
| 258 | :group 'gnus-article-signature) | 258 | :group 'gnus-article-signature) |
| 259 | 259 | ||
| 260 | (defcustom gnus-fetch-partial-articles nil | ||
| 261 | "If non-nil, Gnus will fetch partial articles. | ||
| 262 | If t, nnimap will fetch only the first part. If a string, it | ||
| 263 | will fetch all parts that have types that match that string. A | ||
| 264 | likely value would be \"text/\" to automatically fetch all | ||
| 265 | textual parts. | ||
| 266 | |||
| 267 | Currently only the nnimap backend actually supports partial | ||
| 268 | article fetching. If the backend doesn't support it, it has no | ||
| 269 | effect." | ||
| 270 | :version "24.1" | ||
| 271 | :type '(choice (const nil) | ||
| 272 | (const t) | ||
| 273 | (regexp)) | ||
| 274 | :group 'gnus-article) | ||
| 275 | |||
| 276 | (defcustom gnus-hidden-properties '(invisible t intangible t) | 260 | (defcustom gnus-hidden-properties '(invisible t intangible t) |
| 277 | "Property list to use for hiding text." | 261 | "Property list to use for hiding text." |
| 278 | :type 'sexp | 262 | :type 'sexp |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 2f8abe61ee9..b8b17b39918 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -1431,6 +1431,7 @@ the type of the variable (string, integer, character, etc).") | |||
| 1431 | (defvar gnus-newsgroup-last-directory nil) | 1431 | (defvar gnus-newsgroup-last-directory nil) |
| 1432 | (defvar gnus-newsgroup-auto-expire nil) | 1432 | (defvar gnus-newsgroup-auto-expire nil) |
| 1433 | (defvar gnus-newsgroup-active nil) | 1433 | (defvar gnus-newsgroup-active nil) |
| 1434 | (defvar gnus-newsgroup-highest nil) | ||
| 1434 | 1435 | ||
| 1435 | (defvar gnus-newsgroup-data nil) | 1436 | (defvar gnus-newsgroup-data nil) |
| 1436 | (defvar gnus-newsgroup-data-reverse nil) | 1437 | (defvar gnus-newsgroup-data-reverse nil) |
| @@ -1582,6 +1583,7 @@ This list will always be a subset of gnus-newsgroup-undownloaded.") | |||
| 1582 | (gnus-summary-mark-below . global) | 1583 | (gnus-summary-mark-below . global) |
| 1583 | (gnus-orphan-score . global) | 1584 | (gnus-orphan-score . global) |
| 1584 | gnus-newsgroup-active gnus-scores-exclude-files | 1585 | gnus-newsgroup-active gnus-scores-exclude-files |
| 1586 | gnus-newsgroup-highest | ||
| 1585 | gnus-newsgroup-history gnus-newsgroup-ancient | 1587 | gnus-newsgroup-history gnus-newsgroup-ancient |
| 1586 | gnus-newsgroup-sparse gnus-newsgroup-process-stack | 1588 | gnus-newsgroup-sparse gnus-newsgroup-process-stack |
| 1587 | (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring) | 1589 | (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring) |
| @@ -3957,6 +3959,7 @@ If NO-DISPLAY, don't generate a summary buffer." | |||
| 3957 | (setq gnus-newsgroup-active | 3959 | (setq gnus-newsgroup-active |
| 3958 | (gnus-copy-sequence | 3960 | (gnus-copy-sequence |
| 3959 | (gnus-active gnus-newsgroup-name))) | 3961 | (gnus-active gnus-newsgroup-name))) |
| 3962 | (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active)) | ||
| 3960 | ;; You can change the summary buffer in some way with this hook. | 3963 | ;; You can change the summary buffer in some way with this hook. |
| 3961 | (gnus-run-hooks 'gnus-select-group-hook) | 3964 | (gnus-run-hooks 'gnus-select-group-hook) |
| 3962 | (when (memq 'summary (gnus-update-format-specifications | 3965 | (when (memq 'summary (gnus-update-format-specifications |
| @@ -7090,15 +7093,6 @@ If FORCE (the prefix), also save the .newsrc file(s)." | |||
| 7090 | (when gnus-use-scoring | 7093 | (when gnus-use-scoring |
| 7091 | (gnus-score-save))) | 7094 | (gnus-score-save))) |
| 7092 | (gnus-run-hooks 'gnus-summary-prepare-exit-hook) | 7095 | (gnus-run-hooks 'gnus-summary-prepare-exit-hook) |
| 7093 | ;; If we have several article buffers, we kill them at exit. | ||
| 7094 | (unless gnus-single-article-buffer | ||
| 7095 | (when (gnus-buffer-live-p gnus-article-buffer) | ||
| 7096 | (with-current-buffer gnus-article-buffer | ||
| 7097 | ;; Don't kill sticky article buffers | ||
| 7098 | (unless (eq major-mode 'gnus-sticky-article-mode) | ||
| 7099 | (gnus-kill-buffer gnus-article-buffer) | ||
| 7100 | (setq gnus-article-current nil)))) | ||
| 7101 | (gnus-kill-buffer gnus-original-article-buffer)) | ||
| 7102 | (when gnus-use-cache | 7096 | (when gnus-use-cache |
| 7103 | (gnus-cache-possibly-remove-articles) | 7097 | (gnus-cache-possibly-remove-articles) |
| 7104 | (gnus-cache-save-buffers)) | 7098 | (gnus-cache-save-buffers)) |
| @@ -7147,6 +7141,17 @@ If FORCE (the prefix), also save the .newsrc file(s)." | |||
| 7147 | ;; Return to group mode buffer. | 7141 | ;; Return to group mode buffer. |
| 7148 | (when (eq mode 'gnus-summary-mode) | 7142 | (when (eq mode 'gnus-summary-mode) |
| 7149 | (gnus-kill-buffer buf))) | 7143 | (gnus-kill-buffer buf))) |
| 7144 | |||
| 7145 | ;; If we have several article buffers, we kill them at exit. | ||
| 7146 | (unless gnus-single-article-buffer | ||
| 7147 | (when (gnus-buffer-live-p gnus-article-buffer) | ||
| 7148 | (with-current-buffer gnus-article-buffer | ||
| 7149 | ;; Don't kill sticky article buffers | ||
| 7150 | (unless (eq major-mode 'gnus-sticky-article-mode) | ||
| 7151 | (gnus-kill-buffer gnus-article-buffer) | ||
| 7152 | (setq gnus-article-current nil)))) | ||
| 7153 | (gnus-kill-buffer gnus-original-article-buffer)) | ||
| 7154 | |||
| 7150 | (setq gnus-current-select-method gnus-select-method) | 7155 | (setq gnus-current-select-method gnus-select-method) |
| 7151 | (set-buffer gnus-group-buffer) | 7156 | (set-buffer gnus-group-buffer) |
| 7152 | (if quit-config | 7157 | (if quit-config |
| @@ -9360,9 +9365,19 @@ article currently." | |||
| 9360 | (let ((gnus-keep-backlog nil) | 9365 | (let ((gnus-keep-backlog nil) |
| 9361 | (gnus-use-cache nil) | 9366 | (gnus-use-cache nil) |
| 9362 | (gnus-agent nil) | 9367 | (gnus-agent nil) |
| 9363 | (gnus-fetch-partial-articles nil)) | 9368 | (variable (intern |
| 9364 | (gnus-flush-original-article-buffer) | 9369 | (format "%s-fetch-partial-articles" |
| 9365 | (gnus-summary-show-article))) | 9370 | (car (gnus-find-method-for-group |
| 9371 | gnus-newsgroup-name))) | ||
| 9372 | obarray)) | ||
| 9373 | old-val) | ||
| 9374 | (unwind-protect | ||
| 9375 | (progn | ||
| 9376 | (setq old-val (symbol-value variable)) | ||
| 9377 | (set variable nil) | ||
| 9378 | (gnus-flush-original-article-buffer) | ||
| 9379 | (gnus-summary-show-article)) | ||
| 9380 | (set variable old-val)))) | ||
| 9366 | 9381 | ||
| 9367 | (defun gnus-summary-show-article (&optional arg) | 9382 | (defun gnus-summary-show-article (&optional arg) |
| 9368 | "Force redisplaying of the current article. | 9383 | "Force redisplaying of the current article. |
| @@ -9797,8 +9812,9 @@ ACTION can be either `move' (the default), `crosspost' or `copy'." | |||
| 9797 | (not (memq article gnus-newsgroup-unreads))) | 9812 | (not (memq article gnus-newsgroup-unreads))) |
| 9798 | ;; Mark this article as read in this group. | 9813 | ;; Mark this article as read in this group. |
| 9799 | (push (cons to-article gnus-read-mark) gnus-newsgroup-reads) | 9814 | (push (cons to-article gnus-read-mark) gnus-newsgroup-reads) |
| 9815 | ;; Increase the active status of this group. | ||
| 9800 | (setcdr (gnus-active to-group) to-article) | 9816 | (setcdr (gnus-active to-group) to-article) |
| 9801 | (setcdr gnus-newsgroup-active to-article)) | 9817 | (setcdr gnus-newsgroup-active to-article)) |
| 9802 | 9818 | ||
| 9803 | (while marks | 9819 | (while marks |
| 9804 | (when (eq (gnus-article-mark-to-type (cdar marks)) 'list) | 9820 | (when (eq (gnus-article-mark-to-type (cdar marks)) 'list) |
| @@ -12624,13 +12640,15 @@ If ALL is a number, fetch this number of articles." | |||
| 12624 | (interactive) | 12640 | (interactive) |
| 12625 | (prog1 | 12641 | (prog1 |
| 12626 | (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<)) | 12642 | (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<)) |
| 12627 | (old-active gnus-newsgroup-active) | 12643 | (old-high gnus-newsgroup-highest) |
| 12628 | (nnmail-fetched-sources (list t)) | 12644 | (nnmail-fetched-sources (list t)) |
| 12629 | i new) | 12645 | i new) |
| 12630 | (setq gnus-newsgroup-active | 12646 | (setq gnus-newsgroup-active |
| 12631 | (gnus-activate-group gnus-newsgroup-name 'scan)) | 12647 | (gnus-copy-sequence |
| 12632 | (setq i (cdr gnus-newsgroup-active)) | 12648 | (gnus-activate-group gnus-newsgroup-name 'scan))) |
| 12633 | (while (> i (cdr old-active)) | 12649 | (setq i (cdr gnus-newsgroup-active) |
| 12650 | gnus-newsgroup-highest i) | ||
| 12651 | (while (> i old-high) | ||
| 12634 | (push i new) | 12652 | (push i new) |
| 12635 | (decf i)) | 12653 | (decf i)) |
| 12636 | (if (not new) | 12654 | (if (not new) |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index d4e0f122269..4be9153b6df 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -85,6 +85,13 @@ some servers.") | |||
| 85 | 85 | ||
| 86 | (defvoo nnimap-current-infos nil) | 86 | (defvoo nnimap-current-infos nil) |
| 87 | 87 | ||
| 88 | (defvoo nnimap-fetch-partial-articles nil | ||
| 89 | "If non-nil, Gnus will fetch partial articles. | ||
| 90 | If t, nnimap will fetch only the first part. If a string, it | ||
| 91 | will fetch all parts that have types that match that string. A | ||
| 92 | likely value would be \"text/\" to automatically fetch all | ||
| 93 | textual parts.") | ||
| 94 | |||
| 88 | (defvar nnimap-process nil) | 95 | (defvar nnimap-process nil) |
| 89 | 96 | ||
| 90 | (defvar nnimap-status-string "") | 97 | (defvar nnimap-status-string "") |
| @@ -271,91 +278,110 @@ some servers.") | |||
| 271 | (unless nnimap-keepalive-timer | 278 | (unless nnimap-keepalive-timer |
| 272 | (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15) | 279 | (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15) |
| 273 | 'nnimap-keepalive))) | 280 | 'nnimap-keepalive))) |
| 274 | (with-current-buffer (nnimap-make-process-buffer buffer) | 281 | (block nil |
| 275 | (let* ((coding-system-for-read 'binary) | 282 | (with-current-buffer (nnimap-make-process-buffer buffer) |
| 276 | (coding-system-for-write 'binary) | 283 | (let* ((coding-system-for-read 'binary) |
| 277 | (port nil) | 284 | (coding-system-for-write 'binary) |
| 278 | (ports | 285 | (port nil) |
| 279 | (cond | 286 | (ports |
| 280 | ((eq nnimap-stream 'network) | 287 | (cond |
| 281 | (open-network-stream | 288 | ((eq nnimap-stream 'network) |
| 282 | "*nnimap*" (current-buffer) nnimap-address | 289 | (open-network-stream |
| 283 | (setq port | 290 | "*nnimap*" (current-buffer) nnimap-address |
| 284 | (or nnimap-server-port | 291 | (setq port |
| 285 | (if (netrc-find-service-number "imap") | 292 | (or nnimap-server-port |
| 286 | "imap" | 293 | (if (netrc-find-service-number "imap") |
| 287 | "143")))) | 294 | "imap" |
| 288 | '("143" "imap")) | 295 | "143")))) |
| 289 | ((eq nnimap-stream 'shell) | 296 | '("143" "imap")) |
| 290 | (nnimap-open-shell-stream | 297 | ((eq nnimap-stream 'shell) |
| 291 | "*nnimap*" (current-buffer) nnimap-address | 298 | (nnimap-open-shell-stream |
| 292 | (setq port (or nnimap-server-port "imap"))) | 299 | "*nnimap*" (current-buffer) nnimap-address |
| 293 | '("imap")) | 300 | (setq port (or nnimap-server-port "imap"))) |
| 294 | ((eq nnimap-stream 'starttls) | 301 | '("imap")) |
| 295 | (starttls-open-stream | 302 | ((eq nnimap-stream 'starttls) |
| 296 | "*nnimap*" (current-buffer) nnimap-address | 303 | (starttls-open-stream |
| 297 | (setq port (or nnimap-server-port "imap"))) | 304 | "*nnimap*" (current-buffer) nnimap-address |
| 298 | '("imap")) | 305 | (setq port (or nnimap-server-port "imap"))) |
| 299 | ((eq nnimap-stream 'ssl) | 306 | '("imap")) |
| 300 | (open-tls-stream | 307 | ((eq nnimap-stream 'ssl) |
| 301 | "*nnimap*" (current-buffer) nnimap-address | 308 | (open-tls-stream |
| 302 | (setq port | 309 | "*nnimap*" (current-buffer) nnimap-address |
| 303 | (or nnimap-server-port | 310 | (setq port |
| 304 | (if (netrc-find-service-number "imaps") | 311 | (or nnimap-server-port |
| 305 | "imaps" | 312 | (if (netrc-find-service-number "imaps") |
| 306 | "993")))) | 313 | "imaps" |
| 307 | '("143" "993" "imap" "imaps")))) | 314 | "993")))) |
| 308 | connection-result login-result credentials) | 315 | '("143" "993" "imap" "imaps")))) |
| 309 | (setf (nnimap-process nnimap-object) | 316 | connection-result login-result credentials) |
| 310 | (get-buffer-process (current-buffer))) | 317 | (setf (nnimap-process nnimap-object) |
| 311 | (if (not (and (nnimap-process nnimap-object) | 318 | (get-buffer-process (current-buffer))) |
| 312 | (memq (process-status (nnimap-process nnimap-object)) | 319 | (if (not (and (nnimap-process nnimap-object) |
| 313 | '(open run)))) | 320 | (memq (process-status (nnimap-process nnimap-object)) |
| 314 | (nnheader-report 'nnimap "Unable to contact %s:%s via %s" | 321 | '(open run)))) |
| 315 | nnimap-address port nnimap-stream) | 322 | (nnheader-report 'nnimap "Unable to contact %s:%s via %s" |
| 316 | (gnus-set-process-query-on-exit-flag (nnimap-process nnimap-object) nil) | 323 | nnimap-address port nnimap-stream) |
| 317 | (if (not (setq connection-result (nnimap-wait-for-connection))) | 324 | (gnus-set-process-query-on-exit-flag (nnimap-process nnimap-object) nil) |
| 318 | (nnheader-report 'nnimap | 325 | (if (not (setq connection-result (nnimap-wait-for-connection))) |
| 319 | "%s" (buffer-substring | 326 | (nnheader-report 'nnimap |
| 320 | (point) (line-end-position))) | 327 | "%s" (buffer-substring |
| 321 | (setf (nnimap-greeting nnimap-object) | 328 | (point) (line-end-position))) |
| 322 | (buffer-substring (line-beginning-position) | 329 | ;; Store the greeting (for debugging purposes). |
| 323 | (line-end-position))) | 330 | (setf (nnimap-greeting nnimap-object) |
| 324 | (when (eq nnimap-stream 'starttls) | 331 | (buffer-substring (line-beginning-position) |
| 325 | (nnimap-command "STARTTLS") | 332 | (line-end-position))) |
| 326 | (starttls-negotiate (nnimap-process nnimap-object))) | 333 | ;; Store the capabilities. |
| 327 | (when nnimap-server-port | ||
| 328 | (push (format "%s" nnimap-server-port) ports)) | ||
| 329 | (unless (equal connection-result "PREAUTH") | ||
| 330 | (if (not (setq credentials | ||
| 331 | (if (eq nnimap-authenticator 'anonymous) | ||
| 332 | (list "anonymous" | ||
| 333 | (message-make-address)) | ||
| 334 | (or | ||
| 335 | ;; First look for the credentials based | ||
| 336 | ;; on the virtual server name. | ||
| 337 | (nnimap-credentials | ||
| 338 | (nnoo-current-server 'nnimap) ports t) | ||
| 339 | ;; Then look them up based on the | ||
| 340 | ;; physical address. | ||
| 341 | (nnimap-credentials nnimap-address ports))))) | ||
| 342 | (setq nnimap-object nil) | ||
| 343 | (setq login-result (nnimap-command "LOGIN %S %S" | ||
| 344 | (car credentials) | ||
| 345 | (cadr credentials))) | ||
| 346 | (unless (car login-result) | ||
| 347 | (delete-process (nnimap-process nnimap-object)) | ||
| 348 | (setq nnimap-object nil)))) | ||
| 349 | (when nnimap-object | ||
| 350 | (setf (nnimap-capabilities nnimap-object) | 334 | (setf (nnimap-capabilities nnimap-object) |
| 351 | (mapcar | 335 | (mapcar |
| 352 | #'upcase | 336 | #'upcase |
| 353 | (or (nnimap-find-parameter "CAPABILITY" (cdr login-result)) | 337 | (nnimap-find-parameter |
| 354 | (nnimap-find-parameter | 338 | "CAPABILITY" (cdr (nnimap-command "CAPABILITY"))))) |
| 355 | "CAPABILITY" (cdr (nnimap-command "CAPABILITY")))))) | 339 | (when (eq nnimap-stream 'starttls) |
| 356 | (when (member "QRESYNC" (nnimap-capabilities nnimap-object)) | 340 | (nnimap-command "STARTTLS") |
| 357 | (nnimap-command "ENABLE QRESYNC")) | 341 | (starttls-negotiate (nnimap-process nnimap-object))) |
| 358 | t)))))) | 342 | ;; If this is a STARTTLS-capable server, then sever the |
| 343 | ;; connection and start a STARTTLS connection instead. | ||
| 344 | (when (and (eq nnimap-stream 'network) | ||
| 345 | (member "STARTTLS" (nnimap-capabilities nnimap-object))) | ||
| 346 | (let ((nnimap-stream 'starttls)) | ||
| 347 | (delete-process (nnimap-process nnimap-object)) | ||
| 348 | (kill-buffer (current-buffer)) | ||
| 349 | (return | ||
| 350 | (nnimap-open-connection buffer)))) | ||
| 351 | (when nnimap-server-port | ||
| 352 | (push (format "%s" nnimap-server-port) ports)) | ||
| 353 | (unless (equal connection-result "PREAUTH") | ||
| 354 | (if (not (setq credentials | ||
| 355 | (if (eq nnimap-authenticator 'anonymous) | ||
| 356 | (list "anonymous" | ||
| 357 | (message-make-address)) | ||
| 358 | (or | ||
| 359 | ;; First look for the credentials based | ||
| 360 | ;; on the virtual server name. | ||
| 361 | (nnimap-credentials | ||
| 362 | (nnoo-current-server 'nnimap) ports t) | ||
| 363 | ;; Then look them up based on the | ||
| 364 | ;; physical address. | ||
| 365 | (nnimap-credentials nnimap-address ports))))) | ||
| 366 | (setq nnimap-object nil) | ||
| 367 | (setq login-result (nnimap-command "LOGIN %S %S" | ||
| 368 | (car credentials) | ||
| 369 | (cadr credentials))) | ||
| 370 | (unless (car login-result) | ||
| 371 | ;; If the login failed, then forget the credentials | ||
| 372 | ;; that are now possibly cached. | ||
| 373 | (dolist (host (list (nnoo-current-server 'nnimap) | ||
| 374 | nnimap-address)) | ||
| 375 | (dolist (port ports) | ||
| 376 | (dolist (element '("login" "password")) | ||
| 377 | (auth-source-forget-user-or-password | ||
| 378 | element host port)))) | ||
| 379 | (delete-process (nnimap-process nnimap-object)) | ||
| 380 | (setq nnimap-object nil)))) | ||
| 381 | (when nnimap-object | ||
| 382 | (when (member "QRESYNC" (nnimap-capabilities nnimap-object)) | ||
| 383 | (nnimap-command "ENABLE QRESYNC")) | ||
| 384 | t))))))) | ||
| 359 | 385 | ||
| 360 | (defun nnimap-find-parameter (parameter elems) | 386 | (defun nnimap-find-parameter (parameter elems) |
| 361 | (let (result) | 387 | (let (result) |
| @@ -395,14 +421,12 @@ some servers.") | |||
| 395 | (erase-buffer) | 421 | (erase-buffer) |
| 396 | (with-current-buffer (nnimap-buffer) | 422 | (with-current-buffer (nnimap-buffer) |
| 397 | (erase-buffer) | 423 | (erase-buffer) |
| 398 | (when gnus-fetch-partial-articles | 424 | (when nnimap-fetch-partial-articles |
| 399 | (if (eq gnus-fetch-partial-articles t) | 425 | (nnimap-command "UID FETCH %d (BODYSTRUCTURE)" article) |
| 400 | (setq parts '(1)) | 426 | (goto-char (point-min)) |
| 401 | (nnimap-command "UID FETCH %d (BODYSTRUCTURE)" article) | 427 | (when (re-search-forward "FETCH.*BODYSTRUCTURE" nil t) |
| 402 | (goto-char (point-min)) | 428 | (setq structure (ignore-errors (read (current-buffer))) |
| 403 | (when (re-search-forward "FETCH.*BODYSTRUCTURE" nil t) | 429 | parts (nnimap-find-wanted-parts structure)))) |
| 404 | (setq structure (ignore-errors (read (current-buffer))) | ||
| 405 | parts (nnimap-find-wanted-parts structure))))) | ||
| 406 | (when (if parts | 430 | (when (if parts |
| 407 | (nnimap-get-partial-article article parts structure) | 431 | (nnimap-get-partial-article article parts structure) |
| 408 | (nnimap-get-whole-article article)) | 432 | (nnimap-get-whole-article article)) |
| @@ -525,7 +549,9 @@ some servers.") | |||
| 525 | (number-to-string num) | 549 | (number-to-string num) |
| 526 | (format "%s.%s" prefix num)))) | 550 | (format "%s.%s" prefix num)))) |
| 527 | (setcar (nthcdr 9 sub) id) | 551 | (setcar (nthcdr 9 sub) id) |
| 528 | (when (string-match gnus-fetch-partial-articles type) | 552 | (when (if (eq nnimap-fetch-partial-articles t) |
| 553 | (equal id "1") | ||
| 554 | (string-match nnimap-fetch-partial-articles type)) | ||
| 529 | (push id parts)))) | 555 | (push id parts)))) |
| 530 | (incf num))) | 556 | (incf num))) |
| 531 | (nreverse parts))) | 557 | (nreverse parts))) |
| @@ -941,7 +967,10 @@ some servers.") | |||
| 941 | (t | 967 | (t |
| 942 | ;; No articles and no uidnext. | 968 | ;; No articles and no uidnext. |
| 943 | nil))) | 969 | nil))) |
| 944 | (setcdr (gnus-active group) (or high (1- uidnext)))) | 970 | (gnus-set-active |
| 971 | group | ||
| 972 | (cons (car (gnus-active group)) | ||
| 973 | (or high (1- uidnext))))) | ||
| 945 | (when (and (not high) | 974 | (when (and (not high) |
| 946 | uidnext) | 975 | uidnext) |
| 947 | (setq high (1- uidnext))) | 976 | (setq high (1- uidnext))) |
| @@ -1193,13 +1222,18 @@ some servers.") | |||
| 1193 | (cond | 1222 | (cond |
| 1194 | ((eql char ?\[) | 1223 | ((eql char ?\[) |
| 1195 | (split-string (buffer-substring | 1224 | (split-string (buffer-substring |
| 1196 | (1+ (point)) (1- (search-forward "]"))))) | 1225 | (1+ (point)) |
| 1226 | (1- (search-forward "]" (line-end-position) 'move))))) | ||
| 1197 | ((eql char ?\() | 1227 | ((eql char ?\() |
| 1198 | (split-string (buffer-substring | 1228 | (split-string (buffer-substring |
| 1199 | (1+ (point)) (1- (search-forward ")"))))) | 1229 | (1+ (point)) |
| 1230 | (1- (search-forward ")" (line-end-position) 'move))))) | ||
| 1200 | ((eql char ?\") | 1231 | ((eql char ?\") |
| 1201 | (forward-char 1) | 1232 | (forward-char 1) |
| 1202 | (buffer-substring (point) (1- (search-forward "\"")))) | 1233 | (buffer-substring |
| 1234 | (point) | ||
| 1235 | (1- (or (search-forward "\"" (line-end-position) 'move) | ||
| 1236 | (point))))) | ||
| 1203 | (t | 1237 | (t |
| 1204 | (buffer-substring (point) (if (search-forward " " nil t) | 1238 | (buffer-substring (point) (if (search-forward " " nil t) |
| 1205 | (1- (point)) | 1239 | (1- (point)) |
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index f38ffd37e52..bca549a6832 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el | |||
| @@ -562,9 +562,8 @@ Other back ends might or might not work.") | |||
| 562 | "retrieve-headers" articles folder nnmairix-backend-server fetch-old)) | 562 | "retrieve-headers" articles folder nnmairix-backend-server fetch-old)) |
| 563 | (nnmairix-call-backend | 563 | (nnmairix-call-backend |
| 564 | "retrieve-headers" articles folder nnmairix-backend-server fetch-old))) | 564 | "retrieve-headers" articles folder nnmairix-backend-server fetch-old))) |
| 565 | (when (eq rval 'nov) | 565 | (nnmairix-replace-group-and-numbers articles folder group numcorr rval) |
| 566 | (nnmairix-replace-group-and-numbers articles folder group numcorr) | 566 | rval)) |
| 567 | rval))) | ||
| 568 | 567 | ||
| 569 | (deffoo nnmairix-request-article (article &optional group server to-buffer) | 568 | (deffoo nnmairix-request-article (article &optional group server to-buffer) |
| 570 | (when server (nnmairix-open-server server)) | 569 | (when server (nnmairix-open-server server)) |
| @@ -1413,43 +1412,55 @@ nnmairix with nnml backends." | |||
| 1413 | (setq cur lastplusone)) | 1412 | (setq cur lastplusone)) |
| 1414 | (setq lastplusone (1+ cur))))) | 1413 | (setq lastplusone (1+ cur))))) |
| 1415 | 1414 | ||
| 1416 | (defun nnmairix-replace-group-and-numbers (articles backendgroup mairixgroup numc) | 1415 | (defun nnmairix-replace-group-and-numbers (articles backendgroup mairixgroup numc type) |
| 1417 | "Replace folder names in Xref header and correct article numbers. | 1416 | "Replace folder names in Xref header and correct article numbers. |
| 1418 | Do this for all ARTICLES on BACKENDGROUP. Replace using | 1417 | Do this for all ARTICLES on BACKENDGROUP. Replace using |
| 1419 | MAIRIXGROUP. NUMC contains values for article number correction." | 1418 | MAIRIXGROUP. NUMC contains values for article number correction. |
| 1420 | (let ((buf (get-buffer-create " *nnmairix buffer*")) | 1419 | TYPE is either 'nov or 'headers." |
| 1421 | (corr (not (zerop numc))) | 1420 | (nnheader-message 7 "nnmairix: Rewriting headers...") |
| 1422 | (name (buffer-name nntp-server-buffer)) | 1421 | (cond |
| 1423 | header cur xref) | 1422 | ((eq type 'nov) |
| 1424 | (with-current-buffer buf | 1423 | (let ((buf (get-buffer-create " *nnmairix buffer*")) |
| 1425 | (erase-buffer) | 1424 | (corr (not (zerop numc))) |
| 1426 | (set-buffer nntp-server-buffer) | 1425 | (name (buffer-name nntp-server-buffer)) |
| 1427 | (goto-char (point-min)) | 1426 | header cur xref) |
| 1428 | (nnheader-message 7 "nnmairix: Rewriting headers...") | 1427 | (with-current-buffer buf |
| 1429 | (mapc | 1428 | (erase-buffer) |
| 1430 | (lambda (article) | 1429 | (set-buffer nntp-server-buffer) |
| 1431 | (when (or (looking-at (number-to-string article)) | 1430 | (goto-char (point-min)) |
| 1432 | (nnheader-find-nov-line article)) | 1431 | (mapc |
| 1433 | (setq cur (nnheader-parse-nov)) | 1432 | (lambda (article) |
| 1434 | (when corr | 1433 | (when (or (looking-at (number-to-string article)) |
| 1435 | (setq article (+ (mail-header-number cur) numc)) | 1434 | (nnheader-find-nov-line article)) |
| 1436 | (mail-header-set-number cur article)) | 1435 | (setq cur (nnheader-parse-nov)) |
| 1437 | (setq xref (mail-header-xref cur)) | 1436 | (when corr |
| 1438 | (when (and (stringp xref) | 1437 | (setq article (+ (mail-header-number cur) numc)) |
| 1439 | (string-match (format "[ \t]%s:[0-9]+" backendgroup) xref)) | 1438 | (mail-header-set-number cur article)) |
| 1440 | (setq xref (replace-match (format " %s:%d" mairixgroup article) t nil xref)) | 1439 | (setq xref (mail-header-xref cur)) |
| 1441 | (mail-header-set-xref cur xref)) | 1440 | (when (and (stringp xref) |
| 1442 | (set-buffer buf) | 1441 | (string-match (format "[ \t]%s:[0-9]+" backendgroup) xref)) |
| 1443 | (nnheader-insert-nov cur) | 1442 | (setq xref (replace-match (format " %s:%d" mairixgroup article) t nil xref)) |
| 1444 | (set-buffer nntp-server-buffer) | 1443 | (mail-header-set-xref cur xref)) |
| 1445 | (when (not (eobp)) | 1444 | (set-buffer buf) |
| 1446 | (forward-line 1)))) | 1445 | (nnheader-insert-nov cur) |
| 1447 | articles) | 1446 | (set-buffer nntp-server-buffer) |
| 1448 | (nnheader-message 7 "nnmairix: Rewriting headers... done") | 1447 | (when (not (eobp)) |
| 1449 | (kill-buffer nntp-server-buffer) | 1448 | (forward-line 1)))) |
| 1450 | (set-buffer buf) | 1449 | articles) |
| 1451 | (rename-buffer name) | 1450 | (kill-buffer nntp-server-buffer) |
| 1452 | (setq nntp-server-buffer buf)))) | 1451 | (set-buffer buf) |
| 1452 | (rename-buffer name) | ||
| 1453 | (setq nntp-server-buffer buf)))) | ||
| 1454 | ((and (eq type 'headers) | ||
| 1455 | (not (zerop numc))) | ||
| 1456 | (with-current-buffer nntp-server-buffer | ||
| 1457 | (save-excursion | ||
| 1458 | (goto-char (point-min)) | ||
| 1459 | (while (re-search-forward "^[23][0-9]+ \\([0-9]+\\)" nil t) | ||
| 1460 | (replace-match (number-to-string | ||
| 1461 | (+ (string-to-number (match-string 1)) numc)) | ||
| 1462 | t t nil 1)))))) | ||
| 1463 | (nnheader-message 7 "nnmairix: Rewriting headers... done")) | ||
| 1453 | 1464 | ||
| 1454 | (defun nnmairix-backend-to-server (server) | 1465 | (defun nnmairix-backend-to-server (server) |
| 1455 | "Return nnmairix server most probably responsible for back end SERVER. | 1466 | "Return nnmairix server most probably responsible for back end SERVER. |
diff --git a/lisp/gnus/sieve-manage.el b/lisp/gnus/sieve-manage.el index 0f16444ca39..8749864d81b 100644 --- a/lisp/gnus/sieve-manage.el +++ b/lisp/gnus/sieve-manage.el | |||
| @@ -162,6 +162,12 @@ for doing the actual authentication." | |||
| 162 | :type 'integer | 162 | :type 'integer |
| 163 | :group 'sieve-manage) | 163 | :group 'sieve-manage) |
| 164 | 164 | ||
| 165 | (defcustom sieve-manage-default-stream 'network | ||
| 166 | "Default stream type to use for `sieve-manage'. | ||
| 167 | Must be a name of a stream in `sieve-manage-stream-alist'." | ||
| 168 | :type 'symbol | ||
| 169 | :group 'sieve-manage) | ||
| 170 | |||
| 165 | ;; Internal variables: | 171 | ;; Internal variables: |
| 166 | 172 | ||
| 167 | (defconst sieve-manage-local-variables '(sieve-manage-server | 173 | (defconst sieve-manage-local-variables '(sieve-manage-server |
| @@ -174,7 +180,6 @@ for doing the actual authentication." | |||
| 174 | sieve-manage-client-eol | 180 | sieve-manage-client-eol |
| 175 | sieve-manage-server-eol | 181 | sieve-manage-server-eol |
| 176 | sieve-manage-capability)) | 182 | sieve-manage-capability)) |
| 177 | (defconst sieve-manage-default-stream 'network) | ||
| 178 | (defconst sieve-manage-coding-system-for-read 'binary) | 183 | (defconst sieve-manage-coding-system-for-read 'binary) |
| 179 | (defconst sieve-manage-coding-system-for-write 'binary) | 184 | (defconst sieve-manage-coding-system-for-write 'binary) |
| 180 | (defvar sieve-manage-stream nil) | 185 | (defvar sieve-manage-stream nil) |