Mercurial > emacs
annotate lisp/gnus/nnimap.el @ 110585:677b6dea1d61
gnus-sum.el (gnus-auto-center-group): Transform into a defcustom.
gnus.el (gnus-group-fast-parameter): Return the last matching parameter instead of the first matching parameter.
auth-source.el (auth-source-user-or-password): Query for password, although there are no existing auth sources.
auth-source.el (auth-source-user-or-password): Use the existing auth sources, if any, for creation.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sun, 26 Sep 2010 12:47:09 +0000 |
parents | b6d2a63ad993 |
children | e474d7d76259 |
rev | line source |
---|---|
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1 ;;; nnimap.el --- IMAP interface for Gnus |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
2 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
3 ;; Copyright (C) 2010 Free Software Foundation, Inc. |
31717 | 4 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
6 ;; Simon Josefsson <simon@josefsson.org> |
31717 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93820
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
31717 | 11 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93820
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93820
diff
changeset
|
13 ;; (at your option) any later version. |
31717 | 14 |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93820
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31717 | 18 ;; GNU General Public License for more details. |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93820
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
31717 | 22 |
23 ;;; Commentary: | |
24 | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
25 ;; nnimap interfaces Gnus with IMAP servers. |
31717 | 26 |
27 ;;; Code: | |
28 | |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
29 (eval-and-compile |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
30 (require 'nnheader)) |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
31 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
32 (eval-when-compile |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
33 (require 'cl)) |
31717 | 34 |
110419
bde55f3d7125
* nnimap.el: Require nnoo and other files necessary.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110410
diff
changeset
|
35 (require 'nnheader) |
bde55f3d7125
* nnimap.el: Require nnoo and other files necessary.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110410
diff
changeset
|
36 (require 'gnus-util) |
bde55f3d7125
* nnimap.el: Require nnoo and other files necessary.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110410
diff
changeset
|
37 (require 'gnus) |
bde55f3d7125
* nnimap.el: Require nnoo and other files necessary.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110410
diff
changeset
|
38 (require 'nnoo) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
39 (require 'netrc) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
40 (require 'parse-time) |
94837 | 41 |
31717 | 42 (nnoo-declare nnimap) |
43 | |
44 (defvoo nnimap-address nil | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
45 "The address of the IMAP server.") |
31717 | 46 |
47 (defvoo nnimap-server-port nil | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
48 "The IMAP port used. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
49 If nnimap-stream is `ssl', this will default to `imaps'. If not, |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
50 it will default to `imap'.") |
31717 | 51 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
52 (defvoo nnimap-stream 'ssl |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
53 "How nnimap will talk to the IMAP server. |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
54 Values are `ssl', `network', `starttls' or `shell'.") |
31717 | 55 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
56 (defvoo nnimap-shell-program (if (boundp 'imap-shell-program) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
57 (if (listp imap-shell-program) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
58 (car imap-shell-program) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
59 imap-shell-program) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
60 "ssh %s imapd")) |
31717 | 61 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
62 (defvoo nnimap-inbox nil |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
63 "The mail box where incoming mail arrives and should be split out of.") |
31717 | 64 |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
65 (defvoo nnimap-split-methods nil |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
66 "How mail is split. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
67 Uses the same syntax as nnmail-split-methods") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
68 |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
69 (defvoo nnimap-authenticator nil |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
70 "How nnimap authenticate itself to the server. |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
71 Possible choices are nil (use default methods) or `anonymous'.") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
72 |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
73 (defvoo nnimap-expunge t |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
74 "If non-nil, expunge articles after deleting them. |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
75 This is always done if the server supports UID EXPUNGE, but it's |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
76 not done by default on servers that doesn't support that command.") |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
77 |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
78 (defvoo nnimap-streaming t |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
79 "If non-nil, try to use streaming commands with IMAP servers. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
80 Switching this off will make nnimap slower, but it helps with |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
81 some servers.") |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
82 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
83 (defvoo nnimap-connection-alist nil) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
84 |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
85 (defvoo nnimap-current-infos nil) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
86 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
87 (defvar nnimap-process nil) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
88 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
89 (defvar nnimap-status-string "") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
90 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
91 (defvar nnimap-split-download-body-default nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
92 "Internal variable with default value for `nnimap-split-download-body'.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
93 |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
94 (defvar nnimap-keepalive-timer nil) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
95 (defvar nnimap-process-buffers nil) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
96 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
97 (defstruct nnimap |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
98 group process commands capabilities select-result newlinep server |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
99 last-command-time) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
100 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
101 (defvar nnimap-object nil) |
31717 | 102 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
103 (defvar nnimap-mark-alist |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
104 '((read "\\Seen" %Seen) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
105 (tick "\\Flagged" %Flagged) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
106 (reply "\\Answered" %Answered) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
107 (expire "gnus-expire") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
108 (dormant "gnus-dormant") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
109 (score "gnus-score") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
110 (save "gnus-save") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
111 (download "gnus-download") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
112 (forward "gnus-forward"))) |
31717 | 113 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
114 (defun nnimap-buffer () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
115 (nnimap-find-process-buffer nntp-server-buffer)) |
31717 | 116 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
117 (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
118 (with-current-buffer nntp-server-buffer |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
119 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
120 (when (nnimap-possibly-change-group group server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
121 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
122 (nnimap-send-command "SELECT %S" (utf7-encode group t)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
123 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
124 (nnimap-wait-for-response |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
125 (nnimap-send-command |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
126 "UID FETCH %s %s" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
127 (nnimap-article-ranges (gnus-compress-sequence articles)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
128 (format "(UID RFC822.SIZE BODYSTRUCTURE %s)" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
129 (format |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
130 (if (nnimap-ver4-p) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
131 "BODY.PEEK[HEADER.FIELDS %s]" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
132 "RFC822.HEADER.LINES %s") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
133 (append '(Subject From Date Message-Id |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
134 References In-Reply-To Xref) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
135 nnmail-extra-headers)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
136 t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
137 (nnimap-transform-headers)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
138 (insert-buffer-substring |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
139 (nnimap-find-process-buffer (current-buffer)))) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
140 'headers)) |
31717 | 141 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
142 (defun nnimap-transform-headers () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
143 (goto-char (point-min)) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
144 (let (article bytes lines size string) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
145 (block nil |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
146 (while (not (eobp)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
147 (while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
148 (delete-region (point) (progn (forward-line 1) (point))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
149 (when (eobp) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
150 (return))) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
151 (setq article (match-string 1)) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
152 ;; Unfold quoted {number} strings. |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
153 (while (re-search-forward "[^]] {\\([0-9]+\\)}\r\n" |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
154 (1+ (line-end-position)) t) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
155 (setq size (string-to-number (match-string 1))) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
156 (delete-region (+ (match-beginning 0) 2) (point)) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
157 (setq string (delete-region (point) (+ (point) size))) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
158 (insert (format "%S" string))) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
159 (setq bytes (nnimap-get-length) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
160 lines nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
161 (beginning-of-line) |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
162 (setq size |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
163 (and (re-search-forward "RFC822.SIZE \\([0-9]+\\)" |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
164 (line-end-position) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
165 t) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
166 (match-string 1))) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
167 (beginning-of-line) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
168 (when (search-forward "BODYSTRUCTURE" (line-end-position) t) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
169 (let ((structure (ignore-errors |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
170 (read (current-buffer))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
171 (while (and (consp structure) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
172 (not (stringp (car structure)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
173 (setq structure (car structure))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
174 (setq lines (nth 7 structure)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
175 (delete-region (line-beginning-position) (line-end-position)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
176 (insert (format "211 %s Article retrieved." article)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
177 (forward-line 1) |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
178 (when size |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
179 (insert (format "Chars: %s\n" size))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
180 (when lines |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
181 (insert (format "Lines: %s\n" lines))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
182 (re-search-forward "^\r$") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
183 (delete-region (line-beginning-position) (line-end-position)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
184 (insert ".") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
185 (forward-line 1))))) |
31717 | 186 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
187 (defun nnimap-get-length () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
188 (and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
189 (string-to-number (match-string 1)))) |
31717 | 190 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
191 (defun nnimap-article-ranges (ranges) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
192 (let (result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
193 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
194 ((numberp ranges) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
195 (number-to-string ranges)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
196 ((numberp (cdr ranges)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
197 (format "%d:%d" (car ranges) (cdr ranges))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
198 (t |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
199 (dolist (elem ranges) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
200 (push |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
201 (if (consp elem) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
202 (format "%d:%d" (car elem) (cdr elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
203 (number-to-string elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
204 result)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
205 (mapconcat #'identity (nreverse result) ","))))) |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
206 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
207 (deffoo nnimap-open-server (server &optional defs) |
31717 | 208 (if (nnimap-server-opened server) |
209 t | |
210 (unless (assq 'nnimap-address defs) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
211 (setq defs (append defs (list (list 'nnimap-address server))))) |
31717 | 212 (nnoo-change-server 'nnimap server defs) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
213 (or (nnimap-find-connection nntp-server-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
214 (nnimap-open-connection nntp-server-buffer)))) |
31717 | 215 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
216 (defun nnimap-make-process-buffer (buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
217 (with-current-buffer |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
218 (generate-new-buffer (format "*nnimap %s %s %s*" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
219 nnimap-address nnimap-server-port |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
220 (gnus-buffer-exists-p buffer))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
221 (mm-disable-multibyte) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
222 (buffer-disable-undo) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
223 (gnus-add-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
224 (set (make-local-variable 'after-change-functions) nil) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
225 (set (make-local-variable 'nnimap-object) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
226 (make-nnimap :server (nnoo-current-server 'nnimap))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
227 (push (list buffer (current-buffer)) nnimap-connection-alist) |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
228 (push (current-buffer) nnimap-process-buffers) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
229 (current-buffer))) |
31717 | 230 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
231 (defun nnimap-open-shell-stream (name buffer host port) |
110428
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
232 (let ((process-connection-type nil)) |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
233 (start-process name buffer shell-file-name |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
234 shell-command-switch |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
235 (format-spec |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
236 nnimap-shell-program |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
237 (format-spec-make |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
238 ?s host |
6060b86fc551
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
239 ?p port))))) |
31717 | 240 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
241 (defun nnimap-credentials (address ports) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
242 (let (port credentials) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
243 ;; Request the credentials from all ports, but only query on the |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
244 ;; last port if all the previous ones have failed. |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
245 (while (and (null credentials) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
246 (setq port (pop ports))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
247 (setq credentials |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
248 (auth-source-user-or-password |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
249 '("login" "password") address port nil (null ports)))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
250 credentials)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
251 |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
252 (defun nnimap-keepalive () |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
253 (let ((now (current-time))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
254 (dolist (buffer nnimap-process-buffers) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
255 (when (buffer-name buffer) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
256 (with-current-buffer buffer |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
257 (when (and nnimap-object |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
258 (nnimap-last-command-time nnimap-object) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
259 (> (time-to-seconds |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
260 (time-subtract |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
261 now |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
262 (nnimap-last-command-time nnimap-object))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
263 ;; More than five minutes since the last command. |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
264 (* 5 60))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
265 (nnimap-send-command "NOOP"))))))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
266 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
267 (defun nnimap-open-connection (buffer) |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
268 (unless nnimap-keepalive-timer |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
269 (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
270 'nnimap-keepalive))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
271 (with-current-buffer (nnimap-make-process-buffer buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
272 (let* ((coding-system-for-read 'binary) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
273 (coding-system-for-write 'binary) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
274 (port nil) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
275 (ports |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
276 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
277 ((eq nnimap-stream 'network) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
278 (open-network-stream |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
279 "*nnimap*" (current-buffer) nnimap-address |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
280 (setq port |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
281 (or nnimap-server-port |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
282 (if (netrc-find-service-number "imap") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
283 "imap" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
284 "143")))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
285 '("143" "imap")) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
286 ((eq nnimap-stream 'shell) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
287 (nnimap-open-shell-stream |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
288 "*nnimap*" (current-buffer) nnimap-address |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
289 (setq port (or nnimap-server-port "imap"))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
290 '("imap")) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
291 ((eq nnimap-stream 'starttls) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
292 (starttls-open-stream |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
293 "*nnimap*" (current-buffer) nnimap-address |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
294 (setq port (or nnimap-server-port "imap"))) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
295 '("imap")) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
296 ((eq nnimap-stream 'ssl) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
297 (open-tls-stream |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
298 "*nnimap*" (current-buffer) nnimap-address |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
299 (setq port |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
300 (or nnimap-server-port |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
301 (if (netrc-find-service-number "imaps") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
302 "imaps" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
303 "993")))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
304 '("143" "993" "imap" "imaps")))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
305 connection-result login-result credentials) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
306 (setf (nnimap-process nnimap-object) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
307 (get-buffer-process (current-buffer))) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
308 (if (not (and (nnimap-process nnimap-object) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
309 (memq (process-status (nnimap-process nnimap-object)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
310 '(open run)))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
311 (nnheader-report 'nnimap "Unable to contact %s:%s via %s" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
312 nnimap-address port nnimap-stream) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
313 (gnus-set-process-query-on-exit-flag (nnimap-process nnimap-object) nil) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
314 (if (not (setq connection-result (nnimap-wait-for-connection))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
315 (nnheader-report 'nnimap |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
316 "%s" (buffer-substring |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
317 (point) (line-end-position))) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
318 (when (eq nnimap-stream 'starttls) |
110568
04b79dd168dd
nnimap.el (nnimap-open-connection): Wait for the response to STARTTLS before starting negotiation.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110555
diff
changeset
|
319 (nnimap-command "STARTTLS") |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
320 (starttls-negotiate (nnimap-process nnimap-object))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
321 (unless (equal connection-result "PREAUTH") |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
322 (if (not (setq credentials |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
323 (if (eq nnimap-authenticator 'anonymous) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
324 (list "anonymous" |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
325 (message-make-address)) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
326 (nnimap-credentials |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
327 nnimap-address |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
328 (if nnimap-server-port |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
329 (cons (format "%s" nnimap-server-port) ports) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
330 ports))))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
331 (setq nnimap-object nil) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
332 (setq login-result (nnimap-command "LOGIN %S %S" |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
333 (car credentials) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
334 (cadr credentials))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
335 (unless (car login-result) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
336 (delete-process (nnimap-process nnimap-object)) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
337 (setq nnimap-object nil)))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
338 (when nnimap-object |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
339 (setf (nnimap-capabilities nnimap-object) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
340 (mapcar |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
341 #'upcase |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
342 (or (nnimap-find-parameter "CAPABILITY" (cdr login-result)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
343 (nnimap-find-parameter |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
344 "CAPABILITY" (cdr (nnimap-command "CAPABILITY")))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
345 (when (member "QRESYNC" (nnimap-capabilities nnimap-object)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
346 (nnimap-command "ENABLE QRESYNC")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
347 t)))))) |
31717 | 348 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
349 (defun nnimap-find-parameter (parameter elems) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
350 (let (result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
351 (dolist (elem elems) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
352 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
353 ((equal (car elem) parameter) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
354 (setq result (cdr elem))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
355 ((and (equal (car elem) "OK") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
356 (consp (cadr elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
357 (equal (caadr elem) parameter)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
358 (setq result (cdr (cadr elem)))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
359 result)) |
31717 | 360 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
361 (deffoo nnimap-close-server (&optional server) |
31717 | 362 t) |
363 | |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
364 (deffoo nnimap-request-close () |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
365 t) |
31717 | 366 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
367 (deffoo nnimap-server-opened (&optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
368 (and (nnoo-current-server-p 'nnimap server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
369 nntp-server-buffer |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
370 (gnus-buffer-live-p nntp-server-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
371 (nnimap-find-connection nntp-server-buffer))) |
31717 | 372 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
373 (deffoo nnimap-status-message (&optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
374 nnimap-status-string) |
31717 | 375 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
376 (deffoo nnimap-request-article (article &optional group server to-buffer) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
377 (with-current-buffer nntp-server-buffer |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
378 (let ((result (nnimap-possibly-change-group group server)) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
379 parts structure) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
380 (when (stringp article) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
381 (setq article (nnimap-find-article-by-message-id group article))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
382 (when (and result |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
383 article) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
384 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
385 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
386 (erase-buffer) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
387 (when gnus-fetch-partial-articles |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
388 (if (eq gnus-fetch-partial-articles t) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
389 (setq parts '(1)) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
390 (nnimap-command "UID FETCH %d (BODYSTRUCTURE)" article) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
391 (goto-char (point-min)) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
392 (when (re-search-forward "FETCH.*BODYSTRUCTURE" nil t) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
393 (setq structure (ignore-errors (read (current-buffer))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
394 parts (nnimap-find-wanted-parts structure))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
395 (when (if parts |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
396 (nnimap-get-partial-article article parts structure) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
397 (nnimap-get-whole-article article)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
398 (let ((buffer (current-buffer))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
399 (with-current-buffer (or to-buffer nntp-server-buffer) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
400 (erase-buffer) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
401 (insert-buffer-substring buffer) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
402 (nnheader-ms-strip-cr) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
403 (cons group article))))))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
404 |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
405 (defun nnimap-get-whole-article (article) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
406 (let ((result |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
407 (nnimap-command |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
408 (if (nnimap-ver4-p) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
409 "UID FETCH %d BODY.PEEK[]" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
410 "UID FETCH %d RFC822.PEEK") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
411 article))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
412 ;; Check that we really got an article. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
413 (goto-char (point-min)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
414 (unless (looking-at "\\* [0-9]+ FETCH") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
415 (setq result nil)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
416 (when result |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
417 (goto-char (point-min)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
418 (let ((bytes (nnimap-get-length))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
419 (delete-region (line-beginning-position) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
420 (progn (forward-line 1) (point))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
421 (goto-char (+ (point) bytes)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
422 (delete-region (point) (point-max))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
423 t))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
424 |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
425 (defun nnimap-ver4-p () |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
426 (member "IMAP4REV1" (nnimap-capabilities nnimap-object))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
427 |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
428 (defun nnimap-get-partial-article (article parts structure) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
429 (let ((result |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
430 (nnimap-command |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
431 "UID FETCH %d (%s %s)" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
432 article |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
433 (if (nnimap-ver4-p) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
434 "BODY.PEEK[HEADER]" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
435 "RFC822.HEADER") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
436 (if (nnimap-ver4-p) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
437 (mapconcat (lambda (part) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
438 (format "BODY.PEEK[%s]" part)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
439 parts " ") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
440 (mapconcat (lambda (part) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
441 (format "RFC822.PEEK[%s]" part)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
442 parts " "))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
443 (when result |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
444 (nnimap-convert-partial-article structure)))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
445 |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
446 (defun nnimap-convert-partial-article (structure) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
447 ;; First just skip past the headers. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
448 (goto-char (point-min)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
449 (let ((bytes (nnimap-get-length)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
450 id parts) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
451 ;; Delete "FETCH" line. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
452 (delete-region (line-beginning-position) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
453 (progn (forward-line 1) (point))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
454 (goto-char (+ (point) bytes)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
455 ;; Collect all the body parts. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
456 (while (looking-at ".*BODY\\[\\([.0-9]+\\)\\]") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
457 (setq id (match-string 1) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
458 bytes (nnimap-get-length)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
459 (beginning-of-line) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
460 (delete-region (point) (progn (forward-line 1) (point))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
461 (push (list id (buffer-substring (point) (+ (point) bytes))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
462 parts) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
463 (delete-region (point) (+ (point) bytes))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
464 ;; Delete trailing junk. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
465 (delete-region (point) (point-max)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
466 ;; Now insert all the parts again where they fit in the structure. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
467 (nnimap-insert-partial-structure structure parts) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
468 t)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
469 |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
470 (defun nnimap-insert-partial-structure (structure parts &optional subp) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
471 (let ((type (car (last structure 4))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
472 (boundary (cadr (member "BOUNDARY" (car (last structure 3)))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
473 (when subp |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
474 (insert (format "Content-type: multipart/%s; boundary=%S\n\n" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
475 (downcase type) boundary))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
476 (while (not (stringp (car structure))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
477 (insert "\n--" boundary "\n") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
478 (if (consp (caar structure)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
479 (nnimap-insert-partial-structure (pop structure) parts t) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
480 (let ((bit (pop structure))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
481 (insert (format "Content-type: %s/%s" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
482 (downcase (nth 0 bit)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
483 (downcase (nth 1 bit)))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
484 (if (member "CHARSET" (nth 2 bit)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
485 (insert (format |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
486 "; charset=%S\n" (cadr (member "CHARSET" (nth 2 bit))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
487 (insert "\n")) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
488 (insert (format "Content-transfer-encoding: %s\n" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
489 (nth 5 bit))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
490 (insert "\n") |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
491 (when (assoc (nth 9 bit) parts) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
492 (insert (cadr (assoc (nth 9 bit) parts))))))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
493 (insert "\n--" boundary "--\n"))) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
494 |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
495 (defun nnimap-find-wanted-parts (structure) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
496 (message-flatten-list (nnimap-find-wanted-parts-1 structure ""))) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
497 |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
498 (defun nnimap-find-wanted-parts-1 (structure prefix) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
499 (let ((num 1) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
500 parts) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
501 (while (consp (car structure)) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
502 (let ((sub (pop structure))) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
503 (if (consp (car sub)) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
504 (push (nnimap-find-wanted-parts-1 |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
505 sub (if (string= prefix "") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
506 (number-to-string num) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
507 (format "%s.%s" prefix num))) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
508 parts) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
509 (let ((type (format "%s/%s" (nth 0 sub) (nth 1 sub))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
510 (id (if (string= prefix "") |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
511 (number-to-string num) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
512 (format "%s.%s" prefix num)))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
513 (setcar (nthcdr 9 sub) id) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
514 (when (string-match gnus-fetch-partial-articles type) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
515 (push id parts)))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
516 (incf num))) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
517 (nreverse parts))) |
31717 | 518 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
519 (deffoo nnimap-request-group (group &optional server dont-check info) |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
520 (let ((result (nnimap-possibly-change-group group server)) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
521 articles active marks high low) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
522 (with-current-buffer nntp-server-buffer |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
523 (when result |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
524 (if (and dont-check |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
525 (setq active (nth 2 (assoc group nnimap-current-infos)))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
526 (insert (format "211 %d %d %d %S\n" |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
527 (- (cdr active) (car active)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
528 (car active) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
529 (cdr active) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
530 group)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
531 (with-current-buffer (nnimap-buffer) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
532 (erase-buffer) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
533 (let ((group-sequence |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
534 (nnimap-send-command "SELECT %S" (utf7-encode group t))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
535 (flag-sequence |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
536 (nnimap-send-command "UID FETCH 1:* FLAGS"))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
537 (nnimap-wait-for-response flag-sequence) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
538 (setq marks |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
539 (nnimap-flags-to-marks |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
540 (nnimap-parse-flags |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
541 (list (list group-sequence flag-sequence 1 group))))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
542 (when info |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
543 (nnimap-update-infos marks (list info))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
544 (goto-char (point-max)) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
545 (let ((uidnext (nth 5 (car marks)))) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
546 (setq high (if uidnext |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
547 (1- uidnext) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
548 (nth 3 (car marks))) |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
549 low (or (nth 4 (car marks)) uidnext))))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
550 (erase-buffer) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
551 (insert |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
552 (format |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
553 "211 %d %d %d %S\n" (1+ (- high low)) low high group))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
554 t)))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
555 |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
556 (deffoo nnimap-request-create-group (group &optional server args) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
557 (when (nnimap-possibly-change-group nil server) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
558 (with-current-buffer (nnimap-buffer) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
559 (car (nnimap-command "CREATE %S" (utf7-encode group t)))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
560 |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
561 (deffoo nnimap-request-delete-group (group &optional force server) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
562 (when (nnimap-possibly-change-group nil server) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
563 (with-current-buffer (nnimap-buffer) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
564 (car (nnimap-command "DELETE %S" (utf7-encode group t)))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
565 |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
566 (deffoo nnimap-request-expunge-group (group &optional server) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
567 (when (nnimap-possibly-change-group group server) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
568 (with-current-buffer (nnimap-buffer) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
569 (car (nnimap-command "EXPUNGE"))))) |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
570 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
571 (defun nnimap-get-flags (spec) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
572 (let ((articles nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
573 elems) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
574 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
575 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
576 (nnimap-wait-for-response (nnimap-send-command |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
577 "UID FETCH %s FLAGS" spec)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
578 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
579 (while (re-search-forward "^\\* [0-9]+ FETCH (\\(.*\\))" nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
580 (setq elems (nnimap-parse-line (match-string 1))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
581 (push (cons (string-to-number (cadr (member "UID" elems))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
582 (cadr (member "FLAGS" elems))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
583 articles))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
584 (nreverse articles))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
585 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
586 (deffoo nnimap-close-group (group &optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
587 t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
588 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
589 (deffoo nnimap-request-move-article (article group server accept-form |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
590 &optional last internal-move-group) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
591 (with-temp-buffer |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
592 (when (nnimap-request-article article group server (current-buffer)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
593 ;; If the move is internal (on the same server), just do it the easy |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
594 ;; way. |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
595 (let ((message-id (message-field-value "message-id"))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
596 (if internal-move-group |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
597 (let ((result |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
598 (with-current-buffer (nnimap-buffer) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
599 (nnimap-command "UID COPY %d %S" |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
600 article |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
601 (utf7-encode internal-move-group t))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
602 (when (car result) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
603 (nnimap-delete-article article) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
604 (cons internal-move-group |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
605 (nnimap-find-article-by-message-id |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
606 internal-move-group message-id)))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
607 ;; Move the article to a different method. |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
608 (let ((result (eval accept-form))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
609 (when result |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
610 (nnimap-delete-article article) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
611 result))))))) |
31717 | 612 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
613 (deffoo nnimap-request-expire-articles (articles group &optional server force) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
614 (cond |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
615 ((null articles) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
616 nil) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
617 ((not (nnimap-possibly-change-group group server)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
618 articles) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
619 ((and force |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
620 (eq nnmail-expiry-target 'delete)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
621 (unless (nnimap-delete-article articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
622 (message "Article marked for deletion, but not expunged.")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
623 nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
624 (t |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
625 (let ((deletable-articles |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
626 (if (or force |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
627 (eq nnmail-expiry-wait 'immediate)) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
628 articles |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
629 (gnus-sorted-intersection |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
630 articles |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
631 (nnimap-find-expired-articles group))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
632 (if (null deletable-articles) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
633 articles |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
634 (if (eq nnmail-expiry-target 'delete) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
635 (nnimap-delete-article deletable-articles) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
636 (setq deletable-articles |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
637 (nnimap-process-expiry-targets |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
638 deletable-articles group server))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
639 ;; Return the articles we didn't delete. |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
640 (gnus-sorted-complement articles deletable-articles)))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
641 |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
642 (defun nnimap-process-expiry-targets (articles group server) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
643 (let ((deleted-articles nil)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
644 (dolist (article articles) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
645 (let ((target nnmail-expiry-target)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
646 (with-temp-buffer |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
647 (when (nnimap-request-article article group server (current-buffer)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
648 (message "Expiring article %s:%d" group article) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
649 (when (functionp target) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
650 (setq target (funcall target group))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
651 (when (and target |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
652 (not (eq target 'delete))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
653 (if (or (gnus-request-group target t) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
654 (gnus-request-create-group target)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
655 (nnmail-expiry-target-group target group) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
656 (setq target nil))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
657 (when target |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
658 (push article deleted-articles)))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
659 ;; Change back to the current group again. |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
660 (nnimap-possibly-change-group group server) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
661 (setq deleted-articles (nreverse deleted-articles)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
662 (nnimap-delete-article deleted-articles) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
663 deleted-articles)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
664 |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
665 (defun nnimap-find-expired-articles (group) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
666 (let ((cutoff (nnmail-expired-article-p group nil nil))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
667 (with-current-buffer (nnimap-buffer) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
668 (let ((result |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
669 (nnimap-command |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
670 "UID SEARCH SENTBEFORE %s" |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
671 (format-time-string |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
672 (format "%%d-%s-%%Y" |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
673 (upcase |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
674 (car (rassoc (nth 4 (decode-time cutoff)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
675 parse-time-months)))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
676 cutoff)))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
677 (and (car result) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
678 (delete 0 (mapcar #'string-to-number |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
679 (cdr (assoc "SEARCH" (cdr result)))))))))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
680 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
681 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
682 (defun nnimap-find-article-by-message-id (group message-id) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
683 (when (nnimap-possibly-change-group group nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
684 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
685 (let ((result |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
686 (nnimap-command "UID SEARCH HEADER Message-Id %S" message-id)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
687 article) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
688 (when (car result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
689 ;; Select the last instance of the message in the group. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
690 (and (setq article |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
691 (car (last (assoc "SEARCH" (cdr result))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
692 (string-to-number article))))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
693 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
694 (defun nnimap-delete-article (articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
695 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
696 (nnimap-command "UID STORE %s +FLAGS.SILENT (\\Deleted)" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
697 (nnimap-article-ranges articles)) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
698 (cond |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
699 ((member "UIDPLUS" (nnimap-capabilities nnimap-object)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
700 (nnimap-command "UID EXPUNGE %s" |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
701 (nnimap-article-ranges articles)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
702 t) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
703 (nnimap-expunge |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
704 (nnimap-command "EXPUNGE") |
110479
437c7aaf08fd
nnimap.el (nnimap-delete-article): Tell user if expunge won't happen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110465
diff
changeset
|
705 t) |
437c7aaf08fd
nnimap.el (nnimap-delete-article): Tell user if expunge won't happen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110465
diff
changeset
|
706 (t (gnus-message 7 (concat "nnimap: nnimap-expunge is not set and the " |
437c7aaf08fd
nnimap.el (nnimap-delete-article): Tell user if expunge won't happen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110465
diff
changeset
|
707 "server doesn't support UIDPLUS, so we won't " |
437c7aaf08fd
nnimap.el (nnimap-delete-article): Tell user if expunge won't happen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110465
diff
changeset
|
708 "delete this article now")))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
709 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
710 (deffoo nnimap-request-scan (&optional group server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
711 (when (and (nnimap-possibly-change-group nil server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
712 nnimap-inbox |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
713 nnimap-split-methods) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
714 (message "nnimap %s splitting mail..." server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
715 (nnimap-split-incoming-mail))) |
31717 | 716 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
717 (defun nnimap-marks-to-flags (marks) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
718 (let (flags flag) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
719 (dolist (mark marks) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
720 (when (setq flag (cadr (assq mark nnimap-mark-alist))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
721 (push flag flags))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
722 flags)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
723 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
724 (deffoo nnimap-request-set-mark (group actions &optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
725 (when (nnimap-possibly-change-group group server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
726 (let (sequence) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
727 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
728 ;; Just send all the STORE commands without waiting for |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
729 ;; response. If they're successful, they're successful. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
730 (dolist (action actions) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
731 (destructuring-bind (range action marks) action |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
732 (let ((flags (nnimap-marks-to-flags marks))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
733 (when flags |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
734 (setq sequence (nnimap-send-command |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
735 "UID STORE %s %sFLAGS.SILENT (%s)" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
736 (nnimap-article-ranges range) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
737 (if (eq action 'del) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
738 "-" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
739 "+") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
740 (mapconcat #'identity flags " "))))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
741 ;; Wait for the last command to complete to avoid later |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
742 ;; syncronisation problems with the stream. |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
743 (when sequence |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
744 (nnimap-wait-for-response sequence)))))) |
31717 | 745 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
746 (deffoo nnimap-request-accept-article (group &optional server last) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
747 (when (nnimap-possibly-change-group nil server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
748 (nnmail-check-syntax) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
749 (let ((message (buffer-string)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
750 (message-id (message-field-value "message-id")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
751 sequence) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
752 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
753 (setq sequence (nnimap-send-command |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
754 "APPEND %S {%d}" (utf7-encode group t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
755 (length message))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
756 (process-send-string (get-buffer-process (current-buffer)) message) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
757 (process-send-string (get-buffer-process (current-buffer)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
758 (if (nnimap-newlinep nnimap-object) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
759 "\n" |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
760 "\r\n")) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
761 (let ((result (nnimap-get-response sequence))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
762 (when result |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
763 (cons group |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
764 (nnimap-find-article-by-message-id group message-id)))))))) |
31717 | 765 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
766 (defun nnimap-add-cr () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
767 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
768 (while (re-search-forward "\r?\n" nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
769 (replace-match "\r\n" t t))) |
31717 | 770 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
771 (defun nnimap-get-groups () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
772 (let ((result (nnimap-command "LIST \"\" \"*\"")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
773 groups) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
774 (when (car result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
775 (dolist (line (cdr result)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
776 (when (and (equal (car line) "LIST") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
777 (not (and (caadr line) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
778 (string-match "noselect" (caadr line))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
779 (push (car (last line)) groups))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
780 (nreverse groups)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
781 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
782 (deffoo nnimap-request-list (&optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
783 (nnimap-possibly-change-group nil server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
784 (with-current-buffer nntp-server-buffer |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
785 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
786 (let ((groups |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
787 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
788 (nnimap-get-groups))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
789 sequences responses) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
790 (when groups |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
791 (with-current-buffer (nnimap-buffer) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
792 (setf (nnimap-group nnimap-object) nil) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
793 (dolist (group groups) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
794 (push (list (nnimap-send-command "EXAMINE %S" (utf7-encode group t)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
795 group) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
796 sequences)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
797 (nnimap-wait-for-response (caar sequences)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
798 (setq responses |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
799 (nnimap-get-responses (mapcar #'car sequences)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
800 (dolist (response responses) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
801 (let* ((sequence (car response)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
802 (response (cadr response)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
803 (group (cadr (assoc sequence sequences)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
804 (when (and group |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
805 (equal (caar response) "OK")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
806 (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
807 highest exists) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
808 (dolist (elem response) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
809 (when (equal (cadr elem) "EXISTS") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
810 (setq exists (string-to-number (car elem))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
811 (when uidnext |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
812 (setq highest (1- (string-to-number (car uidnext))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
813 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
814 ((null highest) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
815 (insert (format "%S 0 1 y\n" (utf7-decode group t)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
816 ((zerop exists) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
817 ;; Empty group. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
818 (insert (format "%S %d %d y\n" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
819 (utf7-decode group t) highest (1+ highest)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
820 (t |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
821 ;; Return the widest possible range. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
822 (insert (format "%S %d 1 y\n" (utf7-decode group t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
823 (or highest exists))))))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
824 t)))) |
31717 | 825 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
826 (deffoo nnimap-retrieve-group-data-early (server infos) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
827 (when (nnimap-possibly-change-group nil server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
828 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
829 ;; QRESYNC handling isn't implemented. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
830 (let ((qresyncp (member "notQRESYNC" (nnimap-capabilities nnimap-object))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
831 marks groups sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
832 ;; Go through the infos and gather the data needed to know |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
833 ;; what and how to request the data. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
834 (dolist (info infos) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
835 (setq marks (gnus-info-marks info)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
836 (push (list (gnus-group-real-name (gnus-info-group info)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
837 (cdr (assq 'active marks)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
838 (cdr (assq 'uid marks))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
839 groups)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
840 ;; Then request the data. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
841 (erase-buffer) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
842 (setf (nnimap-group nnimap-object) nil) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
843 (dolist (elem groups) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
844 (if (and qresyncp |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
845 (nth 2 elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
846 (push |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
847 (list 'qresync |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
848 (nnimap-send-command "EXAMINE %S (QRESYNC (%s %s))" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
849 (car elem) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
850 (car (nth 2 elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
851 (cdr (nth 2 elem))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
852 nil |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
853 (car elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
854 sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
855 (let ((start |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
856 (if (nth 1 elem) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
857 ;; Fetch the last 100 flags. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
858 (max 1 (- (cdr (nth 1 elem)) 100)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
859 1))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
860 (push (list (nnimap-send-command "EXAMINE %S" (car elem)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
861 (nnimap-send-command "UID FETCH %d:* FLAGS" start) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
862 start |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
863 (car elem)) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
864 sequences))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
865 ;; Some servers apparently can't have many outstanding |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
866 ;; commands, so throttle them. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
867 (when (and (not nnimap-streaming) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
868 (car sequences)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
869 (nnimap-wait-for-response (caar sequences)))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
870 sequences)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
871 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
872 (deffoo nnimap-finish-retrieve-group-infos (server infos sequences) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
873 (when (and sequences |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
874 (nnimap-possibly-change-group nil server)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
875 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
876 ;; Wait for the final data to trickle in. |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
877 (when (nnimap-wait-for-response (cadar sequences)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
878 ;; Now we should have all the data we need, no matter whether |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
879 ;; we're QRESYNCING, fetching all the flags from scratch, or |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
880 ;; just fetching the last 100 flags per group. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
881 (nnimap-update-infos (nnimap-flags-to-marks |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
882 (nnimap-parse-flags |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
883 (nreverse sequences))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
884 infos) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
885 ;; Finally, just return something resembling an active file in |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
886 ;; the nntp buffer, so that the agent can save the info, too. |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
887 (with-current-buffer nntp-server-buffer |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
888 (erase-buffer) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
889 (dolist (info infos) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
890 (let* ((group (gnus-info-group info)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
891 (active (gnus-active group))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
892 (when active |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
893 (insert (format "%S %d %d y\n" |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
894 (gnus-group-real-name group) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
895 (cdr active) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
896 (car active))))))))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
897 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
898 (defun nnimap-update-infos (flags infos) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
899 (dolist (info infos) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
900 (let ((group (gnus-group-real-name (gnus-info-group info)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
901 (nnimap-update-info info (cdr (assoc group flags)))))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
902 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
903 (defun nnimap-update-info (info marks) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
904 (when marks |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
905 (destructuring-bind (existing flags high low uidnext start-article |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
906 permanent-flags) marks |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
907 (let ((group (gnus-info-group info)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
908 (completep (and start-article |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
909 (= start-article 1)))) |
110516
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
910 (when uidnext |
4d2f8b81bb01
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110502
diff
changeset
|
911 (setq high (1- uidnext))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
912 ;; First set the active ranges based on high/low. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
913 (if (or completep |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
914 (not (gnus-active group))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
915 (gnus-set-active group |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
916 (cond |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
917 ((and low high) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
918 (cons low high)) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
919 (uidnext |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
920 ;; No articles in this group. |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
921 (cons uidnext (1- uidnext))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
922 (start-article |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
923 (cons start-article (1- start-article))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
924 (t |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
925 ;; No articles and no uidnext. |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
926 nil))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
927 (setcdr (gnus-active group) (or high (1- uidnext)))) |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
928 (when (and (not high) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
929 uidnext) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
930 (setq high (1- uidnext))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
931 ;; Then update the list of read articles. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
932 (let* ((unread |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
933 (gnus-compress-sequence |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
934 (gnus-set-difference |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
935 (gnus-set-difference |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
936 existing |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
937 (cdr (assoc '%Seen flags))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
938 (cdr (assoc '%Flagged flags))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
939 (read (gnus-range-difference |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
940 (cons start-article high) unread))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
941 (when (> start-article 1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
942 (setq read |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
943 (gnus-range-nconcat |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
944 (if (> start-article 1) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
945 (gnus-sorted-range-intersection |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
946 (cons 1 (1- start-article)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
947 (gnus-info-read info)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
948 (gnus-info-read info)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
949 read))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
950 (gnus-info-set-read info read) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
951 ;; Update the marks. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
952 (setq marks (gnus-info-marks info)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
953 ;; Note the active level for the next run-through. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
954 (let ((active (assq 'active marks))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
955 (if active |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
956 (setcdr active (gnus-active group)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
957 (push (cons 'active (gnus-active group)) marks))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
958 (dolist (type (cdr nnimap-mark-alist)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
959 (let ((old-marks (assoc (car type) marks)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
960 (new-marks |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
961 (gnus-compress-sequence |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
962 (cdr (or (assoc (caddr type) flags) ; %Flagged |
110488
4ead2c32359c
nnimap.el (nnimap-update-info): Sync non-standard flags from the server in symbolic form.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110486
diff
changeset
|
963 (assoc (intern (cadr type) obarray) flags) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
964 (assoc (cadr type) flags)))))) ; "\Flagged" |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
965 (setq marks (delq old-marks marks)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
966 (pop old-marks) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
967 (when (and old-marks |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
968 (> start-article 1)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
969 (setq old-marks (gnus-range-difference |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
970 old-marks |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
971 (cons start-article high))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
972 (setq new-marks (gnus-range-nconcat old-marks new-marks))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
973 (when new-marks |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
974 (push (cons (car type) new-marks) marks))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
975 (gnus-info-set-marks info marks t) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
976 (nnimap-store-info info (gnus-active group)))))))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
977 |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
978 (defun nnimap-store-info (info active) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
979 (let* ((group (gnus-group-real-name (gnus-info-group info))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
980 (entry (assoc group nnimap-current-infos))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
981 (if entry |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
982 (setcdr entry (list info active)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
983 (push (list group info active) nnimap-current-infos)))) |
31717 | 984 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
985 (defun nnimap-flags-to-marks (groups) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
986 (let (data group totalp uidnext articles start-article mark permanent-flags) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
987 (dolist (elem groups) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
988 (setq group (car elem) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
989 uidnext (nth 1 elem) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
990 start-article (nth 2 elem) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
991 permanent-flags (nth 3 elem) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
992 articles (nthcdr 4 elem)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
993 (let ((high (caar articles)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
994 marks low existing) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
995 (dolist (article articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
996 (setq low (car article)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
997 (push (car article) existing) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
998 (dolist (flag (cdr article)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
999 (setq mark (assoc flag marks)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1000 (if (not mark) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1001 (push (list flag (car article)) marks) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1002 (setcdr mark (cons (car article) (cdr mark)))))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1003 (push (list group existing marks high low uidnext start-article |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1004 permanent-flags) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1005 data))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1006 data)) |
31717 | 1007 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1008 (defun nnimap-parse-flags (sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1009 (goto-char (point-min)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1010 ;; Change \Delete etc to %Delete, so that the reader can read it. |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1011 (subst-char-in-region (point-min) (point-max) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1012 ?\\ ?% t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1013 (let (start end articles groups uidnext elems permanent-flags) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1014 (dolist (elem sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1015 (destructuring-bind (group-sequence flag-sequence totalp group) elem |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1016 (setq start (point)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1017 ;; The EXAMINE was successful. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1018 (when (and (search-forward (format "\n%d OK " group-sequence) nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1019 (progn |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1020 (forward-line 1) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1021 (setq end (point)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1022 (goto-char start) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1023 (setq permanent-flags |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1024 (and (search-forward "PERMANENTFLAGS " |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1025 (or end (point-min)) t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1026 (read (current-buffer)))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1027 (goto-char start) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1028 (setq uidnext |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1029 (and (search-forward "UIDNEXT " |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1030 (or end (point-min)) t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1031 (read (current-buffer)))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1032 (goto-char end) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1033 (forward-line -1)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1034 ;; The UID FETCH FLAGS was successful. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1035 (search-forward (format "\n%d OK " flag-sequence) nil t)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1036 (setq start (point)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1037 (goto-char end) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1038 (while (search-forward " FETCH " start t) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1039 (setq elems (read (current-buffer))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1040 (push (cons (cadr (memq 'UID elems)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1041 (cadr (memq 'FLAGS elems))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1042 articles)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1043 (push (nconc (list group uidnext totalp permanent-flags) articles) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1044 groups) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1045 (setq articles nil)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1046 groups)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1047 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1048 (defun nnimap-find-process-buffer (buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1049 (cadr (assoc buffer nnimap-connection-alist))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1050 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1051 (deffoo nnimap-request-post (&optional server) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1052 (setq nnimap-status-string "Read-only server") |
31717 | 1053 nil) |
1054 | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1055 (defun nnimap-possibly-change-group (group server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1056 (let ((open-result t)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1057 (when (and server |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1058 (not (nnimap-server-opened server))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1059 (setq open-result (nnimap-open-server server))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1060 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1061 ((not open-result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1062 nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1063 ((not group) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1064 t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1065 (t |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1066 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1067 (if (equal group (nnimap-group nnimap-object)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1068 t |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1069 (let ((result (nnimap-command "SELECT %S" (utf7-encode group t)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1070 (when (car result) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1071 (setf (nnimap-group nnimap-object) group |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1072 (nnimap-select-result nnimap-object) result) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1073 result)))))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1074 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1075 (defun nnimap-find-connection (buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1076 "Find the connection delivering to BUFFER." |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1077 (let ((entry (assoc buffer nnimap-connection-alist))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1078 (when entry |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1079 (if (and (buffer-name (cadr entry)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1080 (get-buffer-process (cadr entry)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1081 (memq (process-status (get-buffer-process (cadr entry))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1082 '(open run))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1083 (get-buffer-process (cadr entry)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1084 (setq nnimap-connection-alist (delq entry nnimap-connection-alist)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1085 nil)))) |
31717 | 1086 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1087 (defvar nnimap-sequence 0) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1088 |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1089 (defun nnimap-send-command (&rest args) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1090 (process-send-string |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1091 (get-buffer-process (current-buffer)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1092 (nnimap-log-command |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1093 (format "%d %s%s\n" |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1094 (incf nnimap-sequence) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1095 (apply #'format args) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1096 (if (nnimap-newlinep nnimap-object) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1097 "" |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1098 "\r")))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1099 nnimap-sequence) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1100 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1101 (defun nnimap-log-command (command) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1102 (with-current-buffer (get-buffer-create "*imap log*") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1103 (goto-char (point-max)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1104 (insert (format-time-string "%H:%M:%S") " " command)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1105 command) |
31717 | 1106 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1107 (defun nnimap-command (&rest args) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1108 (erase-buffer) |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
1109 (setf (nnimap-last-command-time nnimap-object) (current-time)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1110 (let* ((sequence (apply #'nnimap-send-command args)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1111 (response (nnimap-get-response sequence))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1112 (if (equal (caar response) "OK") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1113 (cons t response) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1114 (nnheader-report 'nnimap "%s" |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
1115 (mapconcat (lambda (a) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
1116 (format "%s" a)) |
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
1117 (car response) " ")) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1118 nil))) |
31717 | 1119 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1120 (defun nnimap-get-response (sequence) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1121 (nnimap-wait-for-response sequence) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1122 (nnimap-parse-response)) |
31717 | 1123 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1124 (defun nnimap-wait-for-connection () |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1125 (let ((process (get-buffer-process (current-buffer)))) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1126 (goto-char (point-min)) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1127 (while (and (memq (process-status process) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1128 '(open run)) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1129 (not (re-search-forward "^\\* .*\n" nil t))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1130 (nnheader-accept-process-output process) |
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1131 (goto-char (point-min))) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1132 (forward-line -1) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1133 (and (looking-at "\\* \\([A-Z0-9]+\\)") |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1134 (match-string 1)))) |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110419
diff
changeset
|
1135 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1136 (defun nnimap-wait-for-response (sequence &optional messagep) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1137 (let ((process (get-buffer-process (current-buffer))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1138 openp) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1139 (goto-char (point-max)) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1140 (while (and (setq openp (memq (process-status process) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1141 '(open run))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1142 (not (re-search-backward |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1143 (format "^%d .*\n" sequence) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1144 (if nnimap-streaming |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1145 (max (point-min) (- (point) 500)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1146 (point-min)) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1147 t))) |
110433
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1148 (when messagep |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1149 (message "Read %dKB" (/ (buffer-size) 1000))) |
33cf78a271ef
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110428
diff
changeset
|
1150 (nnheader-accept-process-output process) |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1151 (goto-char (point-max))) |
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1152 openp)) |
31717 | 1153 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1154 (defun nnimap-parse-response () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1155 (let ((lines (split-string (nnimap-last-response-string) "\r\n" t)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1156 result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1157 (dolist (line lines) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1158 (push (cdr (nnimap-parse-line line)) result)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1159 ;; Return the OK/error code first, and then all the "continuation |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1160 ;; lines" afterwards. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1161 (cons (pop result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1162 (nreverse result)))) |
31717 | 1163 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1164 ;; Parse an IMAP response line lightly. They look like |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1165 ;; "* OK [UIDVALIDITY 1164213559] UIDs valid", typically, so parse |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1166 ;; the lines into a list of strings and lists of string. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1167 (defun nnimap-parse-line (line) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1168 (let (char result) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1169 (with-temp-buffer |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1170 (insert line) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1171 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1172 (while (not (eobp)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1173 (if (eql (setq char (following-char)) ? ) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1174 (forward-char 1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1175 (push |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1176 (cond |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1177 ((eql char ?\[) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1178 (split-string (buffer-substring |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1179 (1+ (point)) (1- (search-forward "]"))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1180 ((eql char ?\() |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1181 (split-string (buffer-substring |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1182 (1+ (point)) (1- (search-forward ")"))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1183 ((eql char ?\") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1184 (forward-char 1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1185 (buffer-substring (point) (1- (search-forward "\"")))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1186 (t |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1187 (buffer-substring (point) (if (search-forward " " nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1188 (1- (point)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1189 (goto-char (point-max)))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1190 result))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1191 (nreverse result)))) |
31717 | 1192 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1193 (defun nnimap-last-response-string () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1194 (save-excursion |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1195 (forward-line 1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1196 (let ((end (point))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1197 (forward-line -1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1198 (when (not (bobp)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1199 (forward-line -1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1200 (while (and (not (bobp)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1201 (eql (following-char) ?*)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1202 (forward-line -1)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1203 (unless (eql (following-char) ?*) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1204 (forward-line 1))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1205 (buffer-substring (point) end)))) |
31717 | 1206 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1207 (defun nnimap-get-responses (sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1208 (let (responses) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1209 (dolist (sequence sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1210 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1211 (when (re-search-forward (format "^%d " sequence) nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1212 (push (list sequence (nnimap-parse-response)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1213 responses))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1214 responses)) |
31717 | 1215 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1216 (defvar nnimap-incoming-split-list nil) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
56280
diff
changeset
|
1217 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1218 (defun nnimap-fetch-inbox (articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1219 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1220 (nnimap-wait-for-response |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1221 (nnimap-send-command |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1222 "UID FETCH %s %s" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1223 (nnimap-article-ranges articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1224 (format "(UID %s%s)" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1225 (format |
110583
b6d2a63ad993
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110568
diff
changeset
|
1226 (if (nnimap-ver4-p) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1227 "BODY.PEEK[HEADER] BODY.PEEK" |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1228 "RFC822.PEEK")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1229 (if nnimap-split-download-body-default |
110451
4b82113fd203
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110433
diff
changeset
|
1230 "[]" |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1231 "[1]"))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1232 t)) |
31717 | 1233 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1234 (defun nnimap-split-incoming-mail () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1235 (with-current-buffer (nnimap-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1236 (let ((nnimap-incoming-split-list nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1237 (nnmail-split-methods nnimap-split-methods) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1238 (nnmail-inhibit-default-split-group t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1239 (groups (nnimap-get-groups)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1240 new-articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1241 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1242 (nnimap-command "SELECT %S" nnimap-inbox) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1243 (setq new-articles (nnimap-new-articles (nnimap-get-flags "1:*"))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1244 (when new-articles |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1245 (nnimap-fetch-inbox new-articles) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1246 (nnimap-transform-split-mail) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1247 (nnheader-ms-strip-cr) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1248 (nnmail-cache-open) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1249 (nnmail-split-incoming (current-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1250 #'nnimap-save-mail-spec |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1251 nil nil |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1252 #'nnimap-dummy-active-number |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1253 #'nnimap-save-mail-spec) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1254 (when nnimap-incoming-split-list |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1255 (let ((specs (nnimap-make-split-specs nnimap-incoming-split-list)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1256 sequences junk-articles) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1257 ;; Create any groups that doesn't already exist on the |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1258 ;; server first. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1259 (dolist (spec specs) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1260 (when (and (not (member (car spec) groups)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1261 (not (eq (car spec) 'junk))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1262 (nnimap-command "CREATE %S" (utf7-encode (car spec) t)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1263 ;; Then copy over all the messages. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1264 (erase-buffer) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1265 (dolist (spec specs) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1266 (let ((group (car spec)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1267 (ranges (cdr spec))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1268 (if (eq group 'junk) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1269 (setq junk-articles ranges) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1270 (push (list (nnimap-send-command |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1271 "UID COPY %s %S" |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1272 (nnimap-article-ranges ranges) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1273 (utf7-encode group t)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1274 ranges) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1275 sequences)))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1276 ;; Wait for the last COPY response... |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1277 (when sequences |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1278 (nnimap-wait-for-response (caar sequences)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1279 ;; And then mark the successful copy actions as deleted, |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1280 ;; and possibly expunge them. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1281 (nnimap-mark-and-expunge-incoming |
110555
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
1282 (nnimap-parse-copied-articles sequences))) |
e07971bb896c
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110516
diff
changeset
|
1283 (nnimap-mark-and-expunge-incoming junk-articles))))))) |
31717 | 1284 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1285 (defun nnimap-mark-and-expunge-incoming (range) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1286 (when range |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1287 (setq range (nnimap-article-ranges range)) |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1288 (let ((sequence |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1289 (nnimap-send-command |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1290 "UID STORE %s +FLAGS.SILENT (\\Deleted)" range))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1291 (cond |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1292 ;; If the server supports it, we now delete the message we have |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1293 ;; just copied over. |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1294 ((member "UIDPLUS" (nnimap-capabilities nnimap-object)) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1295 (setq sequence (nnimap-send-command "UID EXPUNGE %s" range))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1296 ;; If it doesn't support UID EXPUNGE, then we only expunge if the |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1297 ;; user has configured it. |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1298 (nnimap-expunge |
110465
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1299 (setq sequence (nnimap-send-command "EXPUNGE")))) |
b7b7e970d807
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110451
diff
changeset
|
1300 (nnimap-wait-for-response sequence)))) |
31717 | 1301 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1302 (defun nnimap-parse-copied-articles (sequences) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1303 (let (sequence copied range) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1304 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1305 (while (re-search-forward "^\\([0-9]+\\) OK " nil t) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1306 (setq sequence (string-to-number (match-string 1))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1307 (when (setq range (cadr (assq sequence sequences))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1308 (push (gnus-uncompress-range range) copied))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1309 (gnus-compress-sequence (sort (apply #'nconc copied) #'<)))) |
31717 | 1310 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1311 (defun nnimap-new-articles (flags) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1312 (let (new) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1313 (dolist (elem flags) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1314 (when (or (null (cdr elem)) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1315 (and (not (memq '%Deleted (cdr elem))) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1316 (not (memq '%Seen (cdr elem))))) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1317 (push (car elem) new))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1318 (gnus-compress-sequence (nreverse new)))) |
31717 | 1319 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1320 (defun nnimap-make-split-specs (list) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1321 (let ((specs nil) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1322 entry) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1323 (dolist (elem list) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1324 (destructuring-bind (article spec) elem |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1325 (dolist (group (delete nil (mapcar #'car spec))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1326 (unless (setq entry (assoc group specs)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1327 (push (setq entry (list group)) specs)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1328 (setcdr entry (cons article (cdr entry)))))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1329 (dolist (entry specs) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1330 (setcdr entry (gnus-compress-sequence (sort (cdr entry) #'<)))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1331 specs)) |
31717 | 1332 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1333 (defun nnimap-transform-split-mail () |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1334 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1335 (let (article bytes) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1336 (block nil |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1337 (while (not (eobp)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1338 (while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)")) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1339 (delete-region (point) (progn (forward-line 1) (point))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1340 (when (eobp) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1341 (return))) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1342 (setq article (match-string 1) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1343 bytes (nnimap-get-length)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1344 (delete-region (line-beginning-position) (line-end-position)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1345 ;; Insert MMDF separator, and a way to remember what this |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1346 ;; article UID is. |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1347 (insert (format "\^A\^A\^A\^A\n\nX-nnimap-article: %s" article)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1348 (forward-char (1+ bytes)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1349 (setq bytes (nnimap-get-length)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1350 (delete-region (line-beginning-position) (line-end-position)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1351 (forward-char (1+ bytes)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1352 (delete-region (line-beginning-position) (line-end-position)))))) |
31717 | 1353 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1354 (defun nnimap-dummy-active-number (group &optional server) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1355 1) |
31717 | 1356 |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1357 (defun nnimap-save-mail-spec (group-art &optional server full-nov) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1358 (let (article) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1359 (goto-char (point-min)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1360 (if (not (re-search-forward "X-nnimap-article: \\([0-9]+\\)" nil t)) |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1361 (error "Invalid nnimap mail") |
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1362 (setq article (string-to-number (match-string 1)))) |
110486
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1363 (push (list article |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1364 (if (eq group-art 'junk) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1365 (list (cons 'junk 1)) |
1ad1adb298a3
Merge Changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110479
diff
changeset
|
1366 group-art)) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110219
diff
changeset
|
1367 nnimap-incoming-split-list))) |
31717 | 1368 |
1369 (provide 'nnimap) | |
1370 | |
1371 ;;; nnimap.el ends here |