Mercurial > emacs
annotate lisp/gnus/imap.el @ 82977:e300f00a427a
[ Merge from Gnus v5-10 branch. See the tags "gnus-5_10-pre-merge-josefsson"
and "gnus-5_10-post-merge-josefsson". ]
2004-08-31 Simon Josefsson <jas@extundo.com>
* rfc2231.el (rfc2231-parse-string): Restore whitespace syntax for
?* and ?\; (tiny patch). From Andreas Schwab <schwab@suse.de>.
* ietf-drums.el (ietf-drums-syntax-table): Set syntax of ?* ?\;
and ?\' to symbol instead of whitespace (tiny patch). From
Andreas Schwab <schwab@suse.de>.
2004-08-31 Jesper Harder <harder@ifa.au.dk>
* message.el (message-idna-to-ascii-rhs-1): Don't choke on
invalid addresses.
2004-08-31 Reiner Steib <Reiner.Steib@gmx.de>
* message.el (message-idna-to-ascii-rhs-1): Fix typo.
2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
* message.el (message-idna-to-ascii-rhs-1): Don't use equalp.
2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-art.el (article-decode-idna-rhs): Don't use
message-idna-inside-rhs-p.
2004-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
* message.el (message-idna-inside-rhs-p): Removed.
(message-idna-to-ascii-rhs-1): Use proper address parsing.
author | Reiner Steib <Reiner.Steib@gmx.de> |
---|---|
date | Tue, 31 Aug 2004 15:38:25 +0000 |
parents | 28d9e552d178 |
children |
rev | line source |
---|---|
31717 | 1 ;;; imap.el --- imap library |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 |
31717 | 3 ;; Free Software Foundation, Inc. |
4 | |
5 ;; Author: Simon Josefsson <jas@pdc.kth.se> | |
6 ;; Keywords: mail | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
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 | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; imap.el is a elisp library providing an interface for talking to | |
28 ;; IMAP servers. | |
29 ;; | |
30 ;; imap.el is roughly divided in two parts, one that parses IMAP | |
31 ;; responses from the server and storing data into buffer-local | |
32 ;; variables, and one for utility functions which send commands to | |
33 ;; server, waits for an answer, and return information. The latter | |
34 ;; part is layered on top of the previous. | |
35 ;; | |
36 ;; The imap.el API consist of the following functions, other functions | |
37 ;; in this file should not be called directly and the result of doing | |
38 ;; so are at best undefined. | |
39 ;; | |
40 ;; Global commands: | |
41 ;; | |
42 ;; imap-open, imap-opened, imap-authenticate, imap-close, | |
43 ;; imap-capability, imap-namespace, imap-error-text | |
44 ;; | |
45 ;; Mailbox commands: | |
46 ;; | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
47 ;; imap-mailbox-get, imap-mailbox-map, imap-current-mailbox, |
31717 | 48 ;; imap-current-mailbox-p, imap-search, imap-mailbox-select, |
49 ;; imap-mailbox-examine, imap-mailbox-unselect, imap-mailbox-expunge | |
50 ;; imap-mailbox-close, imap-mailbox-create, imap-mailbox-delete | |
51 ;; imap-mailbox-rename, imap-mailbox-lsub, imap-mailbox-list | |
52 ;; imap-mailbox-subscribe, imap-mailbox-unsubscribe, imap-mailbox-status | |
53 ;; imap-mailbox-acl-get, imap-mailbox-acl-set, imap-mailbox-acl-delete | |
54 ;; | |
55 ;; Message commands: | |
56 ;; | |
57 ;; imap-fetch-asynch, imap-fetch, | |
58 ;; imap-current-message, imap-list-to-message-set, | |
59 ;; imap-message-get, imap-message-map | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
60 ;; imap-message-envelope-date, imap-message-envelope-subject, |
31717 | 61 ;; imap-message-envelope-from, imap-message-envelope-sender, |
62 ;; imap-message-envelope-reply-to, imap-message-envelope-to, | |
63 ;; imap-message-envelope-cc, imap-message-envelope-bcc | |
64 ;; imap-message-envelope-in-reply-to, imap-message-envelope-message-id | |
65 ;; imap-message-body, imap-message-flag-permanent-p | |
66 ;; imap-message-flags-set, imap-message-flags-del | |
67 ;; imap-message-flags-add, imap-message-copyuid | |
68 ;; imap-message-copy, imap-message-appenduid | |
69 ;; imap-message-append, imap-envelope-from | |
70 ;; imap-body-lines | |
71 ;; | |
72 ;; It is my hope that theese commands should be pretty self | |
73 ;; explanatory for someone that know IMAP. All functions have | |
74 ;; additional documentation on how to invoke them. | |
75 ;; | |
76 ;; imap.el support RFC1730/2060 (IMAP4/IMAP4rev1), implemented IMAP | |
77 ;; extensions are RFC2195 (CRAM-MD5), RFC2086 (ACL), RFC2342 | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
78 ;; (NAMESPACE), RFC2359 (UIDPLUS), the IMAP-part of RFC2595 (STARTTLS, |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
79 ;; LOGINDISABLED) (with use of external library starttls.el and |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
80 ;; program starttls) and the GSSAPI / kerberos V4 sections of RFC1731 |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
81 ;; (with use of external program `imtest'). It also take advantage |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
82 ;; the UNSELECT extension in Cyrus IMAPD. |
31717 | 83 ;; |
84 ;; Without the work of John McClary Prevost and Jim Radford this library | |
85 ;; would not have seen the light of day. Many thanks. | |
86 ;; | |
87 ;; This is a transcript of short interactive session for demonstration | |
88 ;; purposes. | |
89 ;; | |
90 ;; (imap-open "my.mail.server") | |
91 ;; => " *imap* my.mail.server:0" | |
92 ;; | |
93 ;; The rest are invoked with current buffer as the buffer returned by | |
94 ;; `imap-open'. It is possible to do all without this, but it would | |
95 ;; look ugly here since `buffer' is always the last argument for all | |
96 ;; imap.el API functions. | |
97 ;; | |
98 ;; (imap-authenticate "myusername" "mypassword") | |
99 ;; => auth | |
100 ;; | |
101 ;; (imap-mailbox-lsub "*") | |
102 ;; => ("INBOX.sentmail" "INBOX.private" "INBOX.draft" "INBOX.spam") | |
103 ;; | |
104 ;; (imap-mailbox-list "INBOX.n%") | |
105 ;; => ("INBOX.namedroppers" "INBOX.nnimap" "INBOX.ntbugtraq") | |
106 ;; | |
107 ;; (imap-mailbox-select "INBOX.nnimap") | |
108 ;; => "INBOX.nnimap" | |
109 ;; | |
110 ;; (imap-mailbox-get 'exists) | |
111 ;; => 166 | |
112 ;; | |
113 ;; (imap-mailbox-get 'uidvalidity) | |
114 ;; => "908992622" | |
115 ;; | |
116 ;; (imap-search "FLAGGED SINCE 18-DEC-98") | |
117 ;; => (235 236) | |
118 ;; | |
119 ;; (imap-fetch 235 "RFC822.PEEK" 'RFC822) | |
120 ;; => "X-Sieve: cmu-sieve 1.3^M\nX-Username: <jas@pdc.kth.se>^M\r...." | |
121 ;; | |
122 ;; Todo: | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
123 ;; |
31717 | 124 ;; o Parse UIDs as strings? We need to overcome the 28 bit limit somehow. |
125 ;; o Don't use `read' at all (important places already fixed) | |
126 ;; o Accept list of articles instead of message set string in most | |
127 ;; imap-message-* functions. | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
128 ;; o Send strings as literal if they contain, e.g., ". |
31717 | 129 ;; |
130 ;; Revision history: | |
131 ;; | |
132 ;; - 19991218 added starttls/digest-md5 patch, | |
133 ;; by Daiki Ueno <ueno@ueda.info.waseda.ac.jp> | |
134 ;; NB! you need SLIM for starttls.el and digest-md5.el | |
135 ;; - 19991023 commited to pgnus | |
136 ;; | |
137 | |
138 ;;; Code: | |
139 | |
140 (eval-when-compile (require 'cl)) | |
141 (eval-and-compile | |
142 (autoload 'base64-decode-string "base64") | |
143 (autoload 'base64-encode-string "base64") | |
144 (autoload 'starttls-open-stream "starttls") | |
145 (autoload 'starttls-negotiate "starttls") | |
146 (autoload 'digest-md5-parse-digest-challenge "digest-md5") | |
147 (autoload 'digest-md5-digest-response "digest-md5") | |
148 (autoload 'digest-md5-digest-uri "digest-md5") | |
149 (autoload 'digest-md5-challenge "digest-md5") | |
150 (autoload 'rfc2104-hash "rfc2104") | |
151 (autoload 'md5 "md5") | |
152 (autoload 'utf7-encode "utf7") | |
153 (autoload 'utf7-decode "utf7") | |
154 (autoload 'format-spec "format-spec") | |
33299
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
155 (autoload 'format-spec-make "format-spec") |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
156 (autoload 'open-tls-stream "tls") |
33299
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
157 ;; Avoid use gnus-point-at-eol so we're independent of Gnus. These |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
158 ;; days we have point-at-eol anyhow. |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
159 (if (fboundp 'point-at-eol) |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
160 (defalias 'imap-point-at-eol 'point-at-eol) |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
161 (defun imap-point-at-eol () |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
162 (save-excursion |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
163 (end-of-line) |
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
164 (point))))) |
31717 | 165 |
166 ;; User variables. | |
167 | |
168 (defgroup imap nil | |
169 "Low-level IMAP issues." | |
170 :version "21.1" | |
171 :group 'mail) | |
172 | |
173 (defcustom imap-kerberos4-program '("imtest -m kerberos_v4 -u %l -p %p %s" | |
174 "imtest -kp %s %p") | |
175 "List of strings containing commands for Kerberos 4 authentication. | |
176 %s is replaced with server hostname, %p with port to connect to, and | |
177 %l with the value of `imap-default-user'. The program should accept | |
178 IMAP commands on stdin and return responses to stdout. Each entry in | |
179 the list is tried until a successful connection is made." | |
180 :group 'imap | |
181 :type '(repeat string)) | |
182 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
183 (defcustom imap-gssapi-program (list |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
184 (concat "gsasl --client --connect %s:%p " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
185 "--imap --application-data " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
186 "--mechanism GSSAPI " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
187 "--authentication-id %l") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
188 "imtest -m gssapi -u %l -p %p %s") |
31717 | 189 "List of strings containing commands for GSSAPI (krb5) authentication. |
190 %s is replaced with server hostname, %p with port to connect to, and | |
191 %l with the value of `imap-default-user'. The program should accept | |
192 IMAP commands on stdin and return responses to stdout. Each entry in | |
193 the list is tried until a successful connection is made." | |
194 :group 'imap | |
195 :type '(repeat string)) | |
196 | |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
197 (defcustom imap-ssl-program '("openssl s_client -quiet -ssl3 -connect %s:%p" |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
198 "openssl s_client -quiet -ssl2 -connect %s:%p" |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
199 "s_client -quiet -ssl3 -connect %s:%p" |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
200 "s_client -quiet -ssl2 -connect %s:%p") |
31717 | 201 "A string, or list of strings, containing commands for SSL connections. |
202 Within a string, %s is replaced with the server address and %p with | |
203 port number on server. The program should accept IMAP commands on | |
204 stdin and return responses to stdout. Each entry in the list is tried | |
205 until a successful connection is made." | |
206 :group 'imap | |
207 :type '(choice string | |
208 (repeat string))) | |
209 | |
210 (defcustom imap-shell-program '("ssh %s imapd" | |
211 "rsh %s imapd" | |
212 "ssh %g ssh %s imapd" | |
213 "rsh %g rsh %s imapd") | |
214 "A list of strings, containing commands for IMAP connection. | |
215 Within a string, %s is replaced with the server address, %p with port | |
216 number on server, %g with `imap-shell-host', and %l with | |
217 `imap-default-user'. The program should read IMAP commands from stdin | |
218 and write IMAP response to stdout. Each entry in the list is tried | |
219 until a successful connection is made." | |
220 :group 'imap | |
221 :type '(repeat string)) | |
222 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
223 (defcustom imap-process-connection-type nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
224 "*Value for `process-connection-type' to use for Kerberos4, GSSAPI and SSL. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
225 The `process-connection-type' variable control type of device |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
226 used to communicate with subprocesses. Values are nil to use a |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
227 pipe, or t or `pty' to use a pty. The value has no effect if the |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
228 system has no ptys or if all ptys are busy: then a pipe is used |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
229 in any case. The value takes effect when a IMAP server is |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
230 opened, changing it after that has no effect.." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
231 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
232 :type 'boolean) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
233 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
234 (defcustom imap-use-utf7 t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
235 "If non-nil, do utf7 encoding/decoding of mailbox names. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
236 Since the UTF7 decoding currently only decodes into ISO-8859-1 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
237 characters, you may disable this decoding if you need to access UTF7 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
238 encoded mailboxes which doesn't translate into ISO-8859-1." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
239 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
240 :type 'boolean) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
241 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
242 (defcustom imap-log nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
243 "If non-nil, a imap session trace is placed in *imap-log* buffer." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
244 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
245 :type 'boolean) |
31717 | 246 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
247 (defcustom imap-debug nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
248 "If non-nil, random debug spews are placed in *imap-debug* buffer." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
249 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
250 :type 'boolean) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
251 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
252 (defcustom imap-shell-host "gateway" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
253 "Hostname of rlogin proxy." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
254 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
255 :type 'string) |
31717 | 256 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
257 (defcustom imap-default-user (user-login-name) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
258 "Default username to use." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
259 :group 'imap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
260 :type 'string) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
261 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
262 (defcustom imap-read-timeout (if (string-match |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
263 "windows-nt\\|os/2\\|emx\\|cygwin" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
264 (symbol-name system-type)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
265 1.0 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
266 0.1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
267 "*How long to wait between checking for the end of output. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
268 Shorter values mean quicker response, but is more CPU intensive." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
269 :type 'number |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
270 :group 'imap) |
31717 | 271 |
272 ;; Various variables. | |
273 | |
274 (defvar imap-fetch-data-hook nil | |
275 "Hooks called after receiving each FETCH response.") | |
276 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
277 (defvar imap-streams '(gssapi kerberos4 starttls tls ssl network shell) |
31717 | 278 "Priority of streams to consider when opening connection to server.") |
279 | |
280 (defvar imap-stream-alist | |
281 '((gssapi imap-gssapi-stream-p imap-gssapi-open) | |
282 (kerberos4 imap-kerberos4-stream-p imap-kerberos4-open) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
283 (tls imap-tls-p imap-tls-open) |
31717 | 284 (ssl imap-ssl-p imap-ssl-open) |
285 (network imap-network-p imap-network-open) | |
286 (shell imap-shell-p imap-shell-open) | |
287 (starttls imap-starttls-p imap-starttls-open)) | |
288 "Definition of network streams. | |
289 | |
47129
dd529e3b965b
(imap-authenticator-alist, imap-stream-alist, imap-continuation): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
42205
diff
changeset
|
290 \(NAME CHECK OPEN) |
31717 | 291 |
292 NAME names the stream, CHECK is a function returning non-nil if the | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
293 server support the stream and OPEN is a function for opening the |
31717 | 294 stream.") |
295 | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
296 (defvar imap-authenticators '(gssapi |
31717 | 297 kerberos4 |
298 digest-md5 | |
299 cram-md5 | |
300 login | |
301 anonymous) | |
302 "Priority of authenticators to consider when authenticating to server.") | |
303 | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
304 (defvar imap-authenticator-alist |
31717 | 305 '((gssapi imap-gssapi-auth-p imap-gssapi-auth) |
306 (kerberos4 imap-kerberos4-auth-p imap-kerberos4-auth) | |
307 (cram-md5 imap-cram-md5-p imap-cram-md5-auth) | |
308 (login imap-login-p imap-login-auth) | |
309 (anonymous imap-anonymous-p imap-anonymous-auth) | |
310 (digest-md5 imap-digest-md5-p imap-digest-md5-auth)) | |
311 "Definition of authenticators. | |
312 | |
47129
dd529e3b965b
(imap-authenticator-alist, imap-stream-alist, imap-continuation): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
42205
diff
changeset
|
313 \(NAME CHECK AUTHENTICATE) |
31717 | 314 |
315 NAME names the authenticator. CHECK is a function returning non-nil if | |
316 the server support the authenticator and AUTHENTICATE is a function | |
47129
dd529e3b965b
(imap-authenticator-alist, imap-stream-alist, imap-continuation): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
42205
diff
changeset
|
317 for doing the actual authentication.") |
31717 | 318 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
319 (defvar imap-error nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
320 "Error codes from the last command.") |
31717 | 321 |
322 ;; Internal constants. Change theese and die. | |
323 | |
324 (defconst imap-default-port 143) | |
325 (defconst imap-default-ssl-port 993) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
326 (defconst imap-default-tls-port 993) |
31717 | 327 (defconst imap-default-stream 'network) |
328 (defconst imap-coding-system-for-read 'binary) | |
329 (defconst imap-coding-system-for-write 'binary) | |
330 (defconst imap-local-variables '(imap-server | |
331 imap-port | |
332 imap-client-eol | |
333 imap-server-eol | |
334 imap-auth | |
335 imap-stream | |
336 imap-username | |
337 imap-password | |
338 imap-current-mailbox | |
339 imap-current-target-mailbox | |
340 imap-message-data | |
341 imap-capability | |
342 imap-namespace | |
343 imap-state | |
344 imap-reached-tag | |
345 imap-failed-tags | |
346 imap-tag | |
347 imap-process | |
348 imap-calculate-literal-size-first | |
349 imap-mailbox-data)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
350 (defconst imap-log-buffer "*imap-log*") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
351 (defconst imap-debug-buffer "*imap-debug*") |
31717 | 352 |
353 ;; Internal variables. | |
354 | |
355 (defvar imap-stream nil) | |
356 (defvar imap-auth nil) | |
357 (defvar imap-server nil) | |
358 (defvar imap-port nil) | |
359 (defvar imap-username nil) | |
360 (defvar imap-password nil) | |
361 (defvar imap-calculate-literal-size-first nil) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
362 (defvar imap-state 'closed |
31717 | 363 "IMAP state. |
364 Valid states are `closed', `initial', `nonauth', `auth', `selected' | |
365 and `examine'.") | |
366 | |
367 (defvar imap-server-eol "\r\n" | |
368 "The EOL string sent from the server.") | |
369 | |
370 (defvar imap-client-eol "\r\n" | |
371 "The EOL string we send to the server.") | |
372 | |
373 (defvar imap-current-mailbox nil | |
374 "Current mailbox name.") | |
375 | |
376 (defvar imap-current-target-mailbox nil | |
377 "Current target mailbox for COPY and APPEND commands.") | |
378 | |
379 (defvar imap-mailbox-data nil | |
380 "Obarray with mailbox data.") | |
381 | |
382 (defvar imap-mailbox-prime 997 | |
383 "Length of imap-mailbox-data.") | |
384 | |
385 (defvar imap-current-message nil | |
386 "Current message number.") | |
387 | |
388 (defvar imap-message-data nil | |
389 "Obarray with message data.") | |
390 | |
391 (defvar imap-message-prime 997 | |
392 "Length of imap-message-data.") | |
393 | |
394 (defvar imap-capability nil | |
395 "Capability for server.") | |
396 | |
397 (defvar imap-namespace nil | |
398 "Namespace for current server.") | |
399 | |
400 (defvar imap-reached-tag 0 | |
401 "Lower limit on command tags that have been parsed.") | |
402 | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
403 (defvar imap-failed-tags nil |
31717 | 404 "Alist of tags that failed. |
405 Each element is a list with four elements; tag (a integer), response | |
406 state (a symbol, `OK', `NO' or `BAD'), response code (a string), and | |
407 human readable response text (a string).") | |
408 | |
409 (defvar imap-tag 0 | |
410 "Command tag number.") | |
411 | |
412 (defvar imap-process nil | |
413 "Process.") | |
414 | |
415 (defvar imap-continuation nil | |
416 "Non-nil indicates that the server emitted a continuation request. | |
47129
dd529e3b965b
(imap-authenticator-alist, imap-stream-alist, imap-continuation): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
42205
diff
changeset
|
417 The actual value is really the text on the continuation line.") |
31717 | 418 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
419 (defvar imap-callbacks nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
420 "List of response tags and callbacks, on the form `(number . function)'. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
421 The function should take two arguments, the first the IMAP tag and the |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
422 second the status (OK, NO, BAD etc) of the command.") |
31717 | 423 |
424 | |
425 ;; Utility functions: | |
426 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
427 (defun imap-remassoc (key alist) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
428 "Delete by side effect any elements of LIST whose car is `equal' to KEY. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
429 The modified LIST is returned. If the first member |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
430 of LIST has a car that is `equal' to KEY, there is no way to remove it |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
431 by side effect; therefore, write `(setq foo (remassoc key foo))' to be |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
432 sure of changing the value of `foo'." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
433 (when alist |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
434 (if (equal key (caar alist)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
435 (cdr alist) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
436 (setcdr alist (imap-remassoc key (cdr alist))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
437 alist))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
438 |
31717 | 439 (defsubst imap-disable-multibyte () |
440 "Enable multibyte in the current buffer." | |
441 (when (fboundp 'set-buffer-multibyte) | |
442 (set-buffer-multibyte nil))) | |
443 | |
444 (defsubst imap-utf7-encode (string) | |
445 (if imap-use-utf7 | |
446 (and string | |
447 (condition-case () | |
448 (utf7-encode string t) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
449 (error (message |
31717 | 450 "imap: Could not UTF7 encode `%s', using it unencoded..." |
451 string) | |
452 string))) | |
453 string)) | |
454 | |
455 (defsubst imap-utf7-decode (string) | |
456 (if imap-use-utf7 | |
457 (and string | |
458 (condition-case () | |
459 (utf7-decode string t) | |
460 (error (message | |
461 "imap: Could not UTF7 decode `%s', using it undecoded..." | |
462 string) | |
463 string))) | |
464 string)) | |
465 | |
466 (defsubst imap-ok-p (status) | |
467 (if (eq status 'OK) | |
468 t | |
469 (setq imap-error status) | |
470 nil)) | |
471 | |
472 (defun imap-error-text (&optional buffer) | |
473 (with-current-buffer (or buffer (current-buffer)) | |
474 (nth 3 (car imap-failed-tags)))) | |
475 | |
476 | |
477 ;; Server functions; stream stuff: | |
478 | |
479 (defun imap-kerberos4-stream-p (buffer) | |
480 (imap-capability 'AUTH=KERBEROS_V4 buffer)) | |
481 | |
482 (defun imap-kerberos4-open (name buffer server port) | |
483 (let ((cmds imap-kerberos4-program) | |
484 cmd done) | |
485 (while (and (not done) (setq cmd (pop cmds))) | |
486 (message "Opening Kerberos 4 IMAP connection with `%s'..." cmd) | |
487 (erase-buffer) | |
488 (let* ((port (or port imap-default-port)) | |
489 (coding-system-for-read imap-coding-system-for-read) | |
490 (coding-system-for-write imap-coding-system-for-write) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
491 (process-connection-type imap-process-connection-type) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
492 (process (start-process |
31717 | 493 name buffer shell-file-name shell-command-switch |
494 (format-spec | |
495 cmd | |
496 (format-spec-make | |
497 ?s server | |
498 ?p (number-to-string port) | |
499 ?l imap-default-user)))) | |
500 response) | |
501 (when process | |
502 (with-current-buffer buffer | |
503 (setq imap-client-eol "\n" | |
504 imap-calculate-literal-size-first t) | |
505 (while (and (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
506 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
31717 | 507 (goto-char (point-min)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
508 ;; Athena IMTEST can output SSL verify errors |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
509 (or (while (looking-at "^verify error:num=") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
510 (forward-line)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
511 t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
512 (or (while (looking-at "^TLS connection established") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
513 (forward-line)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
514 t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
515 ;; cyrus 1.6.x (13? < x <= 22) queries capabilities |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
516 (or (while (looking-at "^C:") |
31717 | 517 (forward-line)) |
518 t) | |
519 ;; cyrus 1.6 imtest print "S: " before server greeting | |
520 (or (not (looking-at "S: ")) | |
521 (forward-char 3) | |
522 t) | |
523 (not (and (imap-parse-greeting) | |
524 ;; success in imtest < 1.6: | |
525 (or (re-search-forward | |
526 "^__\\(.*\\)__\n" nil t) | |
527 ;; success in imtest 1.6: | |
528 (re-search-forward | |
529 "^\\(Authenticat.*\\)" nil t)) | |
530 (setq response (match-string 1))))) | |
531 (accept-process-output process 1) | |
532 (sit-for 1)) | |
533 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
534 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 535 (imap-disable-multibyte) |
536 (buffer-disable-undo) | |
537 (goto-char (point-max)) | |
538 (insert-buffer-substring buffer))) | |
539 (erase-buffer) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
540 (message "Opening Kerberos 4 IMAP connection with `%s'...%s" cmd |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
541 (if response (concat "done, " response) "failed")) |
31717 | 542 (if (and response (let ((case-fold-search nil)) |
543 (not (string-match "failed" response)))) | |
544 (setq done process) | |
545 (if (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
546 (imap-send-command "LOGOUT")) |
31717 | 547 (delete-process process) |
548 nil))))) | |
549 done)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
550 |
31717 | 551 (defun imap-gssapi-stream-p (buffer) |
552 (imap-capability 'AUTH=GSSAPI buffer)) | |
553 | |
554 (defun imap-gssapi-open (name buffer server port) | |
555 (let ((cmds imap-gssapi-program) | |
556 cmd done) | |
557 (while (and (not done) (setq cmd (pop cmds))) | |
558 (message "Opening GSSAPI IMAP connection with `%s'..." cmd) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
559 (erase-buffer) |
31717 | 560 (let* ((port (or port imap-default-port)) |
561 (coding-system-for-read imap-coding-system-for-read) | |
562 (coding-system-for-write imap-coding-system-for-write) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
563 (process-connection-type imap-process-connection-type) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
564 (process (start-process |
31717 | 565 name buffer shell-file-name shell-command-switch |
566 (format-spec | |
567 cmd | |
568 (format-spec-make | |
569 ?s server | |
570 ?p (number-to-string port) | |
571 ?l imap-default-user)))) | |
572 response) | |
573 (when process | |
574 (with-current-buffer buffer | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
575 (setq imap-client-eol "\n" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
576 imap-calculate-literal-size-first t) |
31717 | 577 (while (and (memq (process-status process) '(open run)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
578 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
31717 | 579 (goto-char (point-min)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
580 ;; cyrus 1.6.x (13? < x <= 22) queries capabilities |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
581 (or (while (looking-at "^C:") |
31717 | 582 (forward-line)) |
583 t) | |
584 ;; cyrus 1.6 imtest print "S: " before server greeting | |
585 (or (not (looking-at "S: ")) | |
586 (forward-char 3) | |
587 t) | |
588 (not (and (imap-parse-greeting) | |
589 ;; success in imtest 1.6: | |
590 (re-search-forward | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
591 (concat "^\\(\\(Authenticat.*\\)\\|\\(" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
592 "Client authentication " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
593 "finished.*\\)\\)") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
594 nil t) |
31717 | 595 (setq response (match-string 1))))) |
596 (accept-process-output process 1) | |
597 (sit-for 1)) | |
598 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
599 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 600 (imap-disable-multibyte) |
601 (buffer-disable-undo) | |
602 (goto-char (point-max)) | |
603 (insert-buffer-substring buffer))) | |
604 (erase-buffer) | |
605 (message "GSSAPI IMAP connection: %s" (or response "failed")) | |
606 (if (and response (let ((case-fold-search nil)) | |
607 (not (string-match "failed" response)))) | |
608 (setq done process) | |
609 (if (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
610 (imap-send-command "LOGOUT")) |
31717 | 611 (delete-process process) |
612 nil))))) | |
613 done)) | |
614 | |
615 (defun imap-ssl-p (buffer) | |
616 nil) | |
617 | |
618 (defun imap-ssl-open (name buffer server port) | |
619 "Open a SSL connection to server." | |
620 (let ((cmds (if (listp imap-ssl-program) imap-ssl-program | |
621 (list imap-ssl-program))) | |
622 cmd done) | |
623 (while (and (not done) (setq cmd (pop cmds))) | |
624 (message "imap: Opening SSL connection with `%s'..." cmd) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
625 (erase-buffer) |
31717 | 626 (let* ((port (or port imap-default-ssl-port)) |
627 (coding-system-for-read imap-coding-system-for-read) | |
628 (coding-system-for-write imap-coding-system-for-write) | |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
629 (process-connection-type nil) |
31717 | 630 process) |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
631 (when (progn |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
632 (setq process (start-process |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
633 name buffer shell-file-name |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
634 shell-command-switch |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
635 (format-spec cmd |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
636 (format-spec-make |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
637 ?s server |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
638 ?p (number-to-string port))))) |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
639 (process-kill-without-query process) |
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
640 process) |
31717 | 641 (with-current-buffer buffer |
642 (goto-char (point-min)) | |
643 (while (and (memq (process-status process) '(open run)) | |
49993
a40d0a292281
* nnfolder.el (nnfolder-request-accept-article): Don't use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
49474
diff
changeset
|
644 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
31717 | 645 (goto-char (point-max)) |
646 (forward-line -1) | |
647 (not (imap-parse-greeting))) | |
648 (accept-process-output process 1) | |
649 (sit-for 1)) | |
650 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
651 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 652 (imap-disable-multibyte) |
653 (buffer-disable-undo) | |
654 (goto-char (point-max)) | |
655 (insert-buffer-substring buffer))) | |
656 (erase-buffer) | |
657 (when (memq (process-status process) '(open run)) | |
658 (setq done process)))))) | |
659 (if done | |
660 (progn | |
661 (message "imap: Opening SSL connection with `%s'...done" cmd) | |
662 done) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
663 (message "imap: Opening SSL connection with `%s'...failed" cmd) |
31717 | 664 nil))) |
665 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
666 (defun imap-tls-p (buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
667 nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
668 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
669 (defun imap-tls-open (name buffer server port) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
670 (let* ((port (or port imap-default-tls-port)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
671 (coding-system-for-read imap-coding-system-for-read) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
672 (coding-system-for-write imap-coding-system-for-write) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
673 (process (open-tls-stream name buffer server port))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
674 (when process |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
675 (while (and (memq (process-status process) '(open run)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
676 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
677 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
678 (forward-line -1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
679 (not (imap-parse-greeting))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
680 (accept-process-output process 1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
681 (sit-for 1)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
682 (and imap-log |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
683 (with-current-buffer (get-buffer-create imap-log-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
684 (imap-disable-multibyte) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
685 (buffer-disable-undo) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
686 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
687 (insert-buffer-substring buffer))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
688 (when (memq (process-status process) '(open run)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
689 process)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
690 |
31717 | 691 (defun imap-network-p (buffer) |
692 t) | |
693 | |
694 (defun imap-network-open (name buffer server port) | |
695 (let* ((port (or port imap-default-port)) | |
696 (coding-system-for-read imap-coding-system-for-read) | |
697 (coding-system-for-write imap-coding-system-for-write) | |
698 (process (open-network-stream name buffer server port))) | |
699 (when process | |
700 (while (and (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
701 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
31717 | 702 (goto-char (point-min)) |
703 (not (imap-parse-greeting))) | |
704 (accept-process-output process 1) | |
705 (sit-for 1)) | |
706 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
707 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 708 (imap-disable-multibyte) |
709 (buffer-disable-undo) | |
710 (goto-char (point-max)) | |
711 (insert-buffer-substring buffer))) | |
712 (when (memq (process-status process) '(open run)) | |
713 process)))) | |
714 | |
715 (defun imap-shell-p (buffer) | |
716 nil) | |
717 | |
718 (defun imap-shell-open (name buffer server port) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
719 (let ((cmds (if (listp imap-shell-program) imap-shell-program |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
720 (list imap-shell-program))) |
31717 | 721 cmd done) |
722 (while (and (not done) (setq cmd (pop cmds))) | |
723 (message "imap: Opening IMAP connection with `%s'..." cmd) | |
724 (setq imap-client-eol "\n") | |
725 (let* ((port (or port imap-default-port)) | |
726 (coding-system-for-read imap-coding-system-for-read) | |
727 (coding-system-for-write imap-coding-system-for-write) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
728 (process (start-process |
31717 | 729 name buffer shell-file-name shell-command-switch |
730 (format-spec | |
731 cmd | |
732 (format-spec-make | |
733 ?s server | |
734 ?g imap-shell-host | |
735 ?p (number-to-string port) | |
736 ?l imap-default-user))))) | |
737 (when process | |
738 (while (and (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
739 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
740 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
741 (forward-line -1) |
31717 | 742 (not (imap-parse-greeting))) |
743 (accept-process-output process 1) | |
744 (sit-for 1)) | |
745 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
746 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 747 (imap-disable-multibyte) |
748 (buffer-disable-undo) | |
749 (goto-char (point-max)) | |
750 (insert-buffer-substring buffer))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
751 (erase-buffer) |
31717 | 752 (when (memq (process-status process) '(open run)) |
753 (setq done process))))) | |
754 (if done | |
755 (progn | |
756 (message "imap: Opening IMAP connection with `%s'...done" cmd) | |
757 done) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
758 (message "imap: Opening IMAP connection with `%s'...failed" cmd) |
31717 | 759 nil))) |
760 | |
761 (defun imap-starttls-p (buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
762 (imap-capability 'STARTTLS buffer)) |
31717 | 763 |
764 (defun imap-starttls-open (name buffer server port) | |
765 (let* ((port (or port imap-default-port)) | |
766 (coding-system-for-read imap-coding-system-for-read) | |
767 (coding-system-for-write imap-coding-system-for-write) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
768 (process (starttls-open-stream name buffer server port)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
769 done tls-info) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
770 (message "imap: Connecting with STARTTLS...") |
31717 | 771 (when process |
772 (while (and (memq (process-status process) '(open run)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
773 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
774 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
775 (forward-line -1) |
31717 | 776 (not (imap-parse-greeting))) |
777 (accept-process-output process 1) | |
778 (sit-for 1)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
779 (imap-send-command "STARTTLS") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
780 (while (and (memq (process-status process) '(open run)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
781 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
782 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
783 (forward-line -1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
784 (not (re-search-forward "[0-9]+ OK.*\r?\n" nil t))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
785 (accept-process-output process 1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
786 (sit-for 1)) |
31717 | 787 (and imap-log |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
788 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 789 (buffer-disable-undo) |
790 (goto-char (point-max)) | |
791 (insert-buffer-substring buffer))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
792 (when (and (setq tls-info (starttls-negotiate process)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
793 (memq (process-status process) '(open run))) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
794 (setq done process))) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
795 (if (stringp tls-info) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
796 (message "imap: STARTTLS info: %s" tls-info)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
797 (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
798 done)) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
799 |
31717 | 800 ;; Server functions; authenticator stuff: |
801 | |
802 (defun imap-interactive-login (buffer loginfunc) | |
803 "Login to server in BUFFER. | |
804 LOGINFUNC is passed a username and a password, it should return t if | |
48588 | 805 it where successful authenticating itself to the server, nil otherwise. |
31717 | 806 Returns t if login was successful, nil otherwise." |
807 (with-current-buffer buffer | |
41516
52c9115c94be
(imap-interactive-login, imap-open, imap-authenticate):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39064
diff
changeset
|
808 (make-local-variable 'imap-username) |
52c9115c94be
(imap-interactive-login, imap-open, imap-authenticate):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39064
diff
changeset
|
809 (make-local-variable 'imap-password) |
31717 | 810 (let (user passwd ret) |
811 ;; (condition-case () | |
812 (while (or (not user) (not passwd)) | |
813 (setq user (or imap-username | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
814 (read-from-minibuffer |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
815 (concat "IMAP username for " imap-server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
816 " (using stream `" (symbol-name imap-stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
817 "'): ") |
31717 | 818 (or user imap-default-user)))) |
819 (setq passwd (or imap-password | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
820 (read-passwd |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
821 (concat "IMAP password for " user "@" |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
822 imap-server " (using authenticator `" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
823 (symbol-name imap-auth) "'): ")))) |
31717 | 824 (when (and user passwd) |
825 (if (funcall loginfunc user passwd) | |
826 (progn | |
827 (setq ret t | |
828 imap-username user) | |
829 (if (and (not imap-password) | |
830 (y-or-n-p "Store password for this session? ")) | |
831 (setq imap-password passwd))) | |
832 (message "Login failed...") | |
833 (setq passwd nil) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
834 (setq imap-password nil) |
31717 | 835 (sit-for 1)))) |
836 ;; (quit (with-current-buffer buffer | |
837 ;; (setq user nil | |
838 ;; passwd nil))) | |
839 ;; (error (with-current-buffer buffer | |
840 ;; (setq user nil | |
841 ;; passwd nil)))) | |
842 ret))) | |
843 | |
844 (defun imap-gssapi-auth-p (buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
845 (eq imap-stream 'gssapi)) |
31717 | 846 |
847 (defun imap-gssapi-auth (buffer) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
848 (message "imap: Authenticating using GSSAPI...%s" |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
849 (if (eq imap-stream 'gssapi) "done" "failed")) |
31717 | 850 (eq imap-stream 'gssapi)) |
851 | |
852 (defun imap-kerberos4-auth-p (buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
853 (and (imap-capability 'AUTH=KERBEROS_V4 buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
854 (eq imap-stream 'kerberos4))) |
31717 | 855 |
856 (defun imap-kerberos4-auth (buffer) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
857 (message "imap: Authenticating using Kerberos 4...%s" |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
858 (if (eq imap-stream 'kerberos4) "done" "failed")) |
31717 | 859 (eq imap-stream 'kerberos4)) |
860 | |
861 (defun imap-cram-md5-p (buffer) | |
862 (imap-capability 'AUTH=CRAM-MD5 buffer)) | |
863 | |
864 (defun imap-cram-md5-auth (buffer) | |
865 "Login to server using the AUTH CRAM-MD5 method." | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
866 (message "imap: Authenticating using CRAM-MD5...") |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
867 (let ((done (imap-interactive-login |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
868 buffer |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
869 (lambda (user passwd) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
870 (imap-ok-p |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
871 (imap-send-command-wait |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
872 (list |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
873 "AUTHENTICATE CRAM-MD5" |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
874 (lambda (challenge) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
875 (let* ((decoded (base64-decode-string challenge)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
876 (hash (rfc2104-hash 'md5 64 16 passwd decoded)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
877 (response (concat user " " hash)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
878 (encoded (base64-encode-string response))) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
879 encoded))))))))) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
880 (if done |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
881 (message "imap: Authenticating using CRAM-MD5...done") |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
882 (message "imap: Authenticating using CRAM-MD5...failed")))) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
883 |
31717 | 884 (defun imap-login-p (buffer) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
885 (and (not (imap-capability 'LOGINDISABLED buffer)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
886 (not (imap-capability 'X-LOGIN-CMD-DISABLED buffer)))) |
31717 | 887 |
888 (defun imap-login-auth (buffer) | |
889 "Login to server using the LOGIN command." | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
890 (message "imap: Plaintext authentication...") |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
891 (imap-interactive-login buffer |
31717 | 892 (lambda (user passwd) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
893 (imap-ok-p (imap-send-command-wait |
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
894 (concat "LOGIN \"" user "\" \"" |
31717 | 895 passwd "\"")))))) |
896 | |
897 (defun imap-anonymous-p (buffer) | |
898 t) | |
899 | |
900 (defun imap-anonymous-auth (buffer) | |
48588 | 901 (message "imap: Logging in anonymously...") |
31717 | 902 (with-current-buffer buffer |
903 (imap-ok-p (imap-send-command-wait | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
904 (concat "LOGIN anonymous \"" (concat (user-login-name) "@" |
31717 | 905 (system-name)) "\""))))) |
906 | |
907 (defun imap-digest-md5-p (buffer) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
908 (and (imap-capability 'AUTH=DIGEST-MD5 buffer) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
909 (condition-case () |
31717 | 910 (require 'digest-md5) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
911 (error nil)))) |
31717 | 912 |
913 (defun imap-digest-md5-auth (buffer) | |
914 "Login to server using the AUTH DIGEST-MD5 method." | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
915 (message "imap: Authenticating using DIGEST-MD5...") |
31717 | 916 (imap-interactive-login |
917 buffer | |
918 (lambda (user passwd) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
919 (let ((tag |
31717 | 920 (imap-send-command |
921 (list | |
922 "AUTHENTICATE DIGEST-MD5" | |
923 (lambda (challenge) | |
924 (digest-md5-parse-digest-challenge | |
925 (base64-decode-string challenge)) | |
926 (let* ((digest-uri | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
927 (digest-md5-digest-uri |
31717 | 928 "imap" (digest-md5-challenge 'realm))) |
929 (response | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
930 (digest-md5-digest-response |
31717 | 931 user passwd digest-uri))) |
932 (base64-encode-string response 'no-line-break)))) | |
933 ))) | |
934 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) | |
935 nil | |
936 (setq imap-continuation nil) | |
937 (imap-send-command-1 "") | |
938 (imap-ok-p (imap-wait-for-tag tag))))))) | |
939 | |
940 ;; Server functions: | |
941 | |
942 (defun imap-open-1 (buffer) | |
943 (with-current-buffer buffer | |
944 (erase-buffer) | |
945 (setq imap-current-mailbox nil | |
946 imap-current-message nil | |
947 imap-state 'initial | |
948 imap-process (condition-case () | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
949 (funcall (nth 2 (assq imap-stream |
31717 | 950 imap-stream-alist)) |
951 "imap" buffer imap-server imap-port) | |
952 ((error quit) nil))) | |
953 (when imap-process | |
954 (set-process-filter imap-process 'imap-arrival-filter) | |
955 (set-process-sentinel imap-process 'imap-sentinel) | |
956 (while (and (eq imap-state 'initial) | |
957 (memq (process-status imap-process) '(open run))) | |
958 (message "Waiting for response from %s..." imap-server) | |
959 (accept-process-output imap-process 1)) | |
960 (message "Waiting for response from %s...done" imap-server) | |
961 (and (memq (process-status imap-process) '(open run)) | |
962 imap-process)))) | |
963 | |
964 (defun imap-open (server &optional port stream auth buffer) | |
965 "Open a IMAP connection to host SERVER at PORT returning a buffer. | |
966 If PORT is unspecified, a default value is used (143 except | |
967 for SSL which use 993). | |
968 STREAM indicates the stream to use, see `imap-streams' for available | |
969 streams. If nil, it choices the best stream the server is capable of. | |
970 AUTH indicates authenticator to use, see `imap-authenticators' for | |
971 available authenticators. If nil, it choices the best stream the | |
972 server is capable of. | |
973 BUFFER can be a buffer or a name of a buffer, which is created if | |
48588 | 974 necessary. If nil, the buffer name is generated." |
31717 | 975 (setq buffer (or buffer (format " *imap* %s:%d" server (or port 0)))) |
976 (with-current-buffer (get-buffer-create buffer) | |
977 (if (imap-opened buffer) | |
978 (imap-close buffer)) | |
41516
52c9115c94be
(imap-interactive-login, imap-open, imap-authenticate):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39064
diff
changeset
|
979 (mapcar 'make-local-variable imap-local-variables) |
31717 | 980 (imap-disable-multibyte) |
981 (buffer-disable-undo) | |
982 (setq imap-server (or server imap-server)) | |
983 (setq imap-port (or port imap-port)) | |
984 (setq imap-auth (or auth imap-auth)) | |
985 (setq imap-stream (or stream imap-stream)) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
986 (message "imap: Connecting to %s..." imap-server) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
987 (if (null (let ((imap-stream (or imap-stream imap-default-stream))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
988 (imap-open-1 buffer))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
989 (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
990 (message "imap: Connecting to %s...failed" imap-server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
991 nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
992 (when (null imap-stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
993 ;; Need to choose stream. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
994 (let ((streams imap-streams)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
995 (while (setq stream (pop streams)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
996 ;; OK to use this stream? |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
997 (when (funcall (nth 1 (assq stream imap-stream-alist)) buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
998 ;; Stream changed? |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
999 (if (not (eq imap-default-stream stream)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1000 (with-current-buffer (get-buffer-create |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1001 (generate-new-buffer-name " *temp*")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1002 (mapcar 'make-local-variable imap-local-variables) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1003 (imap-disable-multibyte) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1004 (buffer-disable-undo) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1005 (setq imap-server (or server imap-server)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1006 (setq imap-port (or port imap-port)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1007 (setq imap-auth (or auth imap-auth)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1008 (message "imap: Reconnecting with stream `%s'..." stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1009 (if (null (let ((imap-stream stream)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1010 (imap-open-1 (current-buffer)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1011 (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1012 (kill-buffer (current-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1013 (message |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1014 "imap: Reconnecting with stream `%s'...failed" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1015 stream)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1016 ;; We're done, kill the first connection |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1017 (imap-close buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1018 (kill-buffer buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1019 (rename-buffer buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1020 (message "imap: Reconnecting with stream `%s'...done" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1021 stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1022 (setq imap-stream stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1023 (setq imap-capability nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1024 (setq streams nil))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1025 ;; We're done |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1026 (message "imap: Connecting to %s...done" imap-server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1027 (setq imap-stream stream) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1028 (setq imap-capability nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1029 (setq streams nil)))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1030 (when (imap-opened buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1031 (setq imap-mailbox-data (make-vector imap-mailbox-prime 0))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1032 (when imap-stream |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1033 buffer)))) |
31717 | 1034 |
1035 (defun imap-opened (&optional buffer) | |
1036 "Return non-nil if connection to imap server in BUFFER is open. | |
1037 If BUFFER is nil then the current buffer is used." | |
1038 (and (setq buffer (get-buffer (or buffer (current-buffer)))) | |
1039 (buffer-live-p buffer) | |
1040 (with-current-buffer buffer | |
1041 (and imap-process | |
1042 (memq (process-status imap-process) '(open run)))))) | |
1043 | |
1044 (defun imap-authenticate (&optional user passwd buffer) | |
1045 "Authenticate to server in BUFFER, using current buffer if nil. | |
1046 It uses the authenticator specified when opening the server. If the | |
1047 authenticator requires username/passwords, they are queried from the | |
1048 user and optionally stored in the buffer. If USER and/or PASSWD is | |
1049 specified, the user will not be questioned and the username and/or | |
1050 password is remembered in the buffer." | |
1051 (with-current-buffer (or buffer (current-buffer)) | |
1052 (if (not (eq imap-state 'nonauth)) | |
1053 (or (eq imap-state 'auth) | |
1054 (eq imap-state 'select) | |
1055 (eq imap-state 'examine)) | |
41516
52c9115c94be
(imap-interactive-login, imap-open, imap-authenticate):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39064
diff
changeset
|
1056 (make-local-variable 'imap-username) |
52c9115c94be
(imap-interactive-login, imap-open, imap-authenticate):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39064
diff
changeset
|
1057 (make-local-variable 'imap-password) |
31717 | 1058 (if user (setq imap-username user)) |
1059 (if passwd (setq imap-password passwd)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1060 (if imap-auth |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1061 (and (funcall (nth 2 (assq imap-auth |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1062 imap-authenticator-alist)) buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1063 (setq imap-state 'auth)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1064 ;; Choose authenticator. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1065 (let ((auths imap-authenticators) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1066 auth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1067 (while (setq auth (pop auths)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1068 ;; OK to use authenticator? |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1069 (when (funcall (nth 1 (assq auth imap-authenticator-alist)) buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1070 (message "imap: Authenticating to `%s' using `%s'..." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1071 imap-server auth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1072 (setq imap-auth auth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1073 (if (funcall (nth 2 (assq auth imap-authenticator-alist)) buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1074 (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1075 (message "imap: Authenticating to `%s' using `%s'...done" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1076 imap-server auth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1077 (setq auths nil)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1078 (message "imap: Authenticating to `%s' using `%s'...failed" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1079 imap-server auth))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1080 imap-state)))) |
31717 | 1081 |
1082 (defun imap-close (&optional buffer) | |
1083 "Close connection to server in BUFFER. | |
1084 If BUFFER is nil, the current buffer is used." | |
1085 (with-current-buffer (or buffer (current-buffer)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1086 (when (imap-opened) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1087 (condition-case nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1088 (imap-send-command-wait "LOGOUT") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1089 (quit nil))) |
31717 | 1090 (when (and imap-process |
1091 (memq (process-status imap-process) '(open run))) | |
1092 (delete-process imap-process)) | |
1093 (setq imap-current-mailbox nil | |
1094 imap-current-message nil | |
1095 imap-process nil) | |
1096 (erase-buffer) | |
1097 t)) | |
1098 | |
1099 (defun imap-capability (&optional identifier buffer) | |
1100 "Return a list of identifiers which server in BUFFER support. | |
1101 If IDENTIFIER, return non-nil if it's among the servers capabilities. | |
1102 If BUFFER is nil, the current buffer is assumed." | |
1103 (with-current-buffer (or buffer (current-buffer)) | |
1104 (unless imap-capability | |
1105 (unless (imap-ok-p (imap-send-command-wait "CAPABILITY")) | |
1106 (setq imap-capability '(IMAP2)))) | |
1107 (if identifier | |
1108 (memq (intern (upcase (symbol-name identifier))) imap-capability) | |
1109 imap-capability))) | |
1110 | |
1111 (defun imap-namespace (&optional buffer) | |
1112 "Return a namespace hierarchy at server in BUFFER. | |
1113 If BUFFER is nil, the current buffer is assumed." | |
1114 (with-current-buffer (or buffer (current-buffer)) | |
1115 (unless imap-namespace | |
1116 (when (imap-capability 'NAMESPACE) | |
1117 (imap-send-command-wait "NAMESPACE"))) | |
1118 imap-namespace)) | |
1119 | |
1120 (defun imap-send-command-wait (command &optional buffer) | |
1121 (imap-wait-for-tag (imap-send-command command buffer) buffer)) | |
1122 | |
1123 | |
1124 ;; Mailbox functions: | |
1125 | |
1126 (defun imap-mailbox-put (propname value &optional mailbox buffer) | |
1127 (with-current-buffer (or buffer (current-buffer)) | |
1128 (if imap-mailbox-data | |
1129 (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data) | |
1130 propname value) | |
1131 (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s" | |
1132 propname value mailbox (current-buffer))) | |
1133 t)) | |
1134 | |
1135 (defsubst imap-mailbox-get-1 (propname &optional mailbox) | |
1136 (get (intern-soft (or mailbox imap-current-mailbox) imap-mailbox-data) | |
1137 propname)) | |
1138 | |
1139 (defun imap-mailbox-get (propname &optional mailbox buffer) | |
1140 (let ((mailbox (imap-utf7-encode mailbox))) | |
1141 (with-current-buffer (or buffer (current-buffer)) | |
1142 (imap-mailbox-get-1 propname (or mailbox imap-current-mailbox))))) | |
1143 | |
1144 (defun imap-mailbox-map-1 (func &optional mailbox-decoder buffer) | |
1145 (with-current-buffer (or buffer (current-buffer)) | |
1146 (let (result) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1147 (mapatoms |
31717 | 1148 (lambda (s) |
1149 (push (funcall func (if mailbox-decoder | |
1150 (funcall mailbox-decoder (symbol-name s)) | |
1151 (symbol-name s))) result)) | |
1152 imap-mailbox-data) | |
1153 result))) | |
1154 | |
1155 (defun imap-mailbox-map (func &optional buffer) | |
1156 "Map a function across each mailbox in `imap-mailbox-data', returning a list. | |
1157 Function should take a mailbox name (a string) as | |
1158 the only argument." | |
1159 (imap-mailbox-map-1 func 'imap-utf7-decode buffer)) | |
1160 | |
1161 (defun imap-current-mailbox (&optional buffer) | |
1162 (with-current-buffer (or buffer (current-buffer)) | |
1163 (imap-utf7-decode imap-current-mailbox))) | |
1164 | |
1165 (defun imap-current-mailbox-p-1 (mailbox &optional examine) | |
1166 (and (string= mailbox imap-current-mailbox) | |
1167 (or (and examine | |
1168 (eq imap-state 'examine)) | |
1169 (and (not examine) | |
1170 (eq imap-state 'selected))))) | |
1171 | |
1172 (defun imap-current-mailbox-p (mailbox &optional examine buffer) | |
1173 (with-current-buffer (or buffer (current-buffer)) | |
1174 (imap-current-mailbox-p-1 (imap-utf7-encode mailbox) examine))) | |
1175 | |
1176 (defun imap-mailbox-select-1 (mailbox &optional examine) | |
1177 "Select MAILBOX on server in BUFFER. | |
1178 If EXAMINE is non-nil, do a read-only select." | |
1179 (if (imap-current-mailbox-p-1 mailbox examine) | |
1180 imap-current-mailbox | |
1181 (setq imap-current-mailbox mailbox) | |
1182 (if (imap-ok-p (imap-send-command-wait | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1183 (concat (if examine "EXAMINE" "SELECT") " \"" |
31717 | 1184 mailbox "\""))) |
1185 (progn | |
1186 (setq imap-message-data (make-vector imap-message-prime 0) | |
1187 imap-state (if examine 'examine 'selected)) | |
1188 imap-current-mailbox) | |
1189 ;; Failed SELECT/EXAMINE unselects current mailbox | |
1190 (setq imap-current-mailbox nil)))) | |
1191 | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1192 (defun imap-mailbox-select (mailbox &optional examine buffer) |
31717 | 1193 (with-current-buffer (or buffer (current-buffer)) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1194 (imap-utf7-decode |
31717 | 1195 (imap-mailbox-select-1 (imap-utf7-encode mailbox) examine)))) |
1196 | |
1197 (defun imap-mailbox-examine-1 (mailbox &optional buffer) | |
1198 (with-current-buffer (or buffer (current-buffer)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1199 (imap-mailbox-select-1 mailbox 'examine))) |
31717 | 1200 |
1201 (defun imap-mailbox-examine (mailbox &optional buffer) | |
1202 "Examine MAILBOX on server in BUFFER." | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1203 (imap-mailbox-select mailbox 'examine buffer)) |
31717 | 1204 |
1205 (defun imap-mailbox-unselect (&optional buffer) | |
1206 "Close current folder in BUFFER, without expunging articles." | |
1207 (with-current-buffer (or buffer (current-buffer)) | |
1208 (when (or (eq imap-state 'auth) | |
1209 (and (imap-capability 'UNSELECT) | |
1210 (imap-ok-p (imap-send-command-wait "UNSELECT"))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1211 (and (imap-ok-p |
31717 | 1212 (imap-send-command-wait (concat "EXAMINE \"" |
1213 imap-current-mailbox | |
1214 "\""))) | |
1215 (imap-ok-p (imap-send-command-wait "CLOSE")))) | |
1216 (setq imap-current-mailbox nil | |
1217 imap-message-data nil | |
1218 imap-state 'auth) | |
1219 t))) | |
1220 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1221 (defun imap-mailbox-expunge (&optional asynch buffer) |
31717 | 1222 "Expunge articles in current folder in BUFFER. |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1223 If ASYNCH, do not wait for succesful completion of the command. |
31717 | 1224 If BUFFER is nil the current buffer is assumed." |
1225 (with-current-buffer (or buffer (current-buffer)) | |
1226 (when (and imap-current-mailbox (not (eq imap-state 'examine))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1227 (if asynch |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1228 (imap-send-command "EXPUNGE") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1229 (imap-ok-p (imap-send-command-wait "EXPUNGE")))))) |
31717 | 1230 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1231 (defun imap-mailbox-close (&optional asynch buffer) |
31717 | 1232 "Expunge articles and close current folder in BUFFER. |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1233 If ASYNCH, do not wait for succesful completion of the command. |
31717 | 1234 If BUFFER is nil the current buffer is assumed." |
1235 (with-current-buffer (or buffer (current-buffer)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1236 (when imap-current-mailbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1237 (if asynch |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1238 (imap-add-callback (imap-send-command "CLOSE") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1239 `(lambda (tag status) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1240 (message "IMAP mailbox `%s' closed... %s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1241 imap-current-mailbox status) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1242 (when (eq ,imap-current-mailbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1243 imap-current-mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1244 ;; Don't wipe out data if another mailbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1245 ;; was selected... |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1246 (setq imap-current-mailbox nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1247 imap-message-data nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1248 imap-state 'auth)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1249 (when (imap-ok-p (imap-send-command-wait "CLOSE")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1250 (setq imap-current-mailbox nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1251 imap-message-data nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1252 imap-state 'auth))) |
31717 | 1253 t))) |
1254 | |
1255 (defun imap-mailbox-create-1 (mailbox) | |
1256 (imap-ok-p (imap-send-command-wait (list "CREATE \"" mailbox "\"")))) | |
1257 | |
1258 (defun imap-mailbox-create (mailbox &optional buffer) | |
1259 "Create MAILBOX on server in BUFFER. | |
1260 If BUFFER is nil the current buffer is assumed." | |
1261 (with-current-buffer (or buffer (current-buffer)) | |
1262 (imap-mailbox-create-1 (imap-utf7-encode mailbox)))) | |
1263 | |
1264 (defun imap-mailbox-delete (mailbox &optional buffer) | |
1265 "Delete MAILBOX on server in BUFFER. | |
1266 If BUFFER is nil the current buffer is assumed." | |
1267 (let ((mailbox (imap-utf7-encode mailbox))) | |
1268 (with-current-buffer (or buffer (current-buffer)) | |
1269 (imap-ok-p | |
1270 (imap-send-command-wait (list "DELETE \"" mailbox "\"")))))) | |
1271 | |
1272 (defun imap-mailbox-rename (oldname newname &optional buffer) | |
1273 "Rename mailbox OLDNAME to NEWNAME on server in BUFFER. | |
1274 If BUFFER is nil the current buffer is assumed." | |
1275 (let ((oldname (imap-utf7-encode oldname)) | |
1276 (newname (imap-utf7-encode newname))) | |
1277 (with-current-buffer (or buffer (current-buffer)) | |
1278 (imap-ok-p | |
1279 (imap-send-command-wait (list "RENAME \"" oldname "\" " | |
1280 "\"" newname "\"")))))) | |
1281 | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1282 (defun imap-mailbox-lsub (&optional root reference add-delimiter buffer) |
31717 | 1283 "Return a list of subscribed mailboxes on server in BUFFER. |
1284 If ROOT is non-nil, only list matching mailboxes. If ADD-DELIMITER is | |
1285 non-nil, a hierarchy delimiter is added to root. REFERENCE is a | |
1286 implementation-specific string that has to be passed to lsub command." | |
1287 (with-current-buffer (or buffer (current-buffer)) | |
1288 ;; Make sure we know the hierarchy separator for root's hierarchy | |
1289 (when (and add-delimiter (null (imap-mailbox-get-1 'delimiter root))) | |
1290 (imap-send-command-wait (concat "LIST \"" reference "\" \"" | |
1291 (imap-utf7-encode root) "\""))) | |
1292 ;; clear list data (NB not delimiter and other stuff) | |
1293 (imap-mailbox-map-1 (lambda (mailbox) | |
1294 (imap-mailbox-put 'lsub nil mailbox))) | |
1295 (when (imap-ok-p | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1296 (imap-send-command-wait |
31717 | 1297 (concat "LSUB \"" reference "\" \"" (imap-utf7-encode root) |
1298 (and add-delimiter (imap-mailbox-get-1 'delimiter root)) | |
1299 "%\""))) | |
1300 (let (out) | |
1301 (imap-mailbox-map-1 (lambda (mailbox) | |
1302 (when (imap-mailbox-get-1 'lsub mailbox) | |
1303 (push (imap-utf7-decode mailbox) out)))) | |
1304 (nreverse out))))) | |
1305 | |
1306 (defun imap-mailbox-list (root &optional reference add-delimiter buffer) | |
1307 "Return a list of mailboxes matching ROOT on server in BUFFER. | |
1308 If ADD-DELIMITER is non-nil, a hierarchy delimiter is added to | |
1309 root. REFERENCE is a implementation-specific string that has to be | |
1310 passed to list command." | |
1311 (with-current-buffer (or buffer (current-buffer)) | |
1312 ;; Make sure we know the hierarchy separator for root's hierarchy | |
1313 (when (and add-delimiter (null (imap-mailbox-get-1 'delimiter root))) | |
1314 (imap-send-command-wait (concat "LIST \"" reference "\" \"" | |
1315 (imap-utf7-encode root) "\""))) | |
1316 ;; clear list data (NB not delimiter and other stuff) | |
1317 (imap-mailbox-map-1 (lambda (mailbox) | |
1318 (imap-mailbox-put 'list nil mailbox))) | |
1319 (when (imap-ok-p | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1320 (imap-send-command-wait |
31717 | 1321 (concat "LIST \"" reference "\" \"" (imap-utf7-encode root) |
1322 (and add-delimiter (imap-mailbox-get-1 'delimiter root)) | |
1323 "%\""))) | |
1324 (let (out) | |
1325 (imap-mailbox-map-1 (lambda (mailbox) | |
1326 (when (imap-mailbox-get-1 'list mailbox) | |
1327 (push (imap-utf7-decode mailbox) out)))) | |
1328 (nreverse out))))) | |
1329 | |
1330 (defun imap-mailbox-subscribe (mailbox &optional buffer) | |
1331 "Send the SUBSCRIBE command on the mailbox to server in BUFFER. | |
1332 Returns non-nil if successful." | |
1333 (with-current-buffer (or buffer (current-buffer)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1334 (imap-ok-p (imap-send-command-wait (concat "SUBSCRIBE \"" |
31717 | 1335 (imap-utf7-encode mailbox) |
1336 "\""))))) | |
1337 | |
1338 (defun imap-mailbox-unsubscribe (mailbox &optional buffer) | |
1339 "Send the SUBSCRIBE command on the mailbox to server in BUFFER. | |
1340 Returns non-nil if successful." | |
1341 (with-current-buffer (or buffer (current-buffer)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1342 (imap-ok-p (imap-send-command-wait (concat "UNSUBSCRIBE " |
31717 | 1343 (imap-utf7-encode mailbox) |
1344 "\""))))) | |
1345 | |
1346 (defun imap-mailbox-status (mailbox items &optional buffer) | |
1347 "Get status items ITEM in MAILBOX from server in BUFFER. | |
1348 ITEMS can be a symbol or a list of symbols, valid symbols are one of | |
1349 the STATUS data items -- ie 'messages, 'recent, 'uidnext, 'uidvalidity | |
1350 or 'unseen. If ITEMS is a list of symbols, a list of values is | |
49474
a53b597e29e0
(imap-mailbox-status): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1351 returned, if ITEMS is a symbol only its value is returned." |
31717 | 1352 (with-current-buffer (or buffer (current-buffer)) |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1353 (when (imap-ok-p |
31717 | 1354 (imap-send-command-wait (list "STATUS \"" |
1355 (imap-utf7-encode mailbox) | |
1356 "\" " | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1357 (upcase |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1358 (format "%s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1359 (if (listp items) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1360 items |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1361 (list items))))))) |
31717 | 1362 (if (listp items) |
1363 (mapcar (lambda (item) | |
1364 (imap-mailbox-get item mailbox)) | |
1365 items) | |
1366 (imap-mailbox-get items mailbox))))) | |
1367 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1368 (defun imap-mailbox-status-asynch (mailbox items &optional buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1369 "Send status item request ITEM on MAILBOX to server in BUFFER. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1370 ITEMS can be a symbol or a list of symbols, valid symbols are one of |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1371 the STATUS data items -- ie 'messages, 'recent, 'uidnext, 'uidvalidity |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1372 or 'unseen. The IMAP command tag is returned." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1373 (with-current-buffer (or buffer (current-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1374 (imap-send-command (list "STATUS \"" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1375 (imap-utf7-encode mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1376 "\" " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1377 (format "%s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1378 (if (listp items) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1379 items |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1380 (list items))))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1381 |
31717 | 1382 (defun imap-mailbox-acl-get (&optional mailbox buffer) |
1383 "Get ACL on mailbox from server in BUFFER." | |
1384 (let ((mailbox (imap-utf7-encode mailbox))) | |
1385 (with-current-buffer (or buffer (current-buffer)) | |
1386 (when (imap-ok-p | |
1387 (imap-send-command-wait (list "GETACL \"" | |
1388 (or mailbox imap-current-mailbox) | |
1389 "\""))) | |
1390 (imap-mailbox-get-1 'acl (or mailbox imap-current-mailbox)))))) | |
1391 | |
1392 (defun imap-mailbox-acl-set (identifier rights &optional mailbox buffer) | |
1393 "Change/set ACL for IDENTIFIER to RIGHTS in MAILBOX from server in BUFFER." | |
1394 (let ((mailbox (imap-utf7-encode mailbox))) | |
1395 (with-current-buffer (or buffer (current-buffer)) | |
1396 (imap-ok-p | |
1397 (imap-send-command-wait (list "SETACL \"" | |
1398 (or mailbox imap-current-mailbox) | |
1399 "\" " | |
1400 identifier | |
1401 " " | |
1402 rights)))))) | |
1403 | |
1404 (defun imap-mailbox-acl-delete (identifier &optional mailbox buffer) | |
1405 "Removes any <identifier,rights> pair for IDENTIFIER in MAILBOX from server in BUFFER." | |
1406 (let ((mailbox (imap-utf7-encode mailbox))) | |
1407 (with-current-buffer (or buffer (current-buffer)) | |
1408 (imap-ok-p | |
1409 (imap-send-command-wait (list "DELETEACL \"" | |
1410 (or mailbox imap-current-mailbox) | |
1411 "\" " | |
1412 identifier)))))) | |
1413 | |
1414 | |
1415 ;; Message functions: | |
1416 | |
1417 (defun imap-current-message (&optional buffer) | |
1418 (with-current-buffer (or buffer (current-buffer)) | |
1419 imap-current-message)) | |
1420 | |
1421 (defun imap-list-to-message-set (list) | |
1422 (mapconcat (lambda (item) | |
1423 (number-to-string item)) | |
1424 (if (listp list) | |
1425 list | |
1426 (list list)) | |
1427 ",")) | |
1428 | |
1429 (defun imap-range-to-message-set (range) | |
1430 (mapconcat | |
1431 (lambda (item) | |
1432 (if (consp item) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1433 (format "%d:%d" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1434 (car item) (cdr item)) |
31717 | 1435 (format "%d" item))) |
1436 (if (and (listp range) (not (listp (cdr range)))) | |
1437 (list range) ;; make (1 . 2) into ((1 . 2)) | |
1438 range) | |
1439 ",")) | |
1440 | |
1441 (defun imap-fetch-asynch (uids props &optional nouidfetch buffer) | |
1442 (with-current-buffer (or buffer (current-buffer)) | |
1443 (imap-send-command (format "%sFETCH %s %s" (if nouidfetch "" "UID ") | |
1444 (if (listp uids) | |
1445 (imap-list-to-message-set uids) | |
1446 uids) | |
1447 props)))) | |
1448 | |
1449 (defun imap-fetch (uids props &optional receive nouidfetch buffer) | |
1450 "Fetch properties PROPS from message set UIDS from server in BUFFER. | |
1451 UIDS can be a string, number or a list of numbers. If RECEIVE | |
1452 is non-nil return theese properties." | |
1453 (with-current-buffer (or buffer (current-buffer)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1454 (when (imap-ok-p (imap-send-command-wait |
31717 | 1455 (format "%sFETCH %s %s" (if nouidfetch "" "UID ") |
1456 (if (listp uids) | |
1457 (imap-list-to-message-set uids) | |
1458 uids) | |
1459 props))) | |
1460 (if (or (null receive) (stringp uids)) | |
1461 t | |
1462 (if (listp uids) | |
1463 (mapcar (lambda (uid) | |
1464 (if (listp receive) | |
1465 (mapcar (lambda (prop) | |
1466 (imap-message-get uid prop)) | |
1467 receive) | |
1468 (imap-message-get uid receive))) | |
1469 uids) | |
1470 (imap-message-get uids receive)))))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1471 |
31717 | 1472 (defun imap-message-put (uid propname value &optional buffer) |
1473 (with-current-buffer (or buffer (current-buffer)) | |
1474 (if imap-message-data | |
1475 (put (intern (number-to-string uid) imap-message-data) | |
1476 propname value) | |
1477 (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s" | |
1478 uid propname value (current-buffer))) | |
1479 t)) | |
1480 | |
1481 (defun imap-message-get (uid propname &optional buffer) | |
1482 (with-current-buffer (or buffer (current-buffer)) | |
1483 (get (intern-soft (number-to-string uid) imap-message-data) | |
1484 propname))) | |
1485 | |
1486 (defun imap-message-map (func propname &optional buffer) | |
1487 "Map a function across each mailbox in `imap-message-data', returning a list." | |
1488 (with-current-buffer (or buffer (current-buffer)) | |
1489 (let (result) | |
1490 (mapatoms | |
1491 (lambda (s) | |
1492 (push (funcall func (get s 'UID) (get s propname)) result)) | |
1493 imap-message-data) | |
1494 result))) | |
1495 | |
1496 (defmacro imap-message-envelope-date (uid &optional buffer) | |
1497 `(with-current-buffer (or ,buffer (current-buffer)) | |
1498 (elt (imap-message-get ,uid 'ENVELOPE) 0))) | |
1499 | |
1500 (defmacro imap-message-envelope-subject (uid &optional buffer) | |
1501 `(with-current-buffer (or ,buffer (current-buffer)) | |
1502 (elt (imap-message-get ,uid 'ENVELOPE) 1))) | |
1503 | |
1504 (defmacro imap-message-envelope-from (uid &optional buffer) | |
1505 `(with-current-buffer (or ,buffer (current-buffer)) | |
1506 (elt (imap-message-get ,uid 'ENVELOPE) 2))) | |
1507 | |
1508 (defmacro imap-message-envelope-sender (uid &optional buffer) | |
1509 `(with-current-buffer (or ,buffer (current-buffer)) | |
1510 (elt (imap-message-get ,uid 'ENVELOPE) 3))) | |
1511 | |
1512 (defmacro imap-message-envelope-reply-to (uid &optional buffer) | |
1513 `(with-current-buffer (or ,buffer (current-buffer)) | |
1514 (elt (imap-message-get ,uid 'ENVELOPE) 4))) | |
1515 | |
1516 (defmacro imap-message-envelope-to (uid &optional buffer) | |
1517 `(with-current-buffer (or ,buffer (current-buffer)) | |
1518 (elt (imap-message-get ,uid 'ENVELOPE) 5))) | |
1519 | |
1520 (defmacro imap-message-envelope-cc (uid &optional buffer) | |
1521 `(with-current-buffer (or ,buffer (current-buffer)) | |
1522 (elt (imap-message-get ,uid 'ENVELOPE) 6))) | |
1523 | |
1524 (defmacro imap-message-envelope-bcc (uid &optional buffer) | |
1525 `(with-current-buffer (or ,buffer (current-buffer)) | |
1526 (elt (imap-message-get ,uid 'ENVELOPE) 7))) | |
1527 | |
1528 (defmacro imap-message-envelope-in-reply-to (uid &optional buffer) | |
1529 `(with-current-buffer (or ,buffer (current-buffer)) | |
1530 (elt (imap-message-get ,uid 'ENVELOPE) 8))) | |
1531 | |
1532 (defmacro imap-message-envelope-message-id (uid &optional buffer) | |
1533 `(with-current-buffer (or ,buffer (current-buffer)) | |
1534 (elt (imap-message-get ,uid 'ENVELOPE) 9))) | |
1535 | |
1536 (defmacro imap-message-body (uid &optional buffer) | |
1537 `(with-current-buffer (or ,buffer (current-buffer)) | |
1538 (imap-message-get ,uid 'BODY))) | |
1539 | |
1540 (defun imap-search (predicate &optional buffer) | |
1541 (with-current-buffer (or buffer (current-buffer)) | |
1542 (imap-mailbox-put 'search 'dummy) | |
1543 (when (imap-ok-p (imap-send-command-wait (concat "UID SEARCH " predicate))) | |
1544 (if (eq (imap-mailbox-get-1 'search imap-current-mailbox) 'dummy) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1545 (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1546 (message "Missing SEARCH response to a SEARCH command (server not RFC compliant)...") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1547 nil) |
31717 | 1548 (imap-mailbox-get-1 'search imap-current-mailbox))))) |
1549 | |
1550 (defun imap-message-flag-permanent-p (flag &optional mailbox buffer) | |
1551 "Return t iff FLAG can be permanently (between IMAP sessions) saved on articles, in MAILBOX on server in BUFFER." | |
1552 (with-current-buffer (or buffer (current-buffer)) | |
1553 (or (member "\\*" (imap-mailbox-get 'permanentflags mailbox)) | |
1554 (member flag (imap-mailbox-get 'permanentflags mailbox))))) | |
1555 | |
1556 (defun imap-message-flags-set (articles flags &optional silent buffer) | |
1557 (when (and articles flags) | |
1558 (with-current-buffer (or buffer (current-buffer)) | |
1559 (imap-ok-p (imap-send-command-wait | |
1560 (concat "UID STORE " articles | |
1561 " FLAGS" (if silent ".SILENT") " (" flags ")")))))) | |
1562 | |
1563 (defun imap-message-flags-del (articles flags &optional silent buffer) | |
1564 (when (and articles flags) | |
1565 (with-current-buffer (or buffer (current-buffer)) | |
1566 (imap-ok-p (imap-send-command-wait | |
1567 (concat "UID STORE " articles | |
1568 " -FLAGS" (if silent ".SILENT") " (" flags ")")))))) | |
1569 | |
1570 (defun imap-message-flags-add (articles flags &optional silent buffer) | |
1571 (when (and articles flags) | |
1572 (with-current-buffer (or buffer (current-buffer)) | |
1573 (imap-ok-p (imap-send-command-wait | |
1574 (concat "UID STORE " articles | |
1575 " +FLAGS" (if silent ".SILENT") " (" flags ")")))))) | |
1576 | |
1577 (defun imap-message-copyuid-1 (mailbox) | |
1578 (if (imap-capability 'UIDPLUS) | |
1579 (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox)) | |
1580 (string-to-number (nth 2 (imap-mailbox-get-1 'copyuid mailbox)))) | |
1581 (let ((old-mailbox imap-current-mailbox) | |
1582 (state imap-state) | |
1583 (imap-message-data (make-vector 2 0))) | |
1584 (when (imap-mailbox-examine-1 mailbox) | |
1585 (prog1 | |
1586 (and (imap-fetch "*" "UID") | |
1587 (list (imap-mailbox-get-1 'uidvalidity mailbox) | |
1588 (apply 'max (imap-message-map | |
1589 (lambda (uid prop) uid) 'UID)))) | |
1590 (if old-mailbox | |
1591 (imap-mailbox-select old-mailbox (eq state 'examine)) | |
1592 (imap-mailbox-unselect))))))) | |
1593 | |
1594 (defun imap-message-copyuid (mailbox &optional buffer) | |
1595 (with-current-buffer (or buffer (current-buffer)) | |
1596 (imap-message-copyuid-1 (imap-utf7-decode mailbox)))) | |
1597 | |
1598 (defun imap-message-copy (articles mailbox | |
1599 &optional dont-create no-copyuid buffer) | |
1600 "Copy ARTICLES (a string message set) to MAILBOX on server in | |
1601 BUFFER, creating mailbox if it doesn't exist. If dont-create is | |
1602 non-nil, it will not create a mailbox. On success, return a list with | |
1603 the UIDVALIDITY of the mailbox the article(s) was copied to as the | |
1604 first element, rest of list contain the saved articles' UIDs." | |
1605 (when articles | |
1606 (with-current-buffer (or buffer (current-buffer)) | |
1607 (let ((mailbox (imap-utf7-encode mailbox))) | |
1608 (if (let ((cmd (concat "UID COPY " articles " \"" mailbox "\"")) | |
1609 (imap-current-target-mailbox mailbox)) | |
1610 (if (imap-ok-p (imap-send-command-wait cmd)) | |
1611 t | |
1612 (when (and (not dont-create) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1613 ;; removed because of buggy Oracle server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1614 ;; that doesn't send TRYCREATE tags (which |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1615 ;; is a MUST according to specifications): |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1616 ;;(imap-mailbox-get-1 'trycreate mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1617 (imap-mailbox-create-1 mailbox)) |
31717 | 1618 (imap-ok-p (imap-send-command-wait cmd))))) |
1619 (or no-copyuid | |
1620 (imap-message-copyuid-1 mailbox))))))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1621 |
31717 | 1622 (defun imap-message-appenduid-1 (mailbox) |
1623 (if (imap-capability 'UIDPLUS) | |
1624 (imap-mailbox-get-1 'appenduid mailbox) | |
1625 (let ((old-mailbox imap-current-mailbox) | |
1626 (state imap-state) | |
1627 (imap-message-data (make-vector 2 0))) | |
1628 (when (imap-mailbox-examine-1 mailbox) | |
1629 (prog1 | |
1630 (and (imap-fetch "*" "UID") | |
1631 (list (imap-mailbox-get-1 'uidvalidity mailbox) | |
1632 (apply 'max (imap-message-map | |
1633 (lambda (uid prop) uid) 'UID)))) | |
1634 (if old-mailbox | |
1635 (imap-mailbox-select old-mailbox (eq state 'examine)) | |
1636 (imap-mailbox-unselect))))))) | |
1637 | |
1638 (defun imap-message-appenduid (mailbox &optional buffer) | |
1639 (with-current-buffer (or buffer (current-buffer)) | |
1640 (imap-message-appenduid-1 (imap-utf7-encode mailbox)))) | |
1641 | |
1642 (defun imap-message-append (mailbox article &optional flags date-time buffer) | |
1643 "Append ARTICLE (a buffer) to MAILBOX on server in BUFFER. | |
1644 FLAGS and DATE-TIME is currently not used. Return a cons holding | |
1645 uidvalidity of MAILBOX and UID the newly created article got, or nil | |
1646 on failure." | |
1647 (let ((mailbox (imap-utf7-encode mailbox))) | |
1648 (with-current-buffer (or buffer (current-buffer)) | |
1649 (and (let ((imap-current-target-mailbox mailbox)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1650 (imap-ok-p |
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1651 (imap-send-command-wait |
31717 | 1652 (list "APPEND \"" mailbox "\" " article)))) |
1653 (imap-message-appenduid-1 mailbox))))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1654 |
31717 | 1655 (defun imap-body-lines (body) |
1656 "Return number of lines in article by looking at the mime bodystructure BODY." | |
1657 (if (listp body) | |
1658 (if (stringp (car body)) | |
1659 (cond ((and (string= (upcase (car body)) "TEXT") | |
1660 (numberp (nth 7 body))) | |
1661 (nth 7 body)) | |
1662 ((and (string= (upcase (car body)) "MESSAGE") | |
1663 (numberp (nth 9 body))) | |
1664 (nth 9 body)) | |
1665 (t 0)) | |
1666 (apply '+ (mapcar 'imap-body-lines body))) | |
1667 0)) | |
1668 | |
1669 (defun imap-envelope-from (from) | |
1670 "Return a from string line." | |
1671 (and from | |
1672 (concat (aref from 0) | |
1673 (if (aref from 0) " <") | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1674 (aref from 2) |
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1675 "@" |
31717 | 1676 (aref from 3) |
1677 (if (aref from 0) ">")))) | |
1678 | |
1679 | |
1680 ;; Internal functions. | |
1681 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1682 (defun imap-add-callback (tag func) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1683 (setq imap-callbacks (append (list (cons tag func)) imap-callbacks))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1684 |
31717 | 1685 (defun imap-send-command-1 (cmdstr) |
1686 (setq cmdstr (concat cmdstr imap-client-eol)) | |
1687 (and imap-log | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1688 (with-current-buffer (get-buffer-create imap-log-buffer) |
31717 | 1689 (imap-disable-multibyte) |
1690 (buffer-disable-undo) | |
1691 (goto-char (point-max)) | |
1692 (insert cmdstr))) | |
1693 (process-send-string imap-process cmdstr)) | |
1694 | |
1695 (defun imap-send-command (command &optional buffer) | |
1696 (with-current-buffer (or buffer (current-buffer)) | |
1697 (if (not (listp command)) (setq command (list command))) | |
1698 (let ((tag (setq imap-tag (1+ imap-tag))) | |
1699 cmd cmdstr) | |
1700 (setq cmdstr (concat (number-to-string imap-tag) " ")) | |
1701 (while (setq cmd (pop command)) | |
1702 (cond ((stringp cmd) | |
1703 (setq cmdstr (concat cmdstr cmd))) | |
1704 ((bufferp cmd) | |
1705 (let ((eol imap-client-eol) | |
1706 (calcfirst imap-calculate-literal-size-first) | |
1707 size) | |
1708 (with-current-buffer cmd | |
1709 (if calcfirst | |
1710 (setq size (buffer-size))) | |
1711 (when (not (equal eol "\r\n")) | |
1712 ;; XXX modifies buffer! | |
1713 (goto-char (point-min)) | |
1714 (while (search-forward "\r\n" nil t) | |
1715 (replace-match eol))) | |
1716 (if (not calcfirst) | |
1717 (setq size (buffer-size)))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1718 (setq cmdstr |
31717 | 1719 (concat cmdstr (format "{%d}" size)))) |
1720 (unwind-protect | |
1721 (progn | |
1722 (imap-send-command-1 cmdstr) | |
1723 (setq cmdstr nil) | |
1724 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1725 (setq command nil) ;; abort command if no cont-req |
31717 | 1726 (let ((process imap-process) |
1727 (stream imap-stream) | |
1728 (eol imap-client-eol)) | |
1729 (with-current-buffer cmd | |
1730 (and imap-log | |
1731 (with-current-buffer (get-buffer-create | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1732 imap-log-buffer) |
31717 | 1733 (imap-disable-multibyte) |
1734 (buffer-disable-undo) | |
1735 (goto-char (point-max)) | |
1736 (insert-buffer-substring cmd))) | |
1737 (process-send-region process (point-min) | |
1738 (point-max))) | |
1739 (process-send-string process imap-client-eol)))) | |
1740 (setq imap-continuation nil))) | |
1741 ((functionp cmd) | |
1742 (imap-send-command-1 cmdstr) | |
1743 (setq cmdstr nil) | |
1744 (unwind-protect | |
1745 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1746 (setq command nil) ;; abort command if no cont-req |
31717 | 1747 (setq command (cons (funcall cmd imap-continuation) |
1748 command))) | |
1749 (setq imap-continuation nil))) | |
1750 (t | |
1751 (error "Unknown command type")))) | |
1752 (if cmdstr | |
1753 (imap-send-command-1 cmdstr)) | |
1754 tag))) | |
1755 | |
1756 (defun imap-wait-for-tag (tag &optional buffer) | |
1757 (with-current-buffer (or buffer (current-buffer)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1758 (let (imap-have-messaged) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1759 (while (and (null imap-continuation) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1760 (memq (process-status imap-process) '(open run)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1761 (< imap-reached-tag tag)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1762 (let ((len (/ (point-max) 1024)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1763 message-log-max) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1764 (unless (< len 10) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1765 (setq imap-have-messaged t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1766 (message "imap read: %dk" len)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1767 (accept-process-output imap-process |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1768 (truncate imap-read-timeout) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1769 (truncate (* (- imap-read-timeout |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1770 (truncate imap-read-timeout)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1771 1000))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1772 ;; A process can die _before_ we have processed everything it |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1773 ;; has to say. Moreover, this can happen in between the call to |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1774 ;; accept-process-output and the call to process-status in an |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1775 ;; iteration of the loop above. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1776 (when (and (null imap-continuation) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1777 (< imap-reached-tag tag)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1778 (accept-process-output imap-process 0 0)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1779 (when imap-have-messaged |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1780 (message "")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1781 (and (memq (process-status imap-process) '(open run)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1782 (or (assq tag imap-failed-tags) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1783 (if imap-continuation |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1784 'INCOMPLETE |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1785 'OK)))))) |
31717 | 1786 |
1787 (defun imap-sentinel (process string) | |
1788 (delete-process process)) | |
1789 | |
1790 (defun imap-find-next-line () | |
1791 "Return point at end of current line, taking into account literals. | |
1792 Return nil if no complete line has arrived." | |
1793 (when (re-search-forward (concat imap-server-eol "\\|{\\([0-9]+\\)}" | |
1794 imap-server-eol) | |
1795 nil t) | |
1796 (if (match-string 1) | |
1797 (if (< (point-max) (+ (point) (string-to-number (match-string 1)))) | |
1798 nil | |
1799 (goto-char (+ (point) (string-to-number (match-string 1)))) | |
1800 (imap-find-next-line)) | |
1801 (point)))) | |
1802 | |
1803 (defun imap-arrival-filter (proc string) | |
1804 "IMAP process filter." | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1805 ;; Sometimes, we are called even though the process has died. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1806 ;; Better abstain from doing stuff in that case. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1807 (when (buffer-name (process-buffer proc)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1808 (with-current-buffer (process-buffer proc) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1809 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1810 (insert string) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1811 (and imap-log |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1812 (with-current-buffer (get-buffer-create imap-log-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1813 (imap-disable-multibyte) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1814 (buffer-disable-undo) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1815 (goto-char (point-max)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1816 (insert string))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1817 (let (end) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1818 (goto-char (point-min)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1819 (while (setq end (imap-find-next-line)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1820 (save-restriction |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1821 (narrow-to-region (point-min) end) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1822 (delete-backward-char (length imap-server-eol)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1823 (goto-char (point-min)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1824 (unwind-protect |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1825 (cond ((eq imap-state 'initial) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1826 (imap-parse-greeting)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1827 ((or (eq imap-state 'auth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1828 (eq imap-state 'nonauth) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1829 (eq imap-state 'selected) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1830 (eq imap-state 'examine)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1831 (imap-parse-response)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1832 (t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1833 (message "Unknown state %s in arrival filter" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1834 imap-state))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
1835 (delete-region (point-min) (point-max))))))))) |
31717 | 1836 |
1837 | |
1838 ;; Imap parser. | |
1839 | |
1840 (defsubst imap-forward () | |
1841 (or (eobp) (forward-char))) | |
1842 | |
1843 ;; number = 1*DIGIT | |
1844 ;; ; Unsigned 32-bit integer | |
1845 ;; ; (0 <= n < 4,294,967,296) | |
1846 | |
1847 (defsubst imap-parse-number () | |
1848 (when (looking-at "[0-9]+") | |
1849 (prog1 | |
1850 (string-to-number (match-string 0)) | |
1851 (goto-char (match-end 0))))) | |
1852 | |
1853 ;; literal = "{" number "}" CRLF *CHAR8 | |
1854 ;; ; Number represents the number of CHAR8s | |
1855 | |
1856 (defsubst imap-parse-literal () | |
1857 (when (looking-at "{\\([0-9]+\\)}\r\n") | |
1858 (let ((pos (match-end 0)) | |
1859 (len (string-to-number (match-string 1)))) | |
1860 (if (< (point-max) (+ pos len)) | |
1861 nil | |
1862 (goto-char (+ pos len)) | |
1863 (buffer-substring pos (+ pos len)))))) | |
1864 | |
1865 ;; string = quoted / literal | |
1866 ;; | |
1867 ;; quoted = DQUOTE *QUOTED-CHAR DQUOTE | |
1868 ;; | |
1869 ;; QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> / | |
1870 ;; "\" quoted-specials | |
1871 ;; | |
1872 ;; quoted-specials = DQUOTE / "\" | |
1873 ;; | |
1874 ;; TEXT-CHAR = <any CHAR except CR and LF> | |
1875 | |
1876 (defsubst imap-parse-string () | |
1877 (cond ((eq (char-after) ?\") | |
1878 (forward-char 1) | |
1879 (let ((p (point)) (name "")) | |
1880 (skip-chars-forward "^\"\\\\") | |
1881 (setq name (buffer-substring p (point))) | |
1882 (while (eq (char-after) ?\\) | |
1883 (setq p (1+ (point))) | |
1884 (forward-char 2) | |
1885 (skip-chars-forward "^\"\\\\") | |
1886 (setq name (concat name (buffer-substring p (point))))) | |
1887 (forward-char 1) | |
1888 name)) | |
1889 ((eq (char-after) ?{) | |
1890 (imap-parse-literal)))) | |
1891 | |
1892 ;; nil = "NIL" | |
1893 | |
1894 (defsubst imap-parse-nil () | |
1895 (if (looking-at "NIL") | |
1896 (goto-char (match-end 0)))) | |
1897 | |
1898 ;; nstring = string / nil | |
1899 | |
1900 (defsubst imap-parse-nstring () | |
1901 (or (imap-parse-string) | |
1902 (and (imap-parse-nil) | |
1903 nil))) | |
1904 | |
1905 ;; astring = atom / string | |
1906 ;; | |
1907 ;; atom = 1*ATOM-CHAR | |
1908 ;; | |
1909 ;; ATOM-CHAR = <any CHAR except atom-specials> | |
1910 ;; | |
1911 ;; atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / | |
1912 ;; quoted-specials | |
1913 ;; | |
1914 ;; list-wildcards = "%" / "*" | |
1915 ;; | |
1916 ;; quoted-specials = DQUOTE / "\" | |
1917 | |
1918 (defsubst imap-parse-astring () | |
1919 (or (imap-parse-string) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
1920 (buffer-substring (point) |
31717 | 1921 (if (re-search-forward "[(){ \r\n%*\"\\]" nil t) |
1922 (goto-char (1- (match-end 0))) | |
1923 (end-of-line) | |
1924 (point))))) | |
1925 | |
1926 ;; address = "(" addr-name SP addr-adl SP addr-mailbox SP | |
1927 ;; addr-host ")" | |
1928 ;; | |
1929 ;; addr-adl = nstring | |
1930 ;; ; Holds route from [RFC-822] route-addr if | |
42205 | 1931 ;; ; non-nil |
31717 | 1932 ;; |
1933 ;; addr-host = nstring | |
42205 | 1934 ;; ; nil indicates [RFC-822] group syntax. |
31717 | 1935 ;; ; Otherwise, holds [RFC-822] domain name |
1936 ;; | |
1937 ;; addr-mailbox = nstring | |
42205 | 1938 ;; ; nil indicates end of [RFC-822] group; if |
1939 ;; ; non-nil and addr-host is nil, holds | |
31717 | 1940 ;; ; [RFC-822] group name. |
1941 ;; ; Otherwise, holds [RFC-822] local-part | |
1942 ;; ; after removing [RFC-822] quoting | |
1943 ;; | |
1944 ;; addr-name = nstring | |
42205 | 1945 ;; ; If non-nil, holds phrase from [RFC-822] |
31717 | 1946 ;; ; mailbox after removing [RFC-822] quoting |
1947 ;; | |
1948 | |
1949 (defsubst imap-parse-address () | |
1950 (let (address) | |
1951 (when (eq (char-after) ?\() | |
1952 (imap-forward) | |
1953 (setq address (vector (prog1 (imap-parse-nstring) | |
1954 (imap-forward)) | |
1955 (prog1 (imap-parse-nstring) | |
1956 (imap-forward)) | |
1957 (prog1 (imap-parse-nstring) | |
1958 (imap-forward)) | |
1959 (imap-parse-nstring))) | |
1960 (when (eq (char-after) ?\)) | |
1961 (imap-forward) | |
1962 address)))) | |
1963 | |
1964 ;; address-list = "(" 1*address ")" / nil | |
1965 ;; | |
1966 ;; nil = "NIL" | |
1967 | |
1968 (defsubst imap-parse-address-list () | |
1969 (if (eq (char-after) ?\() | |
1970 (let (address addresses) | |
1971 (imap-forward) | |
1972 (while (and (not (eq (char-after) ?\))) | |
1973 ;; next line for MS Exchange bug | |
1974 (progn (and (eq (char-after) ? ) (imap-forward)) t) | |
1975 (setq address (imap-parse-address))) | |
1976 (setq addresses (cons address addresses))) | |
1977 (when (eq (char-after) ?\)) | |
1978 (imap-forward) | |
1979 (nreverse addresses))) | |
82966
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
1980 ;; With assert, the code might not be eval'd. |
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
1981 ;; (assert (imap-parse-nil) t "In imap-parse-address-list") |
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
1982 (imap-parse-nil))) |
31717 | 1983 |
1984 ;; mailbox = "INBOX" / astring | |
1985 ;; ; INBOX is case-insensitive. All case variants of | |
1986 ;; ; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX | |
1987 ;; ; not as an astring. An astring which consists of | |
1988 ;; ; the case-insensitive sequence "I" "N" "B" "O" "X" | |
1989 ;; ; is considered to be INBOX and not an astring. | |
1990 ;; ; Refer to section 5.1 for further | |
1991 ;; ; semantic details of mailbox names. | |
1992 | |
1993 (defsubst imap-parse-mailbox () | |
1994 (let ((mailbox (imap-parse-astring))) | |
1995 (if (string-equal "INBOX" (upcase mailbox)) | |
1996 "INBOX" | |
1997 mailbox))) | |
1998 | |
1999 ;; greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF | |
2000 ;; | |
2001 ;; resp-cond-auth = ("OK" / "PREAUTH") SP resp-text | |
2002 ;; ; Authentication condition | |
2003 ;; | |
2004 ;; resp-cond-bye = "BYE" SP resp-text | |
2005 | |
2006 (defun imap-parse-greeting () | |
2007 "Parse a IMAP greeting." | |
2008 (cond ((looking-at "\\* OK ") | |
2009 (setq imap-state 'nonauth)) | |
2010 ((looking-at "\\* PREAUTH ") | |
2011 (setq imap-state 'auth)) | |
2012 ((looking-at "\\* BYE ") | |
2013 (setq imap-state 'closed)))) | |
2014 | |
2015 ;; response = *(continue-req / response-data) response-done | |
2016 ;; | |
2017 ;; continue-req = "+" SP (resp-text / base64) CRLF | |
2018 ;; | |
2019 ;; response-data = "*" SP (resp-cond-state / resp-cond-bye / | |
2020 ;; mailbox-data / message-data / capability-data) CRLF | |
2021 ;; | |
2022 ;; response-done = response-tagged / response-fatal | |
2023 ;; | |
2024 ;; response-fatal = "*" SP resp-cond-bye CRLF | |
2025 ;; ; Server closes connection immediately | |
2026 ;; | |
2027 ;; response-tagged = tag SP resp-cond-state CRLF | |
2028 ;; | |
2029 ;; resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text | |
2030 ;; ; Status condition | |
2031 ;; | |
2032 ;; resp-cond-bye = "BYE" SP resp-text | |
2033 ;; | |
2034 ;; mailbox-data = "FLAGS" SP flag-list / | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2035 ;; "LIST" SP mailbox-list / |
31717 | 2036 ;; "LSUB" SP mailbox-list / |
2037 ;; "SEARCH" *(SP nz-number) / | |
2038 ;; "STATUS" SP mailbox SP "(" | |
2039 ;; [status-att SP number *(SP status-att SP number)] ")" / | |
2040 ;; number SP "EXISTS" / | |
2041 ;; number SP "RECENT" | |
2042 ;; | |
2043 ;; message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) | |
2044 ;; | |
2045 ;; capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1" | |
2046 ;; *(SP capability) | |
2047 ;; ; IMAP4rev1 servers which offer RFC 1730 | |
2048 ;; ; compatibility MUST list "IMAP4" as the first | |
2049 ;; ; capability. | |
2050 | |
2051 (defun imap-parse-response () | |
2052 "Parse a IMAP command response." | |
2053 (let (token) | |
2054 (case (setq token (read (current-buffer))) | |
2055 (+ (setq imap-continuation | |
2056 (or (buffer-substring (min (point-max) (1+ (point))) | |
2057 (point-max)) | |
2058 t))) | |
2059 (* (case (prog1 (setq token (read (current-buffer))) | |
2060 (imap-forward)) | |
2061 (OK (imap-parse-resp-text)) | |
2062 (NO (imap-parse-resp-text)) | |
2063 (BAD (imap-parse-resp-text)) | |
2064 (BYE (imap-parse-resp-text)) | |
2065 (FLAGS (imap-mailbox-put 'flags (imap-parse-flag-list))) | |
2066 (LIST (imap-parse-data-list 'list)) | |
2067 (LSUB (imap-parse-data-list 'lsub)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2068 (SEARCH (imap-mailbox-put |
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2069 'search |
31717 | 2070 (read (concat "(" (buffer-substring (point) (point-max)) ")")))) |
2071 (STATUS (imap-parse-status)) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2072 (CAPABILITY (setq imap-capability |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2073 (read (concat "(" (upcase (buffer-substring |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2074 (point) (point-max))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2075 ")")))) |
31717 | 2076 (ACL (imap-parse-acl)) |
2077 (t (case (prog1 (read (current-buffer)) | |
2078 (imap-forward)) | |
2079 (EXISTS (imap-mailbox-put 'exists token)) | |
2080 (RECENT (imap-mailbox-put 'recent token)) | |
2081 (EXPUNGE t) | |
2082 (FETCH (imap-parse-fetch token)) | |
2083 (t (message "Garbage: %s" (buffer-string))))))) | |
2084 (t (let (status) | |
2085 (if (not (integerp token)) | |
2086 (message "Garbage: %s" (buffer-string)) | |
2087 (case (prog1 (setq status (read (current-buffer))) | |
2088 (imap-forward)) | |
2089 (OK (progn | |
2090 (setq imap-reached-tag (max imap-reached-tag token)) | |
2091 (imap-parse-resp-text))) | |
2092 (NO (progn | |
2093 (setq imap-reached-tag (max imap-reached-tag token)) | |
2094 (save-excursion | |
2095 (imap-parse-resp-text)) | |
2096 (let (code text) | |
2097 (when (eq (char-after) ?\[) | |
2098 (setq code (buffer-substring (point) | |
2099 (search-forward "]"))) | |
2100 (imap-forward)) | |
2101 (setq text (buffer-substring (point) (point-max))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2102 (push (list token status code text) |
31717 | 2103 imap-failed-tags)))) |
2104 (BAD (progn | |
2105 (setq imap-reached-tag (max imap-reached-tag token)) | |
2106 (save-excursion | |
2107 (imap-parse-resp-text)) | |
2108 (let (code text) | |
2109 (when (eq (char-after) ?\[) | |
2110 (setq code (buffer-substring (point) | |
2111 (search-forward "]"))) | |
2112 (imap-forward)) | |
2113 (setq text (buffer-substring (point) (point-max))) | |
2114 (push (list token status code text) imap-failed-tags) | |
2115 (error "Internal error, tag %s status %s code %s text %s" | |
2116 token status code text)))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2117 (t (message "Garbage: %s" (buffer-string)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2118 (when (assq token imap-callbacks) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2119 (funcall (cdr (assq token imap-callbacks)) token status) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2120 (setq imap-callbacks |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2121 (imap-remassoc token imap-callbacks))))))))) |
31717 | 2122 |
2123 ;; resp-text = ["[" resp-text-code "]" SP] text | |
2124 ;; | |
2125 ;; text = 1*TEXT-CHAR | |
2126 ;; | |
2127 ;; TEXT-CHAR = <any CHAR except CR and LF> | |
2128 | |
2129 (defun imap-parse-resp-text () | |
2130 (imap-parse-resp-text-code)) | |
2131 | |
2132 ;; resp-text-code = "ALERT" / | |
2133 ;; "BADCHARSET [SP "(" astring *(SP astring) ")" ] / | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2134 ;; "NEWNAME" SP string SP string / |
31717 | 2135 ;; "PARSE" / |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2136 ;; "PERMANENTFLAGS" SP "(" |
31717 | 2137 ;; [flag-perm *(SP flag-perm)] ")" / |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2138 ;; "READ-ONLY" / |
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2139 ;; "READ-WRITE" / |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2140 ;; "TRYCREATE" / |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2141 ;; "UIDNEXT" SP nz-number / |
31717 | 2142 ;; "UIDVALIDITY" SP nz-number / |
2143 ;; "UNSEEN" SP nz-number / | |
2144 ;; resp-text-atom [SP 1*<any TEXT-CHAR except "]">] | |
2145 ;; | |
2146 ;; resp_code_apnd = "APPENDUID" SPACE nz_number SPACE uniqueid | |
2147 ;; | |
2148 ;; resp_code_copy = "COPYUID" SPACE nz_number SPACE set SPACE set | |
2149 ;; | |
2150 ;; set = sequence-num / (sequence-num ":" sequence-num) / | |
2151 ;; (set "," set) | |
2152 ;; ; Identifies a set of messages. For message | |
2153 ;; ; sequence numbers, these are consecutive | |
2154 ;; ; numbers from 1 to the number of messages in | |
2155 ;; ; the mailbox | |
2156 ;; ; Comma delimits individual numbers, colon | |
2157 ;; ; delimits between two numbers inclusive. | |
2158 ;; ; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13, | |
2159 ;; ; 14,15 for a mailbox with 15 messages. | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2160 ;; |
31717 | 2161 ;; sequence-num = nz-number / "*" |
2162 ;; ; * is the largest number in use. For message | |
2163 ;; ; sequence numbers, it is the number of messages | |
2164 ;; ; in the mailbox. For unique identifiers, it is | |
2165 ;; ; the unique identifier of the last message in | |
2166 ;; ; the mailbox. | |
2167 ;; | |
2168 ;; flag-perm = flag / "\*" | |
2169 ;; | |
2170 ;; flag = "\Answered" / "\Flagged" / "\Deleted" / | |
2171 ;; "\Seen" / "\Draft" / flag-keyword / flag-extension | |
2172 ;; ; Does not include "\Recent" | |
2173 ;; | |
2174 ;; flag-extension = "\" atom | |
2175 ;; ; Future expansion. Client implementations | |
2176 ;; ; MUST accept flag-extension flags. Server | |
2177 ;; ; implementations MUST NOT generate | |
2178 ;; ; flag-extension flags except as defined by | |
2179 ;; ; future standard or standards-track | |
2180 ;; ; revisions of this specification. | |
2181 ;; | |
2182 ;; flag-keyword = atom | |
2183 ;; | |
2184 ;; resp-text-atom = 1*<any ATOM-CHAR except "]"> | |
2185 | |
2186 (defun imap-parse-resp-text-code () | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2187 ;; xxx next line for stalker communigate pro 3.3.1 bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2188 (when (looking-at " \\[") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2189 (imap-forward)) |
31717 | 2190 (when (eq (char-after) ?\[) |
2191 (imap-forward) | |
2192 (cond ((search-forward "PERMANENTFLAGS " nil t) | |
2193 (imap-mailbox-put 'permanentflags (imap-parse-flag-list))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2194 ((search-forward "UIDNEXT \\([0-9]+\\)" nil t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2195 (imap-mailbox-put 'uidnext (match-string 1))) |
31717 | 2196 ((search-forward "UNSEEN " nil t) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2197 (imap-mailbox-put 'first-unseen (read (current-buffer)))) |
31717 | 2198 ((looking-at "UIDVALIDITY \\([0-9]+\\)") |
2199 (imap-mailbox-put 'uidvalidity (match-string 1))) | |
2200 ((search-forward "READ-ONLY" nil t) | |
2201 (imap-mailbox-put 'read-only t)) | |
2202 ((search-forward "NEWNAME " nil t) | |
2203 (let (oldname newname) | |
2204 (setq oldname (imap-parse-string)) | |
2205 (imap-forward) | |
2206 (setq newname (imap-parse-string)) | |
2207 (imap-mailbox-put 'newname newname oldname))) | |
2208 ((search-forward "TRYCREATE" nil t) | |
2209 (imap-mailbox-put 'trycreate t imap-current-target-mailbox)) | |
2210 ((looking-at "APPENDUID \\([0-9]+\\) \\([0-9]+\\)") | |
2211 (imap-mailbox-put 'appenduid | |
2212 (list (match-string 1) | |
2213 (string-to-number (match-string 2))) | |
2214 imap-current-target-mailbox)) | |
2215 ((looking-at "COPYUID \\([0-9]+\\) \\([0-9,:]+\\) \\([0-9,:]+\\)") | |
2216 (imap-mailbox-put 'copyuid (list (match-string 1) | |
2217 (match-string 2) | |
2218 (match-string 3)) | |
2219 imap-current-target-mailbox)) | |
2220 ((search-forward "ALERT] " nil t) | |
2221 (message "Imap server %s information: %s" imap-server | |
2222 (buffer-substring (point) (point-max))))))) | |
2223 | |
2224 ;; mailbox-list = "(" [mbx-list-flags] ")" SP | |
2225 ;; (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox | |
2226 ;; | |
2227 ;; mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag | |
2228 ;; *(SP mbx-list-oflag) / | |
2229 ;; mbx-list-oflag *(SP mbx-list-oflag) | |
2230 ;; | |
2231 ;; mbx-list-oflag = "\Noinferiors" / flag-extension | |
2232 ;; ; Other flags; multiple possible per LIST response | |
2233 ;; | |
2234 ;; mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked" | |
2235 ;; ; Selectability flags; only one per LIST response | |
2236 ;; | |
2237 ;; QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> / | |
2238 ;; "\" quoted-specials | |
2239 ;; | |
2240 ;; quoted-specials = DQUOTE / "\" | |
2241 | |
2242 (defun imap-parse-data-list (type) | |
2243 (let (flags delimiter mailbox) | |
2244 (setq flags (imap-parse-flag-list)) | |
2245 (when (looking-at " NIL\\| \"\\\\?\\(.\\)\"") | |
2246 (setq delimiter (match-string 1)) | |
2247 (goto-char (1+ (match-end 0))) | |
2248 (when (setq mailbox (imap-parse-mailbox)) | |
2249 (imap-mailbox-put type t mailbox) | |
2250 (imap-mailbox-put 'list-flags flags mailbox) | |
2251 (imap-mailbox-put 'delimiter delimiter mailbox))))) | |
2252 | |
2253 ;; msg_att ::= "(" 1#("ENVELOPE" SPACE envelope / | |
2254 ;; "FLAGS" SPACE "(" #(flag / "\Recent") ")" / | |
2255 ;; "INTERNALDATE" SPACE date_time / | |
2256 ;; "RFC822" [".HEADER" / ".TEXT"] SPACE nstring / | |
2257 ;; "RFC822.SIZE" SPACE number / | |
2258 ;; "BODY" ["STRUCTURE"] SPACE body / | |
2259 ;; "BODY" section ["<" number ">"] SPACE nstring / | |
2260 ;; "UID" SPACE uniqueid) ")" | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2261 ;; |
31717 | 2262 ;; date_time ::= <"> date_day_fixed "-" date_month "-" date_year |
2263 ;; SPACE time SPACE zone <"> | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2264 ;; |
31717 | 2265 ;; section ::= "[" [section_text / (nz_number *["." nz_number] |
2266 ;; ["." (section_text / "MIME")])] "]" | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2267 ;; |
31717 | 2268 ;; section_text ::= "HEADER" / "HEADER.FIELDS" [".NOT"] |
2269 ;; SPACE header_list / "TEXT" | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2270 ;; |
31717 | 2271 ;; header_fld_name ::= astring |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2272 ;; |
31717 | 2273 ;; header_list ::= "(" 1#header_fld_name ")" |
2274 | |
2275 (defsubst imap-parse-header-list () | |
2276 (when (eq (char-after) ?\() | |
2277 (let (strlist) | |
2278 (while (not (eq (char-after) ?\))) | |
2279 (imap-forward) | |
2280 (push (imap-parse-astring) strlist)) | |
2281 (imap-forward) | |
2282 (nreverse strlist)))) | |
2283 | |
2284 (defsubst imap-parse-fetch-body-section () | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2285 (let ((section |
31717 | 2286 (buffer-substring (point) (1- (re-search-forward "[] ]" nil t))))) |
2287 (if (eq (char-before) ? ) | |
2288 (prog1 | |
2289 (mapconcat 'identity (cons section (imap-parse-header-list)) " ") | |
2290 (search-forward "]" nil t)) | |
2291 section))) | |
2292 | |
2293 (defun imap-parse-fetch (response) | |
2294 (when (eq (char-after) ?\() | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2295 (let (uid flags envelope internaldate rfc822 rfc822header rfc822text |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2296 rfc822size body bodydetail bodystructure flags-empty) |
31717 | 2297 (while (not (eq (char-after) ?\))) |
2298 (imap-forward) | |
2299 (let ((token (read (current-buffer)))) | |
2300 (imap-forward) | |
2301 (cond ((eq token 'UID) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2302 (setq uid (condition-case () |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2303 (read (current-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2304 (error)))) |
31717 | 2305 ((eq token 'FLAGS) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2306 (setq flags (imap-parse-flag-list)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2307 (if (not flags) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2308 (setq flags-empty 't))) |
31717 | 2309 ((eq token 'ENVELOPE) |
2310 (setq envelope (imap-parse-envelope))) | |
2311 ((eq token 'INTERNALDATE) | |
2312 (setq internaldate (imap-parse-string))) | |
2313 ((eq token 'RFC822) | |
2314 (setq rfc822 (imap-parse-nstring))) | |
2315 ((eq token 'RFC822.HEADER) | |
2316 (setq rfc822header (imap-parse-nstring))) | |
2317 ((eq token 'RFC822.TEXT) | |
2318 (setq rfc822text (imap-parse-nstring))) | |
2319 ((eq token 'RFC822.SIZE) | |
2320 (setq rfc822size (read (current-buffer)))) | |
2321 ((eq token 'BODY) | |
2322 (if (eq (char-before) ?\[) | |
2323 (push (list | |
2324 (upcase (imap-parse-fetch-body-section)) | |
2325 (and (eq (char-after) ?<) | |
2326 (buffer-substring (1+ (point)) | |
2327 (search-forward ">" nil t))) | |
2328 (progn (imap-forward) | |
2329 (imap-parse-nstring))) | |
2330 bodydetail) | |
2331 (setq body (imap-parse-body)))) | |
2332 ((eq token 'BODYSTRUCTURE) | |
2333 (setq bodystructure (imap-parse-body)))))) | |
2334 (when uid | |
2335 (setq imap-current-message uid) | |
2336 (imap-message-put uid 'UID uid) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2337 (and (or flags flags-empty) (imap-message-put uid 'FLAGS flags)) |
31717 | 2338 (and envelope (imap-message-put uid 'ENVELOPE envelope)) |
2339 (and internaldate (imap-message-put uid 'INTERNALDATE internaldate)) | |
2340 (and rfc822 (imap-message-put uid 'RFC822 rfc822)) | |
2341 (and rfc822header (imap-message-put uid 'RFC822.HEADER rfc822header)) | |
2342 (and rfc822text (imap-message-put uid 'RFC822.TEXT rfc822text)) | |
2343 (and rfc822size (imap-message-put uid 'RFC822.SIZE rfc822size)) | |
2344 (and body (imap-message-put uid 'BODY body)) | |
2345 (and bodydetail (imap-message-put uid 'BODYDETAIL bodydetail)) | |
2346 (and bodystructure (imap-message-put uid 'BODYSTRUCTURE bodystructure)) | |
2347 (run-hooks 'imap-fetch-data-hook))))) | |
2348 | |
2349 ;; mailbox-data = ... | |
2350 ;; "STATUS" SP mailbox SP "(" | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2351 ;; [status-att SP number |
31717 | 2352 ;; *(SP status-att SP number)] ")" |
2353 ;; ... | |
2354 ;; | |
2355 ;; status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" / | |
2356 ;; "UNSEEN" | |
2357 | |
2358 (defun imap-parse-status () | |
2359 (let ((mailbox (imap-parse-mailbox))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2360 (if (eq (char-after) ? ) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2361 (forward-char)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2362 (when (and mailbox (eq (char-after) ?\()) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2363 (while (and (not (eq (char-after) ?\))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2364 (or (forward-char) t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2365 (looking-at "\\([A-Za-z]+\\) ")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2366 (let ((token (match-string 1))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2367 (goto-char (match-end 0)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2368 (cond ((string= token "MESSAGES") |
31717 | 2369 (imap-mailbox-put 'messages (read (current-buffer)) mailbox)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2370 ((string= token "RECENT") |
31717 | 2371 (imap-mailbox-put 'recent (read (current-buffer)) mailbox)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2372 ((string= token "UIDNEXT") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2373 (and (looking-at "[0-9]+") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2374 (imap-mailbox-put 'uidnext (match-string 0) mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2375 (goto-char (match-end 0)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2376 ((string= token "UIDVALIDITY") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2377 (and (looking-at "[0-9]+") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2378 (imap-mailbox-put 'uidvalidity (match-string 0) mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2379 (goto-char (match-end 0)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2380 ((string= token "UNSEEN") |
31717 | 2381 (imap-mailbox-put 'unseen (read (current-buffer)) mailbox)) |
2382 (t | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2383 (message "Unknown status data %s in mailbox %s ignored" |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2384 token mailbox) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2385 (read (current-buffer))))))))) |
31717 | 2386 |
2387 ;; acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE | |
2388 ;; rights) | |
2389 ;; | |
2390 ;; identifier ::= astring | |
2391 ;; | |
2392 ;; rights ::= astring | |
2393 | |
2394 (defun imap-parse-acl () | |
2395 (let ((mailbox (imap-parse-mailbox)) | |
2396 identifier rights acl) | |
2397 (while (eq (char-after) ?\ ) | |
2398 (imap-forward) | |
2399 (setq identifier (imap-parse-astring)) | |
2400 (imap-forward) | |
2401 (setq rights (imap-parse-astring)) | |
2402 (setq acl (append acl (list (cons identifier rights))))) | |
2403 (imap-mailbox-put 'acl acl mailbox))) | |
2404 | |
2405 ;; flag-list = "(" [flag *(SP flag)] ")" | |
2406 ;; | |
2407 ;; flag = "\Answered" / "\Flagged" / "\Deleted" / | |
2408 ;; "\Seen" / "\Draft" / flag-keyword / flag-extension | |
2409 ;; ; Does not include "\Recent" | |
2410 ;; | |
2411 ;; flag-keyword = atom | |
2412 ;; | |
2413 ;; flag-extension = "\" atom | |
2414 ;; ; Future expansion. Client implementations | |
2415 ;; ; MUST accept flag-extension flags. Server | |
2416 ;; ; implementations MUST NOT generate | |
2417 ;; ; flag-extension flags except as defined by | |
2418 ;; ; future standard or standards-track | |
2419 ;; ; revisions of this specification. | |
2420 | |
2421 (defun imap-parse-flag-list () | |
2422 (let (flag-list start) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2423 (assert (eq (char-after) ?\() t "In imap-parse-flag-list") |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2424 (while (and (not (eq (char-after) ?\))) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2425 (setq start (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2426 (imap-forward) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2427 ;; next line for Courier IMAP bug. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2428 (skip-chars-forward " ") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2429 (point))) |
33299
be95f43e08db
(imap-point-at-eol): New, replacing gnus-point-at-eol.
Dave Love <fx@gnu.org>
parents:
32995
diff
changeset
|
2430 (> (skip-chars-forward "^ )" (imap-point-at-eol)) 0)) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2431 (push (buffer-substring start (point)) flag-list)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2432 (assert (eq (char-after) ?\)) t "In imap-parse-flag-list") |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2433 (imap-forward) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2434 (nreverse flag-list))) |
31717 | 2435 |
2436 ;; envelope = "(" env-date SP env-subject SP env-from SP env-sender SP | |
2437 ;; env-reply-to SP env-to SP env-cc SP env-bcc SP | |
2438 ;; env-in-reply-to SP env-message-id ")" | |
2439 ;; | |
2440 ;; env-bcc = "(" 1*address ")" / nil | |
2441 ;; | |
2442 ;; env-cc = "(" 1*address ")" / nil | |
2443 ;; | |
2444 ;; env-date = nstring | |
2445 ;; | |
2446 ;; env-from = "(" 1*address ")" / nil | |
2447 ;; | |
2448 ;; env-in-reply-to = nstring | |
2449 ;; | |
2450 ;; env-message-id = nstring | |
2451 ;; | |
2452 ;; env-reply-to = "(" 1*address ")" / nil | |
2453 ;; | |
2454 ;; env-sender = "(" 1*address ")" / nil | |
2455 ;; | |
2456 ;; env-subject = nstring | |
2457 ;; | |
2458 ;; env-to = "(" 1*address ")" / nil | |
2459 | |
2460 (defun imap-parse-envelope () | |
2461 (when (eq (char-after) ?\() | |
2462 (imap-forward) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2463 (vector (prog1 (imap-parse-nstring) ;; date |
31717 | 2464 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2465 (prog1 (imap-parse-nstring) ;; subject |
31717 | 2466 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2467 (prog1 (imap-parse-address-list) ;; from |
31717 | 2468 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2469 (prog1 (imap-parse-address-list) ;; sender |
31717 | 2470 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2471 (prog1 (imap-parse-address-list) ;; reply-to |
31717 | 2472 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2473 (prog1 (imap-parse-address-list) ;; to |
31717 | 2474 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2475 (prog1 (imap-parse-address-list) ;; cc |
31717 | 2476 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2477 (prog1 (imap-parse-address-list) ;; bcc |
31717 | 2478 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2479 (prog1 (imap-parse-nstring) ;; in-reply-to |
31717 | 2480 (imap-forward)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2481 (prog1 (imap-parse-nstring) ;; message-id |
31717 | 2482 (imap-forward))))) |
2483 | |
2484 ;; body-fld-param = "(" string SP string *(SP string SP string) ")" / nil | |
2485 | |
2486 (defsubst imap-parse-string-list () | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2487 (cond ((eq (char-after) ?\() ;; body-fld-param |
31717 | 2488 (let (strlist str) |
2489 (imap-forward) | |
2490 (while (setq str (imap-parse-string)) | |
2491 (push str strlist) | |
2492 ;; buggy stalker communigate pro 3.0 doesn't print SPC | |
2493 ;; between body-fld-param's sometimes | |
2494 (or (eq (char-after) ?\") | |
2495 (imap-forward))) | |
2496 (nreverse strlist))) | |
2497 ((imap-parse-nil) | |
2498 nil))) | |
2499 | |
2500 ;; body-extension = nstring / number / | |
2501 ;; "(" body-extension *(SP body-extension) ")" | |
2502 ;; ; Future expansion. Client implementations | |
2503 ;; ; MUST accept body-extension fields. Server | |
2504 ;; ; implementations MUST NOT generate | |
2505 ;; ; body-extension fields except as defined by | |
2506 ;; ; future standard or standards-track | |
2507 ;; ; revisions of this specification. | |
2508 | |
2509 (defun imap-parse-body-extension () | |
2510 (if (eq (char-after) ?\() | |
2511 (let (b-e) | |
2512 (imap-forward) | |
2513 (push (imap-parse-body-extension) b-e) | |
2514 (while (eq (char-after) ?\ ) | |
2515 (imap-forward) | |
2516 (push (imap-parse-body-extension) b-e)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2517 (assert (eq (char-after) ?\)) t "In imap-parse-body-extension") |
31717 | 2518 (imap-forward) |
2519 (nreverse b-e)) | |
2520 (or (imap-parse-number) | |
2521 (imap-parse-nstring)))) | |
2522 | |
2523 ;; body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang | |
2524 ;; *(SP body-extension)]] | |
2525 ;; ; MUST NOT be returned on non-extensible | |
2526 ;; ; "BODY" fetch | |
2527 ;; | |
2528 ;; body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang | |
2529 ;; *(SP body-extension)]] | |
2530 ;; ; MUST NOT be returned on non-extensible | |
2531 ;; ; "BODY" fetch | |
2532 | |
2533 (defsubst imap-parse-body-ext () | |
2534 (let (ext) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2535 (when (eq (char-after) ?\ ) ;; body-fld-dsp |
31717 | 2536 (imap-forward) |
2537 (let (dsp) | |
2538 (if (eq (char-after) ?\() | |
2539 (progn | |
2540 (imap-forward) | |
2541 (push (imap-parse-string) dsp) | |
2542 (imap-forward) | |
2543 (push (imap-parse-string-list) dsp) | |
2544 (imap-forward)) | |
82966
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
2545 ;; With assert, the code might not be eval'd. |
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
2546 ;; (assert (imap-parse-nil) t "In imap-parse-body-ext") |
28d9e552d178
Merge some changes from Emacs/trunk:
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
2547 (imap-parse-nil)) |
31717 | 2548 (push (nreverse dsp) ext)) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2549 (when (eq (char-after) ?\ ) ;; body-fld-lang |
31717 | 2550 (imap-forward) |
2551 (if (eq (char-after) ?\() | |
2552 (push (imap-parse-string-list) ext) | |
2553 (push (imap-parse-nstring) ext)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2554 (while (eq (char-after) ?\ ) ;; body-extension |
31717 | 2555 (imap-forward) |
2556 (setq ext (append (imap-parse-body-extension) ext))))) | |
2557 ext)) | |
2558 | |
2559 ;; body = "(" body-type-1part / body-type-mpart ")" | |
2560 ;; | |
2561 ;; body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang | |
2562 ;; *(SP body-extension)]] | |
2563 ;; ; MUST NOT be returned on non-extensible | |
2564 ;; ; "BODY" fetch | |
2565 ;; | |
2566 ;; body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang | |
2567 ;; *(SP body-extension)]] | |
2568 ;; ; MUST NOT be returned on non-extensible | |
2569 ;; ; "BODY" fetch | |
2570 ;; | |
2571 ;; body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP | |
2572 ;; body-fld-enc SP body-fld-octets | |
2573 ;; | |
2574 ;; body-fld-desc = nstring | |
2575 ;; | |
2576 ;; body-fld-dsp = "(" string SP body-fld-param ")" / nil | |
2577 ;; | |
2578 ;; body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ | |
2579 ;; "QUOTED-PRINTABLE") DQUOTE) / string | |
2580 ;; | |
2581 ;; body-fld-id = nstring | |
2582 ;; | |
2583 ;; body-fld-lang = nstring / "(" string *(SP string) ")" | |
2584 ;; | |
2585 ;; body-fld-lines = number | |
2586 ;; | |
2587 ;; body-fld-md5 = nstring | |
2588 ;; | |
2589 ;; body-fld-octets = number | |
2590 ;; | |
2591 ;; body-fld-param = "(" string SP string *(SP string SP string) ")" / nil | |
2592 ;; | |
2593 ;; body-type-1part = (body-type-basic / body-type-msg / body-type-text) | |
2594 ;; [SP body-ext-1part] | |
2595 ;; | |
2596 ;; body-type-basic = media-basic SP body-fields | |
2597 ;; ; MESSAGE subtype MUST NOT be "RFC822" | |
2598 ;; | |
2599 ;; body-type-msg = media-message SP body-fields SP envelope | |
2600 ;; SP body SP body-fld-lines | |
2601 ;; | |
2602 ;; body-type-text = media-text SP body-fields SP body-fld-lines | |
2603 ;; | |
2604 ;; body-type-mpart = 1*body SP media-subtype | |
2605 ;; [SP body-ext-mpart] | |
2606 ;; | |
2607 ;; media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / | |
2608 ;; "MESSAGE" / "VIDEO") DQUOTE) / string) SP media-subtype | |
2609 ;; ; Defined in [MIME-IMT] | |
2610 ;; | |
2611 ;; media-message = DQUOTE "MESSAGE" DQUOTE SP DQUOTE "RFC822" DQUOTE | |
2612 ;; ; Defined in [MIME-IMT] | |
2613 ;; | |
2614 ;; media-subtype = string | |
2615 ;; ; Defined in [MIME-IMT] | |
2616 ;; | |
2617 ;; media-text = DQUOTE "TEXT" DQUOTE SP media-subtype | |
2618 ;; ; Defined in [MIME-IMT] | |
2619 | |
2620 (defun imap-parse-body () | |
2621 (let (body) | |
2622 (when (eq (char-after) ?\() | |
2623 (imap-forward) | |
2624 (if (eq (char-after) ?\() | |
2625 (let (subbody) | |
2626 (while (and (eq (char-after) ?\() | |
2627 (setq subbody (imap-parse-body))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2628 ;; buggy stalker communigate pro 3.0 insert a SPC between |
31717 | 2629 ;; parts in multiparts |
2630 (when (and (eq (char-after) ?\ ) | |
2631 (eq (char-after (1+ (point))) ?\()) | |
2632 (imap-forward)) | |
2633 (push subbody body)) | |
2634 (imap-forward) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2635 (push (imap-parse-string) body) ;; media-subtype |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2636 (when (eq (char-after) ?\ ) ;; body-ext-mpart: |
31717 | 2637 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2638 (if (eq (char-after) ?\() ;; body-fld-param |
31717 | 2639 (push (imap-parse-string-list) body) |
2640 (push (and (imap-parse-nil) nil) body)) | |
2641 (setq body | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2642 (append (imap-parse-body-ext) body))) ;; body-ext-... |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2643 (assert (eq (char-after) ?\)) t "In imap-parse-body") |
31717 | 2644 (imap-forward) |
2645 (nreverse body)) | |
2646 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2647 (push (imap-parse-string) body) ;; media-type |
31717 | 2648 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2649 (push (imap-parse-string) body) ;; media-subtype |
31717 | 2650 (imap-forward) |
2651 ;; next line for Sun SIMS bug | |
2652 (and (eq (char-after) ? ) (imap-forward)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2653 (if (eq (char-after) ?\() ;; body-fld-param |
31717 | 2654 (push (imap-parse-string-list) body) |
2655 (push (and (imap-parse-nil) nil) body)) | |
2656 (imap-forward) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2657 (push (imap-parse-nstring) body) ;; body-fld-id |
31717 | 2658 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2659 (push (imap-parse-nstring) body) ;; body-fld-desc |
31717 | 2660 (imap-forward) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2661 ;; next `or' for Sun SIMS bug, it regard body-fld-enc as a |
42205 | 2662 ;; nstring and return nil instead of defaulting back to 7BIT |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
2663 ;; as the standard says. |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2664 (push (or (imap-parse-nstring) "7BIT") body) ;; body-fld-enc |
31717 | 2665 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2666 (push (imap-parse-number) body) ;; body-fld-octets |
31717 | 2667 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2668 ;; ok, we're done parsing the required parts, what comes now is one |
31717 | 2669 ;; of three things: |
2670 ;; | |
2671 ;; envelope (then we're parsing body-type-msg) | |
2672 ;; body-fld-lines (then we're parsing body-type-text) | |
2673 ;; body-ext-1part (then we're parsing body-type-basic) | |
2674 ;; | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2675 ;; the problem is that the two first are in turn optionally followed |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2676 ;; by the third. So we parse the first two here (if there are any)... |
31717 | 2677 |
2678 (when (eq (char-after) ?\ ) | |
2679 (imap-forward) | |
2680 (let (lines) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2681 (cond ((eq (char-after) ?\() ;; body-type-msg: |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2682 (push (imap-parse-envelope) body) ;; envelope |
31717 | 2683 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2684 (push (imap-parse-body) body) ;; body |
31717 | 2685 ;; buggy stalker communigate pro 3.0 doesn't print |
2686 ;; number of lines in message/rfc822 attachment | |
2687 (if (eq (char-after) ?\)) | |
2688 (push 0 body) | |
2689 (imap-forward) | |
2690 (push (imap-parse-number) body))) ;; body-fld-lines | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2691 ((setq lines (imap-parse-number)) ;; body-type-text: |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2692 (push lines body)) ;; body-fld-lines |
31717 | 2693 (t |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2694 (backward-char))))) ;; no match... |
31717 | 2695 |
2696 ;; ...and then parse the third one here... | |
2697 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2698 (when (eq (char-after) ?\ ) ;; body-ext-1part: |
31717 | 2699 (imap-forward) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2700 (push (imap-parse-nstring) body) ;; body-fld-md5 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2701 (setq body (append (imap-parse-body-ext) body))) ;; body-ext-1part.. |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2702 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2703 (assert (eq (char-after) ?\)) t "In imap-parse-body 2") |
31717 | 2704 (imap-forward) |
2705 (nreverse body))))) | |
2706 | |
2707 (when imap-debug ; (untrace-all) | |
2708 (require 'trace) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2709 (buffer-disable-undo (get-buffer-create imap-debug-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
54490
diff
changeset
|
2710 (mapcar (lambda (f) (trace-function-background f imap-debug-buffer)) |
31717 | 2711 '( |
2712 imap-utf7-encode | |
2713 imap-utf7-decode | |
2714 imap-error-text | |
2715 imap-kerberos4s-p | |
2716 imap-kerberos4-open | |
2717 imap-ssl-p | |
2718 imap-ssl-open | |
2719 imap-network-p | |
2720 imap-network-open | |
2721 imap-interactive-login | |
2722 imap-kerberos4a-p | |
2723 imap-kerberos4-auth | |
2724 imap-cram-md5-p | |
2725 imap-cram-md5-auth | |
2726 imap-login-p | |
2727 imap-login-auth | |
2728 imap-anonymous-p | |
2729 imap-anonymous-auth | |
2730 imap-open-1 | |
2731 imap-open | |
2732 imap-opened | |
2733 imap-authenticate | |
2734 imap-close | |
2735 imap-capability | |
2736 imap-namespace | |
2737 imap-send-command-wait | |
2738 imap-mailbox-put | |
2739 imap-mailbox-get | |
2740 imap-mailbox-map-1 | |
2741 imap-mailbox-map | |
2742 imap-current-mailbox | |
2743 imap-current-mailbox-p-1 | |
2744 imap-current-mailbox-p | |
2745 imap-mailbox-select-1 | |
2746 imap-mailbox-select | |
2747 imap-mailbox-examine-1 | |
2748 imap-mailbox-examine | |
2749 imap-mailbox-unselect | |
2750 imap-mailbox-expunge | |
2751 imap-mailbox-close | |
2752 imap-mailbox-create-1 | |
2753 imap-mailbox-create | |
2754 imap-mailbox-delete | |
2755 imap-mailbox-rename | |
2756 imap-mailbox-lsub | |
2757 imap-mailbox-list | |
2758 imap-mailbox-subscribe | |
2759 imap-mailbox-unsubscribe | |
2760 imap-mailbox-status | |
2761 imap-mailbox-acl-get | |
2762 imap-mailbox-acl-set | |
2763 imap-mailbox-acl-delete | |
2764 imap-current-message | |
2765 imap-list-to-message-set | |
2766 imap-fetch-asynch | |
2767 imap-fetch | |
2768 imap-message-put | |
2769 imap-message-get | |
2770 imap-message-map | |
2771 imap-search | |
2772 imap-message-flag-permanent-p | |
2773 imap-message-flags-set | |
2774 imap-message-flags-del | |
2775 imap-message-flags-add | |
2776 imap-message-copyuid-1 | |
2777 imap-message-copyuid | |
2778 imap-message-copy | |
2779 imap-message-appenduid-1 | |
2780 imap-message-appenduid | |
2781 imap-message-append | |
2782 imap-body-lines | |
2783 imap-envelope-from | |
2784 imap-send-command-1 | |
2785 imap-send-command | |
2786 imap-wait-for-tag | |
2787 imap-sentinel | |
2788 imap-find-next-line | |
2789 imap-arrival-filter | |
2790 imap-parse-greeting | |
2791 imap-parse-response | |
2792 imap-parse-resp-text | |
2793 imap-parse-resp-text-code | |
2794 imap-parse-data-list | |
2795 imap-parse-fetch | |
2796 imap-parse-status | |
2797 imap-parse-acl | |
2798 imap-parse-flag-list | |
2799 imap-parse-envelope | |
2800 imap-parse-body-extension | |
2801 imap-parse-body | |
2802 ))) | |
39064
c545df001cd2
(imap-mailbox-examine, imap-mailbox-examine-1): Fix a typo: `exmine' --> `examine'.
Sam Steingold <sds@gnu.org>
parents:
33299
diff
changeset
|
2803 |
31717 | 2804 (provide 'imap) |
2805 | |
52401 | 2806 ;;; arch-tag: 27369ed6-33e4-482f-96f1-8bb906ba70f7 |
31717 | 2807 ;;; imap.el ends here |