Mercurial > emacs
annotate lisp/net/imap.el @ 111992:7e4ae0dd59c9
Ask for confirmation in ido-file-internal (Bug#1238).
* ido.el (ido-file-internal): Ask for confirmation before
overwriting an existing file (Bug#1238).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 17 Dec 2010 18:56:03 +0800 |
parents | 236342431786 |
children | 417b1e4d63cd |
rev | line source |
---|---|
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1 ;;; imap.el --- imap library |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
5 |
100993 | 6 ;; Author: Simon Josefsson <simon@josefsson.org> |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
7 ;; Keywords: mail |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
8 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
10 |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
15 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
20 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
23 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
25 |
100993 | 26 ;; imap.el is an elisp library providing an interface for talking to |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
27 ;; IMAP servers. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
28 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
29 ;; imap.el is roughly divided in two parts, one that parses IMAP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
30 ;; responses from the server and storing data into buffer-local |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
31 ;; variables, and one for utility functions which send commands to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
32 ;; server, waits for an answer, and return information. The latter |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
33 ;; part is layered on top of the previous. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
34 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
35 ;; The imap.el API consist of the following functions, other functions |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
36 ;; in this file should not be called directly and the result of doing |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
37 ;; so are at best undefined. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
38 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
39 ;; Global commands: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
40 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
41 ;; imap-open, imap-opened, imap-authenticate, imap-close, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
42 ;; imap-capability, imap-namespace, imap-error-text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
43 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
44 ;; Mailbox commands: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
45 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
46 ;; imap-mailbox-get, imap-mailbox-map, imap-current-mailbox, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
47 ;; imap-current-mailbox-p, imap-search, imap-mailbox-select, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
48 ;; imap-mailbox-examine, imap-mailbox-unselect, imap-mailbox-expunge |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
49 ;; imap-mailbox-close, imap-mailbox-create, imap-mailbox-delete |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
50 ;; imap-mailbox-rename, imap-mailbox-lsub, imap-mailbox-list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
51 ;; imap-mailbox-subscribe, imap-mailbox-unsubscribe, imap-mailbox-status |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
52 ;; imap-mailbox-acl-get, imap-mailbox-acl-set, imap-mailbox-acl-delete |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
53 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
54 ;; Message commands: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
55 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
56 ;; imap-fetch-asynch, imap-fetch, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
57 ;; imap-current-message, imap-list-to-message-set, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
58 ;; imap-message-get, imap-message-map |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
59 ;; imap-message-envelope-date, imap-message-envelope-subject, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
60 ;; imap-message-envelope-from, imap-message-envelope-sender, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
61 ;; imap-message-envelope-reply-to, imap-message-envelope-to, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
62 ;; imap-message-envelope-cc, imap-message-envelope-bcc |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
63 ;; imap-message-envelope-in-reply-to, imap-message-envelope-message-id |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
64 ;; imap-message-body, imap-message-flag-permanent-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
65 ;; imap-message-flags-set, imap-message-flags-del |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
66 ;; imap-message-flags-add, imap-message-copyuid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
67 ;; imap-message-copy, imap-message-appenduid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
68 ;; imap-message-append, imap-envelope-from |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
69 ;; imap-body-lines |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
70 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
71 ;; It is my hope that these commands should be pretty self |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
72 ;; explanatory for someone that know IMAP. All functions have |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
73 ;; additional documentation on how to invoke them. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
74 ;; |
100993 | 75 ;; imap.el supports RFC1730/2060/RFC3501 (IMAP4/IMAP4rev1). The implemented |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
76 ;; IMAP extensions are RFC2195 (CRAM-MD5), RFC2086 (ACL), RFC2342 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
77 ;; (NAMESPACE), RFC2359 (UIDPLUS), the IMAP-part of RFC2595 (STARTTLS, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
78 ;; LOGINDISABLED) (with use of external library starttls.el and |
100993 | 79 ;; program starttls), and the GSSAPI / Kerberos V4 sections of RFC1731 |
80 ;; (with use of external program `imtest'), and RFC2971 (ID). It also | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
81 ;; takes advantage of the UNSELECT extension in Cyrus IMAPD. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
82 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
83 ;; Without the work of John McClary Prevost and Jim Radford this library |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
84 ;; would not have seen the light of day. Many thanks. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
85 ;; |
100993 | 86 ;; This is a transcript of a short interactive session for demonstration |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
87 ;; purposes. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
88 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
89 ;; (imap-open "my.mail.server") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
90 ;; => " *imap* my.mail.server:0" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
91 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
92 ;; The rest are invoked with current buffer as the buffer returned by |
100993 | 93 ;; `imap-open'. It is possible to do it all without this, but it would |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
94 ;; look ugly here since `buffer' is always the last argument for all |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
95 ;; imap.el API functions. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
96 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
97 ;; (imap-authenticate "myusername" "mypassword") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
98 ;; => auth |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
99 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
100 ;; (imap-mailbox-lsub "*") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
101 ;; => ("INBOX.sentmail" "INBOX.private" "INBOX.draft" "INBOX.spam") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
102 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
103 ;; (imap-mailbox-list "INBOX.n%") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
104 ;; => ("INBOX.namedroppers" "INBOX.nnimap" "INBOX.ntbugtraq") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
105 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
106 ;; (imap-mailbox-select "INBOX.nnimap") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
107 ;; => "INBOX.nnimap" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
108 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
109 ;; (imap-mailbox-get 'exists) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
110 ;; => 166 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
111 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
112 ;; (imap-mailbox-get 'uidvalidity) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
113 ;; => "908992622" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
114 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
115 ;; (imap-search "FLAGGED SINCE 18-DEC-98") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
116 ;; => (235 236) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
117 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
118 ;; (imap-fetch 235 "RFC822.PEEK" 'RFC822) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
119 ;; => "X-Sieve: cmu-sieve 1.3^M\nX-Username: <jas@pdc.kth.se>^M\r...." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
120 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
121 ;; Todo: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
122 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
123 ;; o Parse UIDs as strings? We need to overcome the 28 bit limit somehow. |
100993 | 124 ;; Use IEEE floats (which are effectively exact)? -- fx |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
125 ;; o Don't use `read' at all (important places already fixed) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
126 ;; o Accept list of articles instead of message set string in most |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
127 ;; imap-message-* functions. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
128 ;; o Send strings as literal if they contain, e.g., ". |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
129 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
130 ;; Revision history: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
131 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
132 ;; - 19991218 added starttls/digest-md5 patch, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
133 ;; by Daiki Ueno <ueno@ueda.info.waseda.ac.jp> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
134 ;; NB! you need SLIM for starttls.el and digest-md5.el |
100993 | 135 ;; - 19991023 committed to pgnus |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
136 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
137 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
138 ;;; Code: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
139 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
140 (eval-when-compile (require 'cl)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
141 (eval-and-compile |
110918
236342431786
nnimap.el (gnutls-negotiate): Silence the byte compiler.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110369
diff
changeset
|
142 ;; For Emacs <22.2 and XEmacs. |
87186
b37f01064ecf
* mail/hashcash.el (declare-function):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87097
diff
changeset
|
143 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
144 (autoload 'starttls-open-stream "starttls") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
145 (autoload 'starttls-negotiate "starttls") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
146 (autoload 'sasl-find-mechanism "sasl") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
147 (autoload 'digest-md5-parse-digest-challenge "digest-md5") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
148 (autoload 'digest-md5-digest-response "digest-md5") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
149 (autoload 'digest-md5-digest-uri "digest-md5") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
150 (autoload 'digest-md5-challenge "digest-md5") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
151 (autoload 'rfc2104-hash "rfc2104") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
152 (autoload 'utf7-encode "utf7") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
153 (autoload 'utf7-decode "utf7") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
154 (autoload 'format-spec "format-spec") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
155 (autoload 'format-spec-make "format-spec") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
156 (autoload 'open-tls-stream "tls")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
157 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
158 ;; User variables. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
159 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
160 (defgroup imap nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
161 "Low-level IMAP issues." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
162 :version "21.1" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
163 :group 'mail) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
164 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
165 (defcustom imap-kerberos4-program '("imtest -m kerberos_v4 -u %l -p %p %s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
166 "imtest -kp %s %p") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
167 "List of strings containing commands for Kerberos 4 authentication. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
168 %s is replaced with server hostname, %p with port to connect to, and |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
169 %l with the value of `imap-default-user'. The program should accept |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
170 IMAP commands on stdin and return responses to stdout. Each entry in |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
171 the list is tried until a successful connection is made." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
172 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
173 :type '(repeat string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
174 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
175 (defcustom imap-gssapi-program (list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
176 (concat "gsasl %s %p " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
177 "--mechanism GSSAPI " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
178 "--authentication-id %l") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
179 "imtest -m gssapi -u %l -p %p %s") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
180 "List of strings containing commands for GSSAPI (krb5) authentication. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
181 %s is replaced with server hostname, %p with port to connect to, and |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
182 %l with the value of `imap-default-user'. The program should accept |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
183 IMAP commands on stdin and return responses to stdout. Each entry in |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
184 the list is tried until a successful connection is made." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
185 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
186 :type '(repeat string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
187 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
188 (defcustom imap-ssl-program '("openssl s_client -quiet -ssl3 -connect %s:%p" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
189 "openssl s_client -quiet -ssl2 -connect %s:%p" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
190 "s_client -quiet -ssl3 -connect %s:%p" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
191 "s_client -quiet -ssl2 -connect %s:%p") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
192 "A string, or list of strings, containing commands for SSL connections. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
193 Within a string, %s is replaced with the server address and %p with |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
194 port number on server. The program should accept IMAP commands on |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
195 stdin and return responses to stdout. Each entry in the list is tried |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
196 until a successful connection is made." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
197 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
198 :type '(choice string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
199 (repeat string))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
200 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
201 (defcustom imap-shell-program '("ssh %s imapd" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
202 "rsh %s imapd" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
203 "ssh %g ssh %s imapd" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
204 "rsh %g rsh %s imapd") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
205 "A list of strings, containing commands for IMAP connection. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
206 Within a string, %s is replaced with the server address, %p with port |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
207 number on server, %g with `imap-shell-host', and %l with |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
208 `imap-default-user'. The program should read IMAP commands from stdin |
100993 | 209 and write IMAP response to stdout. Each entry in the list is tried |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
210 until a successful connection is made." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
211 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
212 :type '(repeat string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
213 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
214 (defcustom imap-process-connection-type nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
215 "*Value for `process-connection-type' to use for Kerberos4, GSSAPI and SSL. |
100993 | 216 The `process-connection-type' variable controls the type of device |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
217 used to communicate with subprocesses. Values are nil to use a |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
218 pipe, or t or `pty' to use a pty. The value has no effect if the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
219 system has no ptys or if all ptys are busy: then a pipe is used |
100993 | 220 in any case. The value takes effect when an IMAP server is |
221 opened; changing it after that has no effect." | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
222 :version "22.1" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
223 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
224 :type 'boolean) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
225 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
226 (defcustom imap-use-utf7 t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
227 "If non-nil, do utf7 encoding/decoding of mailbox names. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
228 Since the UTF7 decoding currently only decodes into ISO-8859-1 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
229 characters, you may disable this decoding if you need to access UTF7 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
230 encoded mailboxes which doesn't translate into ISO-8859-1." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
231 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
232 :type 'boolean) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
233 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
234 (defcustom imap-log nil |
100993 | 235 "If non-nil, an imap session trace is placed in `imap-log-buffer'. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
236 Note that username, passwords and other privacy sensitive |
100993 | 237 information (such as e-mail) may be stored in the buffer. |
238 It is not written to disk, however. Do not enable this | |
239 variable unless you are comfortable with that. | |
240 | |
241 See also `imap-debug'." | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
242 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
243 :type 'boolean) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
244 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
245 (defcustom imap-debug nil |
100993 | 246 "If non-nil, trace imap- functions into `imap-debug-buffer'. |
247 Uses `trace-function-background', so you can turn it off with, | |
248 say, `untrace-all'. | |
249 | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
250 Note that username, passwords and other privacy sensitive |
100993 | 251 information (such as e-mail) may be stored in the buffer. |
252 It is not written to disk, however. Do not enable this | |
253 variable unless you are comfortable with that. | |
254 | |
255 This variable only takes effect when loading the `imap' library. | |
256 See also `imap-log'." | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
257 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
258 :type 'boolean) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
259 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
260 (defcustom imap-shell-host "gateway" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
261 "Hostname of rlogin proxy." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
262 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
263 :type 'string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
264 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
265 (defcustom imap-default-user (user-login-name) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
266 "Default username to use." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
267 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
268 :type 'string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
269 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
270 (defcustom imap-read-timeout (if (string-match |
110039
459fd421257a
gnus-group-completing-read: Add 'substring to completion-styles for group selection; imap.el, mailcap.el, message.el, mm-util.el, nnheader.el, nnmail.el, pop3.el: Remove references to outdated systems; References to win32 w32 mswindows ms-windows emx were probably cargo-culted, and are removed for clarity; By Lars Magne Ingebrigtsen <larsi@gnus.org>.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108765
diff
changeset
|
271 "windows-nt\\|os/2\\|cygwin" |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
272 (symbol-name system-type)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
273 1.0 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
274 0.1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
275 "*How long to wait between checking for the end of output. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
276 Shorter values mean quicker response, but is more CPU intensive." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
277 :type 'number |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
278 :group 'imap) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
279 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
280 (defcustom imap-store-password nil |
100993 | 281 "If non-nil, store session password without prompting." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
282 :group 'imap |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
283 :type 'boolean) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
284 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
285 ;; Various variables. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
286 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
287 (defvar imap-fetch-data-hook nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
288 "Hooks called after receiving each FETCH response.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
289 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
290 (defvar imap-streams '(gssapi kerberos4 starttls tls ssl network shell) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
291 "Priority of streams to consider when opening connection to server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
292 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
293 (defvar imap-stream-alist |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
294 '((gssapi imap-gssapi-stream-p imap-gssapi-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
295 (kerberos4 imap-kerberos4-stream-p imap-kerberos4-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
296 (tls imap-tls-p imap-tls-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
297 (ssl imap-ssl-p imap-ssl-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
298 (network imap-network-p imap-network-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
299 (shell imap-shell-p imap-shell-open) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
300 (starttls imap-starttls-p imap-starttls-open)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
301 "Definition of network streams. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
302 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
303 \(NAME CHECK OPEN) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
304 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
305 NAME names the stream, CHECK is a function returning non-nil if the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
306 server support the stream and OPEN is a function for opening the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
307 stream.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
308 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
309 (defvar imap-authenticators '(gssapi |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
310 kerberos4 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
311 digest-md5 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
312 cram-md5 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
313 ;;sasl |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
314 login |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
315 anonymous) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
316 "Priority of authenticators to consider when authenticating to server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
317 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
318 (defvar imap-authenticator-alist |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
319 '((gssapi imap-gssapi-auth-p imap-gssapi-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
320 (kerberos4 imap-kerberos4-auth-p imap-kerberos4-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
321 (sasl imap-sasl-auth-p imap-sasl-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
322 (cram-md5 imap-cram-md5-p imap-cram-md5-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
323 (login imap-login-p imap-login-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
324 (anonymous imap-anonymous-p imap-anonymous-auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
325 (digest-md5 imap-digest-md5-p imap-digest-md5-auth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
326 "Definition of authenticators. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
327 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
328 \(NAME CHECK AUTHENTICATE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
329 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
330 NAME names the authenticator. CHECK is a function returning non-nil if |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
331 the server support the authenticator and AUTHENTICATE is a function |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
332 for doing the actual authentication.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
333 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
334 (defvar imap-error nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
335 "Error codes from the last command.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
336 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
337 (defvar imap-logout-timeout nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
338 "Close server immediately if it can't logout in this number of seconds. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
339 If it is nil, never close server until logout completes. Normally, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
340 the value of this variable will be bound to a certain value to which |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
341 an application program that uses this module specifies on a per-server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
342 basis.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
343 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
344 ;; Internal constants. Change these and die. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
345 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
346 (defconst imap-default-port 143) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
347 (defconst imap-default-ssl-port 993) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
348 (defconst imap-default-tls-port 993) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
349 (defconst imap-default-stream 'network) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
350 (defconst imap-coding-system-for-read 'binary) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
351 (defconst imap-coding-system-for-write 'binary) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
352 (defconst imap-local-variables '(imap-server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
353 imap-port |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
354 imap-client-eol |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
355 imap-server-eol |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
356 imap-auth |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
357 imap-stream |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
358 imap-username |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
359 imap-password |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
360 imap-current-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
361 imap-current-target-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
362 imap-message-data |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
363 imap-capability |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
364 imap-id |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
365 imap-namespace |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
366 imap-state |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
367 imap-reached-tag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
368 imap-failed-tags |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
369 imap-tag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
370 imap-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
371 imap-calculate-literal-size-first |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
372 imap-mailbox-data)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
373 (defconst imap-log-buffer "*imap-log*") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
374 (defconst imap-debug-buffer "*imap-debug*") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
375 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
376 ;; Internal variables. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
377 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
378 (defvar imap-stream nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
379 (defvar imap-auth nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
380 (defvar imap-server nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
381 (defvar imap-port nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
382 (defvar imap-username nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
383 (defvar imap-password nil) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
384 (defvar imap-last-authenticator nil) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
385 (defvar imap-calculate-literal-size-first nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
386 (defvar imap-state 'closed |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
387 "IMAP state. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
388 Valid states are `closed', `initial', `nonauth', `auth', `selected' |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
389 and `examine'.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
390 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
391 (defvar imap-server-eol "\r\n" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
392 "The EOL string sent from the server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
393 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
394 (defvar imap-client-eol "\r\n" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
395 "The EOL string we send to the server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
396 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
397 (defvar imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
398 "Current mailbox name.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
399 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
400 (defvar imap-current-target-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
401 "Current target mailbox for COPY and APPEND commands.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
402 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
403 (defvar imap-mailbox-data nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
404 "Obarray with mailbox data.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
405 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
406 (defvar imap-mailbox-prime 997 |
100993 | 407 "Length of `imap-mailbox-data'.") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
408 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
409 (defvar imap-current-message nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
410 "Current message number.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
411 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
412 (defvar imap-message-data nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
413 "Obarray with message data.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
414 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
415 (defvar imap-message-prime 997 |
100993 | 416 "Length of `imap-message-data'.") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
417 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
418 (defvar imap-capability nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
419 "Capability for server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
420 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
421 (defvar imap-id nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
422 "Identity of server. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
423 See RFC 2971.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
424 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
425 (defvar imap-namespace nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
426 "Namespace for current server.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
427 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
428 (defvar imap-reached-tag 0 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
429 "Lower limit on command tags that have been parsed.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
430 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
431 (defvar imap-failed-tags nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
432 "Alist of tags that failed. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
433 Each element is a list with four elements; tag (a integer), response |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
434 state (a symbol, `OK', `NO' or `BAD'), response code (a string), and |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
435 human readable response text (a string).") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
436 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
437 (defvar imap-tag 0 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
438 "Command tag number.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
439 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
440 (defvar imap-process nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
441 "Process.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
442 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
443 (defvar imap-continuation nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
444 "Non-nil indicates that the server emitted a continuation request. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
445 The actual value is really the text on the continuation line.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
446 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
447 (defvar imap-callbacks nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
448 "List of response tags and callbacks, on the form `(number . function)'. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
449 The function should take two arguments, the first the IMAP tag and the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
450 second the status (OK, NO, BAD etc) of the command.") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
451 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
452 (defvar imap-enable-exchange-bug-workaround nil |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
453 "Send FETCH UID commands as *:* instead of *. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
454 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
455 When non-nil, use an alternative UIDS form. Enabling appears to |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
456 be required for some servers (e.g., Microsoft Exchange 2007) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
457 which otherwise would trigger a response 'BAD The specified |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
458 message set is invalid.'. We don't unconditionally use this |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
459 form, since this is said to be significantly inefficient. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
460 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
461 This variable is set to t automatically per server if the |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
462 canonical form fails.") |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
463 |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
464 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
465 ;; Utility functions: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
466 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
467 (defun imap-remassoc (key alist) |
100993 | 468 "Delete by side effect any elements of ALIST whose car is `equal' to KEY. |
469 The modified ALIST is returned. If the first member | |
470 of ALIST has a car that is `equal' to KEY, there is no way to remove it | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
471 by side effect; therefore, write `(setq foo (remassoc key foo))' to be |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
472 sure of changing the value of `foo'." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
473 (when alist |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
474 (if (equal key (caar alist)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
475 (cdr alist) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
476 (setcdr alist (imap-remassoc key (cdr alist))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
477 alist))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
478 |
108287
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
106815
diff
changeset
|
479 (defmacro imap-disable-multibyte () |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
480 "Enable multibyte in the current buffer." |
108287
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
106815
diff
changeset
|
481 (unless (featurep 'xemacs) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
106815
diff
changeset
|
482 '(set-buffer-multibyte nil))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
483 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
484 (defsubst imap-utf7-encode (string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
485 (if imap-use-utf7 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
486 (and string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
487 (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
488 (utf7-encode string t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
489 (error (message |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
490 "imap: Could not UTF7 encode `%s', using it unencoded..." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
491 string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
492 string))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
493 string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
494 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
495 (defsubst imap-utf7-decode (string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
496 (if imap-use-utf7 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
497 (and string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
498 (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
499 (utf7-decode string t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
500 (error (message |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
501 "imap: Could not UTF7 decode `%s', using it undecoded..." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
502 string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
503 string))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
504 string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
505 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
506 (defsubst imap-ok-p (status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
507 (if (eq status 'OK) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
508 t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
509 (setq imap-error status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
510 nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
511 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
512 (defun imap-error-text (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
513 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
514 (nth 3 (car imap-failed-tags)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
515 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
516 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
517 ;; Server functions; stream stuff: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
518 |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
519 (defun imap-log (string-or-buffer) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
520 (when imap-log |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
521 (with-current-buffer (get-buffer-create imap-log-buffer) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
522 (imap-disable-multibyte) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
523 (buffer-disable-undo) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
524 (goto-char (point-max)) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
525 (if (bufferp string-or-buffer) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
526 (insert-buffer-substring string-or-buffer) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
527 (insert string-or-buffer))))) |
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
528 |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
529 (defun imap-kerberos4-stream-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
530 (imap-capability 'AUTH=KERBEROS_V4 buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
531 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
532 (defun imap-kerberos4-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
533 (let ((cmds imap-kerberos4-program) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
534 cmd done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
535 (while (and (not done) (setq cmd (pop cmds))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
536 (message "Opening Kerberos 4 IMAP connection with `%s'..." cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
537 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
538 (let* ((port (or port imap-default-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
539 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
540 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
541 (process-connection-type imap-process-connection-type) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
542 (process (start-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
543 name buffer shell-file-name shell-command-switch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
544 (format-spec |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
545 cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
546 (format-spec-make |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
547 ?s server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
548 ?p (number-to-string port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
549 ?l imap-default-user)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
550 response) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
551 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
552 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
553 (setq imap-client-eol "\n" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
554 imap-calculate-literal-size-first t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
555 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
556 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
557 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
558 ;; Athena IMTEST can output SSL verify errors |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
559 (or (while (looking-at "^verify error:num=") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
560 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
561 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
562 (or (while (looking-at "^TLS connection established") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
563 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
564 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
565 ;; cyrus 1.6.x (13? < x <= 22) queries capabilities |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
566 (or (while (looking-at "^C:") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
567 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
568 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
569 ;; cyrus 1.6 imtest print "S: " before server greeting |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
570 (or (not (looking-at "S: ")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
571 (forward-char 3) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
572 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
573 (not (and (imap-parse-greeting) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
574 ;; success in imtest < 1.6: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
575 (or (re-search-forward |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
576 "^__\\(.*\\)__\n" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
577 ;; success in imtest 1.6: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
578 (re-search-forward |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
579 "^\\(Authenticat.*\\)" nil t)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
580 (setq response (match-string 1))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
581 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
582 (sit-for 1)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
583 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
584 (message "Opening Kerberos 4 IMAP connection with `%s'...%s" cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
585 (if response (concat "done, " response) "failed")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
586 (if (and response (let ((case-fold-search nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
587 (not (string-match "failed" response)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
588 (setq done process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
589 (if (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
590 (imap-logout)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
591 (delete-process process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
592 nil))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
593 done)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
594 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
595 (defun imap-gssapi-stream-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
596 (imap-capability 'AUTH=GSSAPI buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
597 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
598 (defun imap-gssapi-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
599 (let ((cmds imap-gssapi-program) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
600 cmd done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
601 (while (and (not done) (setq cmd (pop cmds))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
602 (message "Opening GSSAPI IMAP connection with `%s'..." cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
603 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
604 (let* ((port (or port imap-default-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
605 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
606 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
607 (process-connection-type imap-process-connection-type) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
608 (process (start-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
609 name buffer shell-file-name shell-command-switch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
610 (format-spec |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
611 cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
612 (format-spec-make |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
613 ?s server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
614 ?p (number-to-string port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
615 ?l imap-default-user)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
616 response) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
617 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
618 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
619 (setq imap-client-eol "\n" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
620 imap-calculate-literal-size-first t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
621 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
622 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
623 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
624 ;; Athena IMTEST can output SSL verify errors |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
625 (or (while (looking-at "^verify error:num=") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
626 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
627 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
628 (or (while (looking-at "^TLS connection established") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
629 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
630 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
631 ;; cyrus 1.6.x (13? < x <= 22) queries capabilities |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
632 (or (while (looking-at "^C:") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
633 (forward-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
634 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
635 ;; cyrus 1.6 imtest print "S: " before server greeting |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
636 (or (not (looking-at "S: ")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
637 (forward-char 3) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
638 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
639 ;; GNU SASL may print 'Trying ...' first. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
640 (or (not (looking-at "Trying ")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
641 (forward-line) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
642 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
643 (not (and (imap-parse-greeting) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
644 ;; success in imtest 1.6: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
645 (re-search-forward |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
646 (concat "^\\(\\(Authenticat.*\\)\\|\\(" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
647 "Client authentication " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
648 "finished.*\\)\\)") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
649 nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
650 (setq response (match-string 1))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
651 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
652 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
653 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
654 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
655 (message "GSSAPI IMAP connection: %s" (or response "failed")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
656 (if (and response (let ((case-fold-search nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
657 (not (string-match "failed" response)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
658 (setq done process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
659 (if (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
660 (imap-logout)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
661 (delete-process process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
662 nil))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
663 done)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
664 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
665 (defun imap-ssl-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
666 nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
667 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
668 (defun imap-ssl-open (name buffer server port) |
100993 | 669 "Open an SSL connection to SERVER." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
670 (let ((cmds (if (listp imap-ssl-program) imap-ssl-program |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
671 (list imap-ssl-program))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
672 cmd done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
673 (while (and (not done) (setq cmd (pop cmds))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
674 (message "imap: Opening SSL connection with `%s'..." cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
675 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
676 (let* ((port (or port imap-default-ssl-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
677 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
678 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
679 (process-connection-type imap-process-connection-type) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
680 (set-process-query-on-exit-flag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
681 (if (fboundp 'set-process-query-on-exit-flag) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
682 'set-process-query-on-exit-flag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
683 'process-kill-without-query)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
684 process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
685 (when (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
686 (setq process (start-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
687 name buffer shell-file-name |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
688 shell-command-switch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
689 (format-spec cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
690 (format-spec-make |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
691 ?s server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
692 ?p (number-to-string port))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
693 (funcall set-process-query-on-exit-flag process nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
694 process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
695 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
696 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
697 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
698 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
699 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
700 (forward-line -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
701 (not (imap-parse-greeting))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
702 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
703 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
704 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
705 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
706 (when (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
707 (setq done process)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
708 (if done |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
709 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
710 (message "imap: Opening SSL connection with `%s'...done" cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
711 done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
712 (message "imap: Opening SSL connection with `%s'...failed" cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
713 nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
714 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
715 (defun imap-tls-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
716 nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
717 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
718 (defun imap-tls-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
719 (let* ((port (or port imap-default-tls-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
720 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
721 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
722 (process (open-tls-stream name buffer server port))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
723 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
724 (while (and (memq (process-status process) '(open run)) |
100993 | 725 ;; FIXME: Per the "blue moon" comment, the process/buffer |
726 ;; handling here, and elsewhere in functions which open | |
727 ;; streams, looks confused. Obviously we can change buffers | |
728 ;; if a different process handler kicks in from | |
729 ;; `accept-process-output' or `sit-for' below, and TRT seems | |
730 ;; to be to `save-buffer' around those calls. (I wonder why | |
731 ;; `sit-for' is used with a non-zero wait.) -- fx | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
732 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
733 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
734 (forward-line -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
735 (not (imap-parse-greeting))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
736 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
737 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
738 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
739 (when (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
740 process)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
741 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
742 (defun imap-network-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
743 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
744 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
745 (defun imap-network-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
746 (let* ((port (or port imap-default-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
747 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
748 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
749 (process (open-network-stream name buffer server port))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
750 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
751 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
752 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
753 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
754 (not (imap-parse-greeting))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
755 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
756 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
757 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
758 (when (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
759 process)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
760 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
761 (defun imap-shell-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
762 nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
763 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
764 (defun imap-shell-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
765 (let ((cmds (if (listp imap-shell-program) imap-shell-program |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
766 (list imap-shell-program))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
767 cmd done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
768 (while (and (not done) (setq cmd (pop cmds))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
769 (message "imap: Opening IMAP connection with `%s'..." cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
770 (setq imap-client-eol "\n") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
771 (let* ((port (or port imap-default-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
772 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
773 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
774 (process (start-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
775 name buffer shell-file-name shell-command-switch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
776 (format-spec |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
777 cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
778 (format-spec-make |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
779 ?s server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
780 ?g imap-shell-host |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
781 ?p (number-to-string port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
782 ?l imap-default-user))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
783 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
784 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
785 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
786 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
787 (forward-line -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
788 (not (imap-parse-greeting))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
789 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
790 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
791 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
792 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
793 (when (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
794 (setq done process))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
795 (if done |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
796 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
797 (message "imap: Opening IMAP connection with `%s'...done" cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
798 done) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
799 (message "imap: Opening IMAP connection with `%s'...failed" cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
800 nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
801 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
802 (defun imap-starttls-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
803 (imap-capability 'STARTTLS buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
804 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
805 (defun imap-starttls-open (name buffer server port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
806 (let* ((port (or port imap-default-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
807 (coding-system-for-read imap-coding-system-for-read) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
808 (coding-system-for-write imap-coding-system-for-write) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
809 (process (starttls-open-stream name buffer server port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
810 done tls-info) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
811 (message "imap: Connecting with STARTTLS...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
812 (when process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
813 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
814 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
815 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
816 (forward-line -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
817 (not (imap-parse-greeting))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
818 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
819 (sit-for 1)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
820 (imap-send-command "STARTTLS") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
821 (while (and (memq (process-status process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
822 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
823 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
824 (forward-line -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
825 (not (re-search-forward "[0-9]+ OK.*\r?\n" nil t))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
826 (accept-process-output process 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
827 (sit-for 1)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
828 (imap-log buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
829 (when (and (setq tls-info (starttls-negotiate process)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
830 (memq (process-status process) '(open run))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
831 (setq done process))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
832 (if (stringp tls-info) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
833 (message "imap: STARTTLS info: %s" tls-info)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
834 (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
835 done)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
836 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
837 ;; Server functions; authenticator stuff: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
838 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
839 (defun imap-interactive-login (buffer loginfunc) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
840 "Login to server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
841 LOGINFUNC is passed a username and a password, it should return t if |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
842 it where successful authenticating itself to the server, nil otherwise. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
843 Returns t if login was successful, nil otherwise." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
844 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
845 (make-local-variable 'imap-username) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
846 (make-local-variable 'imap-password) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
847 (let (user passwd ret) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
848 ;; (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
849 (while (or (not user) (not passwd)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
850 (setq user (or imap-username |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
851 (read-from-minibuffer |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
852 (concat "imap: username for " imap-server |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
853 " (using stream `" (symbol-name imap-stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
854 "'): ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
855 (or user imap-default-user)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
856 (setq passwd (or imap-password |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
857 (read-passwd |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
858 (concat "imap: password for " user "@" |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
859 imap-server " (using authenticator `" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
860 (symbol-name imap-auth) "'): ")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
861 (when (and user passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
862 (if (funcall loginfunc user passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
863 (progn |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
864 (message "imap: Login successful...") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
865 (setq ret t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
866 imap-username user) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
867 (when (and (not imap-password) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
868 (or imap-store-password |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
869 (y-or-n-p "imap: Store password for this IMAP session? "))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
870 (setq imap-password passwd))) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
871 (message "imap: Login failed...") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
872 (setq passwd nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
873 (setq imap-password nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
874 (sit-for 1)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
875 ;; (quit (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
876 ;; (setq user nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
877 ;; passwd nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
878 ;; (error (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
879 ;; (setq user nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
880 ;; passwd nil)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
881 ret))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
882 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
883 (defun imap-gssapi-auth-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
884 (eq imap-stream 'gssapi)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
885 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
886 (defun imap-gssapi-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
887 (message "imap: Authenticating using GSSAPI...%s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
888 (if (eq imap-stream 'gssapi) "done" "failed")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
889 (eq imap-stream 'gssapi)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
890 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
891 (defun imap-kerberos4-auth-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
892 (and (imap-capability 'AUTH=KERBEROS_V4 buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
893 (eq imap-stream 'kerberos4))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
894 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
895 (defun imap-kerberos4-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
896 (message "imap: Authenticating using Kerberos 4...%s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
897 (if (eq imap-stream 'kerberos4) "done" "failed")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
898 (eq imap-stream 'kerberos4)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
899 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
900 (defun imap-cram-md5-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
901 (imap-capability 'AUTH=CRAM-MD5 buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
902 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
903 (defun imap-cram-md5-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
904 "Login to server using the AUTH CRAM-MD5 method." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
905 (message "imap: Authenticating using CRAM-MD5...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
906 (let ((done (imap-interactive-login |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
907 buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
908 (lambda (user passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
909 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
910 (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
911 (list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
912 "AUTHENTICATE CRAM-MD5" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
913 (lambda (challenge) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
914 (let* ((decoded (base64-decode-string challenge)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
915 (hash (rfc2104-hash 'md5 64 16 passwd decoded)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
916 (response (concat user " " hash)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
917 (encoded (base64-encode-string response))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
918 encoded))))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
919 (if done |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
920 (message "imap: Authenticating using CRAM-MD5...done") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
921 (message "imap: Authenticating using CRAM-MD5...failed")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
922 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
923 (defun imap-login-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
924 (and (not (imap-capability 'LOGINDISABLED buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
925 (not (imap-capability 'X-LOGIN-CMD-DISABLED buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
926 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
927 (defun imap-quote-specials (string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
928 (with-temp-buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
929 (insert string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
930 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
931 (while (re-search-forward "[\\\"]" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
932 (forward-char -1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
933 (insert "\\") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
934 (forward-char 1)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
935 (buffer-string))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
936 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
937 (defun imap-login-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
938 "Login to server using the LOGIN command." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
939 (message "imap: Plaintext authentication...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
940 (imap-interactive-login buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
941 (lambda (user passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
942 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
943 (concat "LOGIN \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
944 (imap-quote-specials user) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
945 "\" \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
946 (imap-quote-specials passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
947 "\"")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
948 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
949 (defun imap-anonymous-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
950 t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
951 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
952 (defun imap-anonymous-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
953 (message "imap: Logging in anonymously...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
954 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
955 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
956 (concat "LOGIN anonymous \"" (concat (user-login-name) "@" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
957 (system-name)) "\""))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
958 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
959 ;;; Compiler directives. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
960 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
961 (defvar imap-sasl-client) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
962 (defvar imap-sasl-step) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
963 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
964 (defun imap-sasl-make-mechanisms (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
965 (let ((mecs '())) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
966 (mapc (lambda (sym) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
967 (let ((name (symbol-name sym))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
968 (if (and (> (length name) 5) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
969 (string-equal "AUTH=" (substring name 0 5 ))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
970 (setq mecs (cons (substring name 5) mecs))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
971 (imap-capability nil buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
972 mecs)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
973 |
86817
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
974 (declare-function sasl-find-mechanism "sasl" (mechanism)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
975 (declare-function sasl-mechanism-name "sasl" (mechanism)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
976 (declare-function sasl-make-client "sasl" (mechanism name service server)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
977 (declare-function sasl-next-step "sasl" (client step)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
978 (declare-function sasl-step-data "sasl" (step)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
979 (declare-function sasl-step-set-data "sasl" (step data)) |
be7be23ea4b9
(sasl-find-mechanism, sasl-mechanism-name)
Glenn Morris <rgm@gnu.org>
parents:
86442
diff
changeset
|
980 |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
981 (defun imap-sasl-auth-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
982 (and (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
983 (require 'sasl) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
984 (error nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
985 (sasl-find-mechanism (imap-sasl-make-mechanisms buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
986 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
987 (defun imap-sasl-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
988 "Login to server using the SASL method." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
989 (message "imap: Authenticating using SASL...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
990 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
991 (make-local-variable 'imap-username) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
992 (make-local-variable 'imap-sasl-client) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
993 (make-local-variable 'imap-sasl-step) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
994 (let ((mechanism (sasl-find-mechanism (imap-sasl-make-mechanisms buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
995 logged user) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
996 (while (not logged) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
997 (setq user (or imap-username |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
998 (read-from-minibuffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
999 (concat "IMAP username for " imap-server " using SASL " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1000 (sasl-mechanism-name mechanism) ": ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1001 (or user imap-default-user)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1002 (when user |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1003 (setq imap-sasl-client (sasl-make-client mechanism user "imap2" imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1004 imap-sasl-step (sasl-next-step imap-sasl-client nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1005 (let ((tag (imap-send-command |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1006 (if (sasl-step-data imap-sasl-step) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1007 (format "AUTHENTICATE %s %s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1008 (sasl-mechanism-name mechanism) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1009 (sasl-step-data imap-sasl-step)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1010 (format "AUTHENTICATE %s" (sasl-mechanism-name mechanism))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1011 buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1012 (while (eq (imap-wait-for-tag tag) 'INCOMPLETE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1013 (sasl-step-set-data imap-sasl-step (base64-decode-string imap-continuation)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1014 (setq imap-continuation nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1015 imap-sasl-step (sasl-next-step imap-sasl-client imap-sasl-step)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1016 (imap-send-command-1 (if (sasl-step-data imap-sasl-step) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1017 (base64-encode-string (sasl-step-data imap-sasl-step) t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1018 ""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1019 (if (imap-ok-p (imap-wait-for-tag tag)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1020 (setq imap-username user |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1021 logged t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1022 (message "Login failed...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1023 (sit-for 1))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1024 logged))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1025 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1026 (defun imap-digest-md5-p (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1027 (and (imap-capability 'AUTH=DIGEST-MD5 buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1028 (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1029 (require 'digest-md5) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1030 (error nil)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1031 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1032 (defun imap-digest-md5-auth (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1033 "Login to server using the AUTH DIGEST-MD5 method." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1034 (message "imap: Authenticating using DIGEST-MD5...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1035 (imap-interactive-login |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1036 buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1037 (lambda (user passwd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1038 (let ((tag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1039 (imap-send-command |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1040 (list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1041 "AUTHENTICATE DIGEST-MD5" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1042 (lambda (challenge) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1043 (digest-md5-parse-digest-challenge |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1044 (base64-decode-string challenge)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1045 (let* ((digest-uri |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1046 (digest-md5-digest-uri |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1047 "imap" (digest-md5-challenge 'realm))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1048 (response |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1049 (digest-md5-digest-response |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1050 user passwd digest-uri))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1051 (base64-encode-string response 'no-line-break)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1052 ))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1053 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1054 nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1055 (setq imap-continuation nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1056 (imap-send-command-1 "") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1057 (imap-ok-p (imap-wait-for-tag tag))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1058 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1059 ;; Server functions: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1060 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1061 (defun imap-open-1 (buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1062 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1063 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1064 (setq imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1065 imap-current-message nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1066 imap-state 'initial |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1067 imap-process (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1068 (funcall (nth 2 (assq imap-stream |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1069 imap-stream-alist)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1070 "imap" buffer imap-server imap-port) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1071 ((error quit) nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1072 (when imap-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1073 (set-process-filter imap-process 'imap-arrival-filter) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1074 (set-process-sentinel imap-process 'imap-sentinel) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1075 (while (and (eq imap-state 'initial) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1076 (memq (process-status imap-process) '(open run))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1077 (message "Waiting for response from %s..." imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1078 (accept-process-output imap-process 1)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1079 (message "Waiting for response from %s...done" imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1080 (and (memq (process-status imap-process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1081 imap-process)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1082 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1083 (defun imap-open (server &optional port stream auth buffer) |
100993 | 1084 "Open an IMAP connection to host SERVER at PORT returning a buffer. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1085 If PORT is unspecified, a default value is used (143 except |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1086 for SSL which use 993). |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1087 STREAM indicates the stream to use, see `imap-streams' for available |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1088 streams. If nil, it choices the best stream the server is capable of. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1089 AUTH indicates authenticator to use, see `imap-authenticators' for |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1090 available authenticators. If nil, it choices the best stream the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1091 server is capable of. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1092 BUFFER can be a buffer or a name of a buffer, which is created if |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1093 necessary. If nil, the buffer name is generated." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1094 (setq buffer (or buffer (format " *imap* %s:%d" server (or port 0)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1095 (with-current-buffer (get-buffer-create buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1096 (if (imap-opened buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1097 (imap-close buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1098 (mapc 'make-local-variable imap-local-variables) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1099 (imap-disable-multibyte) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1100 (buffer-disable-undo) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1101 (setq imap-server (or server imap-server)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1102 (setq imap-port (or port imap-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1103 (setq imap-auth (or auth imap-auth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1104 (setq imap-stream (or stream imap-stream)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1105 (message "imap: Connecting to %s..." imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1106 (if (null (let ((imap-stream (or imap-stream imap-default-stream))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1107 (imap-open-1 buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1108 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1109 (message "imap: Connecting to %s...failed" imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1110 nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1111 (when (null imap-stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1112 ;; Need to choose stream. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1113 (let ((streams imap-streams)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1114 (while (setq stream (pop streams)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1115 ;; OK to use this stream? |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1116 (when (funcall (nth 1 (assq stream imap-stream-alist)) buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1117 ;; Stream changed? |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1118 (if (not (eq imap-default-stream stream)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1119 (with-current-buffer (get-buffer-create |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1120 (generate-new-buffer-name " *temp*")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1121 (mapc 'make-local-variable imap-local-variables) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1122 (imap-disable-multibyte) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1123 (buffer-disable-undo) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1124 (setq imap-server (or server imap-server)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1125 (setq imap-port (or port imap-port)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1126 (setq imap-auth (or auth imap-auth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1127 (message "imap: Reconnecting with stream `%s'..." stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1128 (if (null (let ((imap-stream stream)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1129 (imap-open-1 (current-buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1130 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1131 (kill-buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1132 (message |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1133 "imap: Reconnecting with stream `%s'...failed" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1134 stream)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1135 ;; We're done, kill the first connection |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1136 (imap-close buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1137 (let ((name (if (stringp buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1138 buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1139 (buffer-name buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1140 (kill-buffer buffer) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1141 (rename-buffer name) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1142 ;; set the passed buffer to the current one, |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1143 ;; so that (imap-opened buffer) later will work |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1144 (setq buffer (current-buffer))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1145 (message "imap: Reconnecting with stream `%s'...done" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1146 stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1147 (setq imap-stream stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1148 (setq imap-capability nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1149 (setq streams nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1150 ;; We're done |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1151 (message "imap: Connecting to %s...done" imap-server) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1152 (setq imap-stream stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1153 (setq imap-capability nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1154 (setq streams nil)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1155 (when (imap-opened buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1156 (setq imap-mailbox-data (make-vector imap-mailbox-prime 0))) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1157 ;; (debug "opened+state+auth+buffer" (imap-opened buffer) imap-state imap-auth buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1158 (when imap-stream |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1159 buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1160 |
87859 | 1161 (defcustom imap-ping-server t |
1162 "If non-nil, check if IMAP is open. | |
1163 See the function `imap-ping-server'." | |
92334
9f0819c582f0
(imap-ping-server): Change defcustom :version from 23.0 to 23.1.
Glenn Morris <rgm@gnu.org>
parents:
87859
diff
changeset
|
1164 :version "23.1" ;; No Gnus |
87859 | 1165 :group 'imap |
1166 :type 'boolean) | |
1167 | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1168 (defun imap-opened (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1169 "Return non-nil if connection to imap server in BUFFER is open. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1170 If BUFFER is nil then the current buffer is used." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1171 (and (setq buffer (get-buffer (or buffer (current-buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1172 (buffer-live-p buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1173 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1174 (and imap-process |
87859 | 1175 (memq (process-status imap-process) '(open run)) |
1176 (if imap-ping-server | |
1177 (imap-ping-server) | |
1178 t))))) | |
1179 | |
1180 (defun imap-ping-server (&optional buffer) | |
1181 "Ping the IMAP server in BUFFER with a \"NOOP\" command. | |
1182 Return non-nil if the server responds, and nil if it does not | |
1183 respond. If BUFFER is nil, the current buffer is used." | |
1184 (condition-case () | |
1185 (imap-ok-p (imap-send-command-wait "NOOP" buffer)) | |
1186 (error nil))) | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1187 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1188 (defun imap-authenticate (&optional user passwd buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1189 "Authenticate to server in BUFFER, using current buffer if nil. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1190 It uses the authenticator specified when opening the server. If the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1191 authenticator requires username/passwords, they are queried from the |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1192 user and optionally stored in the buffer. If USER and/or PASSWD is |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1193 specified, the user will not be questioned and the username and/or |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1194 password is remembered in the buffer." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1195 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1196 (if (not (eq imap-state 'nonauth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1197 (or (eq imap-state 'auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1198 (eq imap-state 'selected) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1199 (eq imap-state 'examine)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1200 (make-local-variable 'imap-username) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1201 (make-local-variable 'imap-password) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1202 (make-local-variable 'imap-last-authenticator) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1203 (when user (setq imap-username user)) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1204 (when passwd (setq imap-password passwd)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1205 (if imap-auth |
110111
5b9f64b04a04
Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
1206 (and (setq imap-last-authenticator |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1207 (assq imap-auth imap-authenticator-alist)) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1208 (funcall (nth 2 imap-last-authenticator) (current-buffer)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1209 (setq imap-state 'auth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1210 ;; Choose authenticator. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1211 (let ((auths imap-authenticators) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1212 auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1213 (while (setq auth (pop auths)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1214 ;; OK to use authenticator? |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1215 (setq imap-last-authenticator |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1216 (assq auth imap-authenticator-alist)) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1217 (when (funcall (nth 1 imap-last-authenticator) (current-buffer)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1218 (message "imap: Authenticating to `%s' using `%s'..." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1219 imap-server auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1220 (setq imap-auth auth) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1221 (if (funcall (nth 2 imap-last-authenticator) (current-buffer)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1222 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1223 (message "imap: Authenticating to `%s' using `%s'...done" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1224 imap-server auth) |
105254
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1225 ;; set imap-state correctly on successful auth attempt |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1226 (setq imap-state 'auth) |
c31b6489ac68
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104890
diff
changeset
|
1227 ;; stop iterating through the authenticator list |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1228 (setq auths nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1229 (message "imap: Authenticating to `%s' using `%s'...failed" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1230 imap-server auth))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1231 imap-state)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1232 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1233 (defun imap-close (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1234 "Close connection to server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1235 If BUFFER is nil, the current buffer is used." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1236 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1237 (when (imap-opened) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1238 (condition-case nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1239 (imap-logout-wait) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1240 (quit nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1241 (when (and imap-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1242 (memq (process-status imap-process) '(open run))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1243 (delete-process imap-process)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1244 (setq imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1245 imap-current-message nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1246 imap-process nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1247 (erase-buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1248 t)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1249 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1250 (defun imap-capability (&optional identifier buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1251 "Return a list of identifiers which server in BUFFER support. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1252 If IDENTIFIER, return non-nil if it's among the servers capabilities. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1253 If BUFFER is nil, the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1254 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1255 (unless imap-capability |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1256 (unless (imap-ok-p (imap-send-command-wait "CAPABILITY")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1257 (setq imap-capability '(IMAP2)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1258 (if identifier |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1259 (memq (intern (upcase (symbol-name identifier))) imap-capability) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1260 imap-capability))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1261 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1262 (defun imap-id (&optional list-of-values buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1263 "Identify client to server in BUFFER, and return server identity. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1264 LIST-OF-VALUES is nil, or a plist with identifier and value |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1265 strings to send to the server to identify the client. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1266 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1267 Return a list of identifiers which server in BUFFER support, or |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1268 nil if it doesn't support ID or returns no information. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1269 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1270 If BUFFER is nil, the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1271 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1272 (when (and (imap-capability 'ID) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1273 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1274 (if (null list-of-values) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1275 "ID NIL" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1276 (concat "ID (" (mapconcat (lambda (el) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1277 (concat "\"" el "\"")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1278 list-of-values |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1279 " ") ")"))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1280 imap-id))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1281 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1282 (defun imap-namespace (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1283 "Return a namespace hierarchy at server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1284 If BUFFER is nil, the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1285 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1286 (unless imap-namespace |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1287 (when (imap-capability 'NAMESPACE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1288 (imap-send-command-wait "NAMESPACE"))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1289 imap-namespace)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1290 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1291 (defun imap-send-command-wait (command &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1292 (imap-wait-for-tag (imap-send-command command buffer) buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1293 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1294 (defun imap-logout (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1295 (or buffer (setq buffer (current-buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1296 (if imap-logout-timeout |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1297 (with-timeout (imap-logout-timeout |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1298 (condition-case nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1299 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1300 (delete-process imap-process)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1301 (error))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1302 (imap-send-command "LOGOUT" buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1303 (imap-send-command "LOGOUT" buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1304 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1305 (defun imap-logout-wait (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1306 (or buffer (setq buffer (current-buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1307 (if imap-logout-timeout |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1308 (with-timeout (imap-logout-timeout |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1309 (condition-case nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1310 (with-current-buffer buffer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1311 (delete-process imap-process)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1312 (error))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1313 (imap-send-command-wait "LOGOUT" buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1314 (imap-send-command-wait "LOGOUT" buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1315 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1316 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1317 ;; Mailbox functions: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1318 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1319 (defun imap-mailbox-put (propname value &optional mailbox buffer) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1320 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1321 (if imap-mailbox-data |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1322 (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1323 propname value) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1324 (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s" |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1325 propname value mailbox (current-buffer))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1326 t)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1327 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1328 (defsubst imap-mailbox-get-1 (propname &optional mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1329 (get (intern-soft (or mailbox imap-current-mailbox) imap-mailbox-data) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1330 propname)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1331 |
110216
6f3cc5774150
imap.el (imap-mailbox-get): Revert last change for this function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110215
diff
changeset
|
1332 (defun imap-mailbox-get (propname &optional mailbox buffer) |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1333 (let ((mailbox (imap-utf7-encode mailbox))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1334 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1335 (imap-mailbox-get-1 propname (or mailbox imap-current-mailbox))))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1336 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1337 (defun imap-mailbox-map-1 (func &optional mailbox-decoder buffer) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1338 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1339 (let (result) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1340 (mapatoms |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1341 (lambda (s) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1342 (push (funcall func (if mailbox-decoder |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1343 (funcall mailbox-decoder (symbol-name s)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1344 (symbol-name s))) result)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1345 imap-mailbox-data) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1346 result))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1347 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1348 (defun imap-mailbox-map (func &optional buffer) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1349 "Map a function across each mailbox in `imap-mailbox-data', returning a list. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1350 Function should take a mailbox name (a string) as |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1351 the only argument." |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1352 (imap-mailbox-map-1 func 'imap-utf7-decode buffer)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1353 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1354 (defun imap-current-mailbox (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1355 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1356 (imap-utf7-decode imap-current-mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1357 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1358 (defun imap-current-mailbox-p-1 (mailbox &optional examine) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1359 (and (string= mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1360 (or (and examine |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1361 (eq imap-state 'examine)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1362 (and (not examine) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1363 (eq imap-state 'selected))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1364 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1365 (defun imap-current-mailbox-p (mailbox &optional examine buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1366 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1367 (imap-current-mailbox-p-1 (imap-utf7-encode mailbox) examine))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1368 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1369 (defun imap-mailbox-select-1 (mailbox &optional examine) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1370 "Select MAILBOX on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1371 If EXAMINE is non-nil, do a read-only select." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1372 (if (imap-current-mailbox-p-1 mailbox examine) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1373 imap-current-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1374 (setq imap-current-mailbox mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1375 (if (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1376 (concat (if examine "EXAMINE" "SELECT") " \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1377 mailbox "\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1378 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1379 (setq imap-message-data (make-vector imap-message-prime 0) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1380 imap-state (if examine 'examine 'selected)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1381 imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1382 ;; Failed SELECT/EXAMINE unselects current mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1383 (setq imap-current-mailbox nil)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1384 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1385 (defun imap-mailbox-select (mailbox &optional examine buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1386 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1387 (imap-utf7-decode |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1388 (imap-mailbox-select-1 (imap-utf7-encode mailbox) examine)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1389 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1390 (defun imap-mailbox-examine-1 (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1391 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1392 (imap-mailbox-select-1 mailbox 'examine))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1393 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1394 (defun imap-mailbox-examine (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1395 "Examine MAILBOX on server in BUFFER." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1396 (imap-mailbox-select mailbox 'examine buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1397 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1398 (defun imap-mailbox-unselect (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1399 "Close current folder in BUFFER, without expunging articles." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1400 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1401 (when (or (eq imap-state 'auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1402 (and (imap-capability 'UNSELECT) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1403 (imap-ok-p (imap-send-command-wait "UNSELECT"))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1404 (and (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1405 (imap-send-command-wait (concat "EXAMINE \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1406 imap-current-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1407 "\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1408 (imap-ok-p (imap-send-command-wait "CLOSE")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1409 (setq imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1410 imap-message-data nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1411 imap-state 'auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1412 t))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1413 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1414 (defun imap-mailbox-expunge (&optional asynch buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1415 "Expunge articles in current folder in BUFFER. |
100993 | 1416 If ASYNCH, do not wait for successful completion of the command. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1417 If BUFFER is nil the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1418 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1419 (when (and imap-current-mailbox (not (eq imap-state 'examine))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1420 (if asynch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1421 (imap-send-command "EXPUNGE") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1422 (imap-ok-p (imap-send-command-wait "EXPUNGE")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1423 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1424 (defun imap-mailbox-close (&optional asynch buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1425 "Expunge articles and close current folder in BUFFER. |
100993 | 1426 If ASYNCH, do not wait for successful completion of the command. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1427 If BUFFER is nil the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1428 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1429 (when imap-current-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1430 (if asynch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1431 (imap-add-callback (imap-send-command "CLOSE") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1432 `(lambda (tag status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1433 (message "IMAP mailbox `%s' closed... %s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1434 imap-current-mailbox status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1435 (when (eq ,imap-current-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1436 imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1437 ;; Don't wipe out data if another mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1438 ;; was selected... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1439 (setq imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1440 imap-message-data nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1441 imap-state 'auth)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1442 (when (imap-ok-p (imap-send-command-wait "CLOSE")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1443 (setq imap-current-mailbox nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1444 imap-message-data nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1445 imap-state 'auth))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1446 t))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1447 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1448 (defun imap-mailbox-create-1 (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1449 (imap-ok-p (imap-send-command-wait (list "CREATE \"" mailbox "\"")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1450 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1451 (defun imap-mailbox-create (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1452 "Create MAILBOX on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1453 If BUFFER is nil the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1454 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1455 (imap-mailbox-create-1 (imap-utf7-encode mailbox)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1456 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1457 (defun imap-mailbox-delete (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1458 "Delete MAILBOX on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1459 If BUFFER is nil the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1460 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1461 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1462 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1463 (imap-send-command-wait (list "DELETE \"" mailbox "\"")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1464 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1465 (defun imap-mailbox-rename (oldname newname &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1466 "Rename mailbox OLDNAME to NEWNAME on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1467 If BUFFER is nil the current buffer is assumed." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1468 (let ((oldname (imap-utf7-encode oldname)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1469 (newname (imap-utf7-encode newname))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1470 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1471 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1472 (imap-send-command-wait (list "RENAME \"" oldname "\" " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1473 "\"" newname "\"")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1474 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1475 (defun imap-mailbox-lsub (&optional root reference add-delimiter buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1476 "Return a list of subscribed mailboxes on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1477 If ROOT is non-nil, only list matching mailboxes. If ADD-DELIMITER is |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1478 non-nil, a hierarchy delimiter is added to root. REFERENCE is a |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1479 implementation-specific string that has to be passed to lsub command." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1480 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1481 ;; Make sure we know the hierarchy separator for root's hierarchy |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1482 (when (and add-delimiter (null (imap-mailbox-get-1 'delimiter root))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1483 (imap-send-command-wait (concat "LIST \"" reference "\" \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1484 (imap-utf7-encode root) "\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1485 ;; clear list data (NB not delimiter and other stuff) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1486 (imap-mailbox-map-1 (lambda (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1487 (imap-mailbox-put 'lsub nil mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1488 (when (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1489 (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1490 (concat "LSUB \"" reference "\" \"" (imap-utf7-encode root) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1491 (and add-delimiter (imap-mailbox-get-1 'delimiter root)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1492 "%\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1493 (let (out) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1494 (imap-mailbox-map-1 (lambda (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1495 (when (imap-mailbox-get-1 'lsub mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1496 (push (imap-utf7-decode mailbox) out)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1497 (nreverse out))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1498 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1499 (defun imap-mailbox-list (root &optional reference add-delimiter buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1500 "Return a list of mailboxes matching ROOT on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1501 If ADD-DELIMITER is non-nil, a hierarchy delimiter is added to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1502 root. REFERENCE is a implementation-specific string that has to be |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1503 passed to list command." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1504 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1505 ;; Make sure we know the hierarchy separator for root's hierarchy |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1506 (when (and add-delimiter (null (imap-mailbox-get-1 'delimiter root))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1507 (imap-send-command-wait (concat "LIST \"" reference "\" \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1508 (imap-utf7-encode root) "\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1509 ;; clear list data (NB not delimiter and other stuff) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1510 (imap-mailbox-map-1 (lambda (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1511 (imap-mailbox-put 'list nil mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1512 (when (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1513 (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1514 (concat "LIST \"" reference "\" \"" (imap-utf7-encode root) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1515 (and add-delimiter (imap-mailbox-get-1 'delimiter root)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1516 "%\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1517 (let (out) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1518 (imap-mailbox-map-1 (lambda (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1519 (when (imap-mailbox-get-1 'list mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1520 (push (imap-utf7-decode mailbox) out)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1521 (nreverse out))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1522 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1523 (defun imap-mailbox-subscribe (mailbox &optional buffer) |
100993 | 1524 "Send the SUBSCRIBE command on the MAILBOX to server in BUFFER. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1525 Returns non-nil if successful." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1526 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1527 (imap-ok-p (imap-send-command-wait (concat "SUBSCRIBE \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1528 (imap-utf7-encode mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1529 "\""))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1530 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1531 (defun imap-mailbox-unsubscribe (mailbox &optional buffer) |
100993 | 1532 "Send the SUBSCRIBE command on the MAILBOX to server in BUFFER. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1533 Returns non-nil if successful." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1534 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1535 (imap-ok-p (imap-send-command-wait (concat "UNSUBSCRIBE " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1536 (imap-utf7-encode mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1537 "\""))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1538 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1539 (defun imap-mailbox-status (mailbox items &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1540 "Get status items ITEM in MAILBOX from server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1541 ITEMS can be a symbol or a list of symbols, valid symbols are one of |
100993 | 1542 the STATUS data items -- i.e. `messages', `recent', `uidnext', `uidvalidity', |
1543 or `unseen'. If ITEMS is a list of symbols, a list of values is | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1544 returned, if ITEMS is a symbol only its value is returned." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1545 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1546 (when (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1547 (imap-send-command-wait (list "STATUS \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1548 (imap-utf7-encode mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1549 "\" " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1550 (upcase |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1551 (format "%s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1552 (if (listp items) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1553 items |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1554 (list items))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1555 (if (listp items) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1556 (mapcar (lambda (item) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1557 (imap-mailbox-get item mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1558 items) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1559 (imap-mailbox-get items mailbox))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1560 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1561 (defun imap-mailbox-status-asynch (mailbox items &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1562 "Send status item request ITEM on MAILBOX to server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1563 ITEMS can be a symbol or a list of symbols, valid symbols are one of |
100993 | 1564 the STATUS data items -- i.e. 'messages, 'recent, 'uidnext, 'uidvalidity |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1565 or 'unseen. The IMAP command tag is returned." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1566 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1567 (imap-send-command (list "STATUS \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1568 (imap-utf7-encode mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1569 "\" " |
87097 | 1570 (upcase |
1571 (format "%s" | |
1572 (if (listp items) | |
1573 items | |
1574 (list items)))))))) | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1575 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1576 (defun imap-mailbox-acl-get (&optional mailbox buffer) |
100993 | 1577 "Get ACL on MAILBOX from server in BUFFER." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1578 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1579 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1580 (when (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1581 (imap-send-command-wait (list "GETACL \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1582 (or mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1583 "\""))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1584 (imap-mailbox-get-1 'acl (or mailbox imap-current-mailbox)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1585 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1586 (defun imap-mailbox-acl-set (identifier rights &optional mailbox buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1587 "Change/set ACL for IDENTIFIER to RIGHTS in MAILBOX from server in BUFFER." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1588 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1589 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1590 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1591 (imap-send-command-wait (list "SETACL \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1592 (or mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1593 "\" " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1594 identifier |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1595 " " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1596 rights)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1597 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1598 (defun imap-mailbox-acl-delete (identifier &optional mailbox buffer) |
100993 | 1599 "Remove any <identifier,rights> pair for IDENTIFIER in MAILBOX from server in BUFFER." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1600 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1601 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1602 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1603 (imap-send-command-wait (list "DELETEACL \"" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1604 (or mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1605 "\" " |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1606 identifier)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1607 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1608 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1609 ;; Message functions: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1610 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1611 (defun imap-current-message (&optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1612 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1613 imap-current-message)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1614 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1615 (defun imap-list-to-message-set (list) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1616 (mapconcat (lambda (item) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1617 (number-to-string item)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1618 (if (listp list) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1619 list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1620 (list list)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1621 ",")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1622 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1623 (defun imap-range-to-message-set (range) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1624 (mapconcat |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1625 (lambda (item) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1626 (if (consp item) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1627 (format "%d:%d" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1628 (car item) (cdr item)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1629 (format "%d" item))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1630 (if (and (listp range) (not (listp (cdr range)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1631 (list range) ;; make (1 . 2) into ((1 . 2)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1632 range) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1633 ",")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1634 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1635 (defun imap-fetch-asynch (uids props &optional nouidfetch buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1636 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1637 (imap-send-command (format "%sFETCH %s %s" (if nouidfetch "" "UID ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1638 (if (listp uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1639 (imap-list-to-message-set uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1640 uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1641 props)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1642 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1643 (defun imap-fetch (uids props &optional receive nouidfetch buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1644 "Fetch properties PROPS from message set UIDS from server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1645 UIDS can be a string, number or a list of numbers. If RECEIVE |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1646 is non-nil return these properties." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1647 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1648 (when (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1649 (format "%sFETCH %s %s" (if nouidfetch "" "UID ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1650 (if (listp uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1651 (imap-list-to-message-set uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1652 uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1653 props))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1654 (if (or (null receive) (stringp uids)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1655 t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1656 (if (listp uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1657 (mapcar (lambda (uid) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1658 (if (listp receive) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1659 (mapcar (lambda (prop) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1660 (imap-message-get uid prop)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1661 receive) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1662 (imap-message-get uid receive))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1663 uids) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1664 (imap-message-get uids receive)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1665 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1666 (defun imap-message-put (uid propname value &optional buffer) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1667 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1668 (if imap-message-data |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1669 (put (intern (number-to-string uid) imap-message-data) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1670 propname value) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1671 (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s" |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1672 uid propname value (current-buffer))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1673 t)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1674 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1675 (defun imap-message-get (uid propname &optional buffer) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1676 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1677 (get (intern-soft (number-to-string uid) imap-message-data) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1678 propname))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1679 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1680 (defun imap-message-map (func propname &optional buffer) |
104890
2e22af528b76
* calendar/time-date.el (autoload):
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104734
diff
changeset
|
1681 "Map a function across each message in `imap-message-data', returning a list." |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1682 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1683 (let (result) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1684 (mapatoms |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1685 (lambda (s) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1686 (push (funcall func (get s 'UID) (get s propname)) result)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1687 imap-message-data) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1688 result))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1689 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1690 (defmacro imap-message-envelope-date (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1691 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1692 (elt (imap-message-get ,uid 'ENVELOPE) 0))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1693 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1694 (defmacro imap-message-envelope-subject (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1695 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1696 (elt (imap-message-get ,uid 'ENVELOPE) 1))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1697 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1698 (defmacro imap-message-envelope-from (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1699 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1700 (elt (imap-message-get ,uid 'ENVELOPE) 2))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1701 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1702 (defmacro imap-message-envelope-sender (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1703 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1704 (elt (imap-message-get ,uid 'ENVELOPE) 3))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1705 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1706 (defmacro imap-message-envelope-reply-to (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1707 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1708 (elt (imap-message-get ,uid 'ENVELOPE) 4))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1709 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1710 (defmacro imap-message-envelope-to (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1711 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1712 (elt (imap-message-get ,uid 'ENVELOPE) 5))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1713 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1714 (defmacro imap-message-envelope-cc (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1715 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1716 (elt (imap-message-get ,uid 'ENVELOPE) 6))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1717 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1718 (defmacro imap-message-envelope-bcc (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1719 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1720 (elt (imap-message-get ,uid 'ENVELOPE) 7))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1721 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1722 (defmacro imap-message-envelope-in-reply-to (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1723 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1724 (elt (imap-message-get ,uid 'ENVELOPE) 8))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1725 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1726 (defmacro imap-message-envelope-message-id (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1727 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1728 (elt (imap-message-get ,uid 'ENVELOPE) 9))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1729 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1730 (defmacro imap-message-body (uid &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1731 `(with-current-buffer (or ,buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1732 (imap-message-get ,uid 'BODY))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1733 |
100993 | 1734 ;; FIXME: Should this try to use CHARSET? -- fx |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1735 (defun imap-search (predicate &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1736 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1737 (imap-mailbox-put 'search 'dummy) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1738 (when (imap-ok-p (imap-send-command-wait (concat "UID SEARCH " predicate))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1739 (if (eq (imap-mailbox-get-1 'search imap-current-mailbox) 'dummy) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1740 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1741 (message "Missing SEARCH response to a SEARCH command (server not RFC compliant)...") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1742 nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1743 (imap-mailbox-get-1 'search imap-current-mailbox))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1744 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1745 (defun imap-message-flag-permanent-p (flag &optional mailbox buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1746 "Return t if FLAG can be permanently (between IMAP sessions) saved on articles, in MAILBOX on server in BUFFER." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1747 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1748 (or (member "\\*" (imap-mailbox-get 'permanentflags mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1749 (member flag (imap-mailbox-get 'permanentflags mailbox))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1750 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1751 (defun imap-message-flags-set (articles flags &optional silent buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1752 (when (and articles flags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1753 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1754 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1755 (concat "UID STORE " articles |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1756 " FLAGS" (if silent ".SILENT") " (" flags ")")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1757 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1758 (defun imap-message-flags-del (articles flags &optional silent buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1759 (when (and articles flags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1760 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1761 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1762 (concat "UID STORE " articles |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1763 " -FLAGS" (if silent ".SILENT") " (" flags ")")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1764 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1765 (defun imap-message-flags-add (articles flags &optional silent buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1766 (when (and articles flags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1767 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1768 (imap-ok-p (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1769 (concat "UID STORE " articles |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1770 " +FLAGS" (if silent ".SILENT") " (" flags ")")))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1771 |
87209 | 1772 ;; Cf. http://thread.gmane.org/gmane.emacs.gnus.general/65317/focus=65343 |
1773 ;; Signal an error if we'd get an integer overflow. | |
1774 ;; | |
1775 ;; FIXME: Identify relevant calls to `string-to-number' and replace them with | |
1776 ;; `imap-string-to-integer'. | |
1777 (defun imap-string-to-integer (string &optional base) | |
1778 (let ((number (string-to-number string base))) | |
1779 (if (> number most-positive-fixnum) | |
1780 (error | |
100993 | 1781 (format "String %s cannot be converted to a Lisp integer" number)) |
87209 | 1782 number))) |
1783 | |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1784 (defun imap-fetch-safe (uids props &optional receive nouidfetch buffer) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1785 "Like `imap-fetch', but DTRT with Exchange 2007 bug. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1786 However, UIDS here is a cons, where the car is the canonical form |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1787 of the UIDS specification, and the cdr is the one which works with |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1788 Exchange 2007 or, potentially, other buggy servers. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1789 See `imap-enable-exchange-bug-workaround'." |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1790 ;; The first time we get here for a given, we'll try the canonical |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1791 ;; form. If we get the known error from the buggy server, set the |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1792 ;; flag buffer-locally (to account for connections to multiple |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1793 ;; servers), then re-try with the alternative UIDS spec. We don't |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1794 ;; unconditionally use the alternative form, since the |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1795 ;; currently-used alternatives are seriously inefficient with some |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1796 ;; servers (although they are valid). |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1797 ;; |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1798 ;; FIXME: Maybe it would be cleaner to have a flag to not signal |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1799 ;; the error (which otherwise gives a message), and test |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1800 ;; `imap-failed-tags'. Also, Other IMAP clients use other forms of |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1801 ;; request which work with Exchange, e.g. Claws does "UID FETCH 1:* |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1802 ;; (UID)" rather than "FETCH UID 1,*". Is there a good reason not |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1803 ;; to do the same? |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1804 (condition-case data |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1805 ;; Binding `debug-on-error' allows us to get the error from |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1806 ;; `imap-parse-response' -- it's normally caught by Emacs around |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1807 ;; execution of a process filter. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1808 (let ((debug-on-error t)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1809 (imap-fetch (if imap-enable-exchange-bug-workaround |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1810 (cdr uids) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1811 (car uids)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1812 props receive nouidfetch buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1813 (error |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1814 (if (and (not imap-enable-exchange-bug-workaround) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1815 ;; This is the Exchange 2007 response. It may be more |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1816 ;; robust just to check for a BAD response to the |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1817 ;; attempted fetch. |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1818 (string-match "The specified message set is invalid" |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1819 (cadr data))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1820 (with-current-buffer (or buffer (current-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1821 (set (make-local-variable 'imap-enable-exchange-bug-workaround) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1822 t) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1823 (imap-fetch (cdr uids) props receive nouidfetch)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1824 (signal (car data) (cdr data)))))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1825 |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1826 (defun imap-message-copyuid-1 (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1827 (if (imap-capability 'UIDPLUS) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1828 (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1829 (string-to-number (nth 2 (imap-mailbox-get-1 'copyuid mailbox)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1830 (let ((old-mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1831 (state imap-state) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1832 (imap-message-data (make-vector 2 0))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1833 (when (imap-mailbox-examine-1 mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1834 (prog1 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1835 (and (imap-fetch-safe '("*" . "*:*") "UID") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1836 (list (imap-mailbox-get-1 'uidvalidity mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1837 (apply 'max (imap-message-map |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1838 (lambda (uid prop) uid) 'UID)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1839 (if old-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1840 (imap-mailbox-select old-mailbox (eq state 'examine)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1841 (imap-mailbox-unselect))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1842 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1843 (defun imap-message-copyuid (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1844 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1845 (imap-message-copyuid-1 (imap-utf7-decode mailbox)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1846 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1847 (defun imap-message-copy (articles mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1848 &optional dont-create no-copyuid buffer) |
100993 | 1849 "Copy ARTICLES to MAILBOX on server in BUFFER. |
1850 ARTICLES is a string message set. Create mailbox if it doesn't exist, | |
1851 unless DONT-CREATE is non-nil. On success, return a list with | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1852 the UIDVALIDITY of the mailbox the article(s) was copied to as the |
100993 | 1853 first element. The rest of list contains the saved articles' UIDs." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1854 (when articles |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1855 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1856 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1857 (if (let ((cmd (concat "UID COPY " articles " \"" mailbox "\"")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1858 (imap-current-target-mailbox mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1859 (if (imap-ok-p (imap-send-command-wait cmd)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1860 t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1861 (when (and (not dont-create) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1862 ;; removed because of buggy Oracle server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1863 ;; that doesn't send TRYCREATE tags (which |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1864 ;; is a MUST according to specifications): |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1865 ;;(imap-mailbox-get-1 'trycreate mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1866 (imap-mailbox-create-1 mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1867 (imap-ok-p (imap-send-command-wait cmd))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1868 (or no-copyuid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1869 (imap-message-copyuid-1 mailbox))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1870 |
100993 | 1871 ;; FIXME: Amalgamate with imap-message-copyuid-1, using an extra arg, since it |
1872 ;; shares most of the code? -- fx | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1873 (defun imap-message-appenduid-1 (mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1874 (if (imap-capability 'UIDPLUS) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1875 (imap-mailbox-get-1 'appenduid mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1876 (let ((old-mailbox imap-current-mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1877 (state imap-state) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1878 (imap-message-data (make-vector 2 0))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1879 (when (imap-mailbox-examine-1 mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1880 (prog1 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
1881 (and (imap-fetch-safe '("*" . "*:*") "UID") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1882 (list (imap-mailbox-get-1 'uidvalidity mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1883 (apply 'max (imap-message-map |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1884 (lambda (uid prop) uid) 'UID)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1885 (if old-mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1886 (imap-mailbox-select old-mailbox (eq state 'examine)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1887 (imap-mailbox-unselect))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1888 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1889 (defun imap-message-appenduid (mailbox &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1890 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1891 (imap-message-appenduid-1 (imap-utf7-encode mailbox)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1892 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1893 (defun imap-message-append (mailbox article &optional flags date-time buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1894 "Append ARTICLE (a buffer) to MAILBOX on server in BUFFER. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1895 FLAGS and DATE-TIME is currently not used. Return a cons holding |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1896 uidvalidity of MAILBOX and UID the newly created article got, or nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1897 on failure." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1898 (let ((mailbox (imap-utf7-encode mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1899 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1900 (and (let ((imap-current-target-mailbox mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1901 (imap-ok-p |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1902 (imap-send-command-wait |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1903 (list "APPEND \"" mailbox "\" " article)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1904 (imap-message-appenduid-1 mailbox))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1905 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1906 (defun imap-body-lines (body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1907 "Return number of lines in article by looking at the mime bodystructure BODY." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1908 (if (listp body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1909 (if (stringp (car body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1910 (cond ((and (string= (upcase (car body)) "TEXT") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1911 (numberp (nth 7 body))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1912 (nth 7 body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1913 ((and (string= (upcase (car body)) "MESSAGE") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1914 (numberp (nth 9 body))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1915 (nth 9 body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1916 (t 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1917 (apply '+ (mapcar 'imap-body-lines body))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1918 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1919 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1920 (defun imap-envelope-from (from) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1921 "Return a from string line." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1922 (and from |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1923 (concat (aref from 0) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1924 (if (aref from 0) " <") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1925 (aref from 2) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1926 "@" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1927 (aref from 3) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1928 (if (aref from 0) ">")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1929 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1930 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1931 ;; Internal functions. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1932 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1933 (defun imap-add-callback (tag func) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1934 (setq imap-callbacks (append (list (cons tag func)) imap-callbacks))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1935 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1936 (defun imap-send-command-1 (cmdstr) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1937 (setq cmdstr (concat cmdstr imap-client-eol)) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
1938 (imap-log cmdstr) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1939 (process-send-string imap-process cmdstr)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1940 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1941 (defun imap-send-command (command &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1942 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1943 (if (not (listp command)) (setq command (list command))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1944 (let ((tag (setq imap-tag (1+ imap-tag))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1945 cmd cmdstr) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1946 (setq cmdstr (concat (number-to-string imap-tag) " ")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1947 (while (setq cmd (pop command)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1948 (cond ((stringp cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1949 (setq cmdstr (concat cmdstr cmd))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1950 ((bufferp cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1951 (let ((eol imap-client-eol) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1952 (calcfirst imap-calculate-literal-size-first) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1953 size) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1954 (with-current-buffer cmd |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1955 (if calcfirst |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1956 (setq size (buffer-size))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1957 (when (not (equal eol "\r\n")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1958 ;; XXX modifies buffer! |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1959 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1960 (while (search-forward "\r\n" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1961 (replace-match eol))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1962 (if (not calcfirst) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1963 (setq size (buffer-size)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1964 (setq cmdstr |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1965 (concat cmdstr (format "{%d}" size)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1966 (unwind-protect |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1967 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1968 (imap-send-command-1 cmdstr) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1969 (setq cmdstr nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1970 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1971 (setq command nil) ;; abort command if no cont-req |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1972 (let ((process imap-process) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1973 (stream imap-stream) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1974 (eol imap-client-eol)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1975 (with-current-buffer cmd |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
1976 (imap-log cmd) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1977 (process-send-region process (point-min) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1978 (point-max))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1979 (process-send-string process imap-client-eol)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1980 (setq imap-continuation nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1981 ((functionp cmd) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1982 (imap-send-command-1 cmdstr) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1983 (setq cmdstr nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1984 (unwind-protect |
104734
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
1985 (setq command |
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
1986 (if (not (eq (imap-wait-for-tag tag) 'INCOMPLETE)) |
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
1987 nil ;; abort command if no cont-req |
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
1988 (cons (funcall cmd imap-continuation) |
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
1989 command))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1990 (setq imap-continuation nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1991 (t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1992 (error "Unknown command type")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1993 (if cmdstr |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1994 (imap-send-command-1 cmdstr)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1995 tag))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1996 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1997 (defun imap-wait-for-tag (tag &optional buffer) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1998 (with-current-buffer (or buffer (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
1999 (let (imap-have-messaged) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2000 (while (and (null imap-continuation) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2001 (memq (process-status imap-process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2002 (< imap-reached-tag tag)) |
104734
714ab1b8092b
(imap-send-command): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101804
diff
changeset
|
2003 (let ((len (/ (buffer-size) 1024)) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2004 message-log-max) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2005 (unless (< len 10) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2006 (setq imap-have-messaged t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2007 (message "imap read: %dk" len)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2008 (accept-process-output imap-process |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2009 (truncate imap-read-timeout) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2010 (truncate (* (- imap-read-timeout |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2011 (truncate imap-read-timeout)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2012 1000))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2013 ;; A process can die _before_ we have processed everything it |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2014 ;; has to say. Moreover, this can happen in between the call to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2015 ;; accept-process-output and the call to process-status in an |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2016 ;; iteration of the loop above. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2017 (when (and (null imap-continuation) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2018 (< imap-reached-tag tag)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2019 (accept-process-output imap-process 0 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2020 (when imap-have-messaged |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2021 (message "")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2022 (and (memq (process-status imap-process) '(open run)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2023 (or (assq tag imap-failed-tags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2024 (if imap-continuation |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2025 'INCOMPLETE |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2026 'OK)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2027 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2028 (defun imap-sentinel (process string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2029 (delete-process process)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2030 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2031 (defun imap-find-next-line () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2032 "Return point at end of current line, taking into account literals. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2033 Return nil if no complete line has arrived." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2034 (when (re-search-forward (concat imap-server-eol "\\|{\\([0-9]+\\)}" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2035 imap-server-eol) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2036 nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2037 (if (match-string 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2038 (if (< (point-max) (+ (point) (string-to-number (match-string 1)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2039 nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2040 (goto-char (+ (point) (string-to-number (match-string 1)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2041 (imap-find-next-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2042 (point)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2043 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2044 (defun imap-arrival-filter (proc string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2045 "IMAP process filter." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2046 ;; Sometimes, we are called even though the process has died. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2047 ;; Better abstain from doing stuff in that case. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2048 (when (buffer-name (process-buffer proc)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2049 (with-current-buffer (process-buffer proc) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2050 (goto-char (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2051 (insert string) |
110210
3d982e5c5f58
pop3.el (pop3-streaming-movemail): Return t for success; imap.el (imap-log): New convenience function used throughout instead of repeating the same code all over the place.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110111
diff
changeset
|
2052 (imap-log string) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2053 (let (end) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2054 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2055 (while (setq end (imap-find-next-line)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2056 (save-restriction |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2057 (narrow-to-region (point-min) end) |
108765
d835100c3e8b
Replace Lisp calls to delete-backward-char by delete-char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108287
diff
changeset
|
2058 (delete-char (- (length imap-server-eol))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2059 (goto-char (point-min)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2060 (unwind-protect |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2061 (cond ((eq imap-state 'initial) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2062 (imap-parse-greeting)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2063 ((or (eq imap-state 'auth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2064 (eq imap-state 'nonauth) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2065 (eq imap-state 'selected) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2066 (eq imap-state 'examine)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2067 (imap-parse-response)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2068 (t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2069 (message "Unknown state %s in arrival filter" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2070 imap-state))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2071 (delete-region (point-min) (point-max))))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2072 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2073 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2074 ;; Imap parser. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2075 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2076 (defsubst imap-forward () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2077 (or (eobp) (forward-char))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2078 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2079 ;; number = 1*DIGIT |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2080 ;; ; Unsigned 32-bit integer |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2081 ;; ; (0 <= n < 4,294,967,296) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2082 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2083 (defsubst imap-parse-number () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2084 (when (looking-at "[0-9]+") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2085 (prog1 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2086 (string-to-number (match-string 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2087 (goto-char (match-end 0))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2088 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2089 ;; literal = "{" number "}" CRLF *CHAR8 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2090 ;; ; Number represents the number of CHAR8s |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2091 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2092 (defsubst imap-parse-literal () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2093 (when (looking-at "{\\([0-9]+\\)}\r\n") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2094 (let ((pos (match-end 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2095 (len (string-to-number (match-string 1)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2096 (if (< (point-max) (+ pos len)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2097 nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2098 (goto-char (+ pos len)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2099 (buffer-substring pos (+ pos len)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2100 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2101 ;; string = quoted / literal |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2102 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2103 ;; quoted = DQUOTE *QUOTED-CHAR DQUOTE |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2104 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2105 ;; QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2106 ;; "\" quoted-specials |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2107 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2108 ;; quoted-specials = DQUOTE / "\" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2109 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2110 ;; TEXT-CHAR = <any CHAR except CR and LF> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2111 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2112 (defsubst imap-parse-string () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2113 (cond ((eq (char-after) ?\") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2114 (forward-char 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2115 (let ((p (point)) (name "")) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2116 (skip-chars-forward "^\"\\\\") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2117 (setq name (buffer-substring p (point))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2118 (while (eq (char-after) ?\\) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2119 (setq p (1+ (point))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2120 (forward-char 2) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2121 (skip-chars-forward "^\"\\\\") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2122 (setq name (concat name (buffer-substring p (point))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2123 (forward-char 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2124 name)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2125 ((eq (char-after) ?{) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2126 (imap-parse-literal)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2127 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2128 ;; nil = "NIL" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2129 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2130 (defsubst imap-parse-nil () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2131 (if (looking-at "NIL") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2132 (goto-char (match-end 0)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2133 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2134 ;; nstring = string / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2135 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2136 (defsubst imap-parse-nstring () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2137 (or (imap-parse-string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2138 (and (imap-parse-nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2139 nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2140 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2141 ;; astring = atom / string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2142 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2143 ;; atom = 1*ATOM-CHAR |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2144 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2145 ;; ATOM-CHAR = <any CHAR except atom-specials> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2146 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2147 ;; atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2148 ;; quoted-specials |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2149 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2150 ;; list-wildcards = "%" / "*" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2151 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2152 ;; quoted-specials = DQUOTE / "\" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2153 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2154 (defsubst imap-parse-astring () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2155 (or (imap-parse-string) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2156 (buffer-substring (point) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2157 (if (re-search-forward "[(){ \r\n%*\"\\]" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2158 (goto-char (1- (match-end 0))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2159 (end-of-line) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2160 (point))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2161 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2162 ;; address = "(" addr-name SP addr-adl SP addr-mailbox SP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2163 ;; addr-host ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2164 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2165 ;; addr-adl = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2166 ;; ; Holds route from [RFC-822] route-addr if |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2167 ;; ; non-nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2168 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2169 ;; addr-host = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2170 ;; ; nil indicates [RFC-822] group syntax. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2171 ;; ; Otherwise, holds [RFC-822] domain name |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2172 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2173 ;; addr-mailbox = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2174 ;; ; nil indicates end of [RFC-822] group; if |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2175 ;; ; non-nil and addr-host is nil, holds |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2176 ;; ; [RFC-822] group name. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2177 ;; ; Otherwise, holds [RFC-822] local-part |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2178 ;; ; after removing [RFC-822] quoting |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2179 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2180 ;; addr-name = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2181 ;; ; If non-nil, holds phrase from [RFC-822] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2182 ;; ; mailbox after removing [RFC-822] quoting |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2183 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2184 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2185 (defsubst imap-parse-address () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2186 (let (address) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2187 (when (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2188 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2189 (setq address (vector (prog1 (imap-parse-nstring) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2190 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2191 (prog1 (imap-parse-nstring) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2192 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2193 (prog1 (imap-parse-nstring) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2194 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2195 (imap-parse-nstring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2196 (when (eq (char-after) ?\)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2197 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2198 address)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2199 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2200 ;; address-list = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2201 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2202 ;; nil = "NIL" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2203 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2204 (defsubst imap-parse-address-list () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2205 (if (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2206 (let (address addresses) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2207 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2208 (while (and (not (eq (char-after) ?\))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2209 ;; next line for MS Exchange bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2210 (progn (and (eq (char-after) ? ) (imap-forward)) t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2211 (setq address (imap-parse-address))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2212 (setq addresses (cons address addresses))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2213 (when (eq (char-after) ?\)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2214 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2215 (nreverse addresses))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2216 ;; With assert, the code might not be eval'd. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2217 ;; (assert (imap-parse-nil) t "In imap-parse-address-list") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2218 (imap-parse-nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2219 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2220 ;; mailbox = "INBOX" / astring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2221 ;; ; INBOX is case-insensitive. All case variants of |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2222 ;; ; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2223 ;; ; not as an astring. An astring which consists of |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2224 ;; ; the case-insensitive sequence "I" "N" "B" "O" "X" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2225 ;; ; is considered to be INBOX and not an astring. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2226 ;; ; Refer to section 5.1 for further |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2227 ;; ; semantic details of mailbox names. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2228 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2229 (defsubst imap-parse-mailbox () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2230 (let ((mailbox (imap-parse-astring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2231 (if (string-equal "INBOX" (upcase mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2232 "INBOX" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2233 mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2234 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2235 ;; greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2236 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2237 ;; resp-cond-auth = ("OK" / "PREAUTH") SP resp-text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2238 ;; ; Authentication condition |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2239 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2240 ;; resp-cond-bye = "BYE" SP resp-text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2241 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2242 (defun imap-parse-greeting () |
100993 | 2243 "Parse an IMAP greeting." |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2244 (cond ((looking-at "\\* OK ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2245 (setq imap-state 'nonauth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2246 ((looking-at "\\* PREAUTH ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2247 (setq imap-state 'auth)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2248 ((looking-at "\\* BYE ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2249 (setq imap-state 'closed)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2250 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2251 ;; response = *(continue-req / response-data) response-done |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2252 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2253 ;; continue-req = "+" SP (resp-text / base64) CRLF |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2254 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2255 ;; response-data = "*" SP (resp-cond-state / resp-cond-bye / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2256 ;; mailbox-data / message-data / capability-data) CRLF |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2257 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2258 ;; response-done = response-tagged / response-fatal |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2259 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2260 ;; response-fatal = "*" SP resp-cond-bye CRLF |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2261 ;; ; Server closes connection immediately |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2262 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2263 ;; response-tagged = tag SP resp-cond-state CRLF |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2264 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2265 ;; resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2266 ;; ; Status condition |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2267 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2268 ;; resp-cond-bye = "BYE" SP resp-text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2269 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2270 ;; mailbox-data = "FLAGS" SP flag-list / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2271 ;; "LIST" SP mailbox-list / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2272 ;; "LSUB" SP mailbox-list / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2273 ;; "SEARCH" *(SP nz-number) / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2274 ;; "STATUS" SP mailbox SP "(" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2275 ;; [status-att SP number *(SP status-att SP number)] ")" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2276 ;; number SP "EXISTS" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2277 ;; number SP "RECENT" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2278 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2279 ;; message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2280 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2281 ;; capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2282 ;; *(SP capability) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2283 ;; ; IMAP4rev1 servers which offer RFC 1730 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2284 ;; ; compatibility MUST list "IMAP4" as the first |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2285 ;; ; capability. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2286 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2287 (defun imap-parse-response () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2288 "Parse a IMAP command response." |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2289 (let (token) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2290 (case (setq token (read (current-buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2291 (+ (setq imap-continuation |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2292 (or (buffer-substring (min (point-max) (1+ (point))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2293 (point-max)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2294 t))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2295 (* (case (prog1 (setq token (read (current-buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2296 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2297 (OK (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2298 (NO (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2299 (BAD (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2300 (BYE (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2301 (FLAGS (imap-mailbox-put 'flags (imap-parse-flag-list))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2302 (LIST (imap-parse-data-list 'list)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2303 (LSUB (imap-parse-data-list 'lsub)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2304 (SEARCH (imap-mailbox-put |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2305 'search |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2306 (read (concat "(" (buffer-substring (point) (point-max)) ")")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2307 (STATUS (imap-parse-status)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2308 (CAPABILITY (setq imap-capability |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2309 (read (concat "(" (upcase (buffer-substring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2310 (point) (point-max))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2311 ")")))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2312 (ID (setq imap-id (read (buffer-substring (point) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2313 (point-max))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2314 (ACL (imap-parse-acl)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2315 (t (case (prog1 (read (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2316 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2317 (EXISTS (imap-mailbox-put 'exists token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2318 (RECENT (imap-mailbox-put 'recent token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2319 (EXPUNGE t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2320 (FETCH (imap-parse-fetch token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2321 (t (message "Garbage: %s" (buffer-string))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2322 (t (let (status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2323 (if (not (integerp token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2324 (message "Garbage: %s" (buffer-string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2325 (case (prog1 (setq status (read (current-buffer))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2326 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2327 (OK (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2328 (setq imap-reached-tag (max imap-reached-tag token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2329 (imap-parse-resp-text))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2330 (NO (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2331 (setq imap-reached-tag (max imap-reached-tag token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2332 (save-excursion |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2333 (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2334 (let (code text) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2335 (when (eq (char-after) ?\[) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2336 (setq code (buffer-substring (point) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2337 (search-forward "]"))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2338 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2339 (setq text (buffer-substring (point) (point-max))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2340 (push (list token status code text) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2341 imap-failed-tags)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2342 (BAD (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2343 (setq imap-reached-tag (max imap-reached-tag token)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2344 (save-excursion |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2345 (imap-parse-resp-text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2346 (let (code text) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2347 (when (eq (char-after) ?\[) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2348 (setq code (buffer-substring (point) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2349 (search-forward "]"))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2350 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2351 (setq text (buffer-substring (point) (point-max))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2352 (push (list token status code text) imap-failed-tags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2353 (error "Internal error, tag %s status %s code %s text %s" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2354 token status code text)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2355 (t (message "Garbage: %s" (buffer-string)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2356 (when (assq token imap-callbacks) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2357 (funcall (cdr (assq token imap-callbacks)) token status) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2358 (setq imap-callbacks |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2359 (imap-remassoc token imap-callbacks))))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2360 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2361 ;; resp-text = ["[" resp-text-code "]" SP] text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2362 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2363 ;; text = 1*TEXT-CHAR |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2364 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2365 ;; TEXT-CHAR = <any CHAR except CR and LF> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2366 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2367 (defun imap-parse-resp-text () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2368 (imap-parse-resp-text-code)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2369 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2370 ;; resp-text-code = "ALERT" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2371 ;; "BADCHARSET [SP "(" astring *(SP astring) ")" ] / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2372 ;; "NEWNAME" SP string SP string / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2373 ;; "PARSE" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2374 ;; "PERMANENTFLAGS" SP "(" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2375 ;; [flag-perm *(SP flag-perm)] ")" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2376 ;; "READ-ONLY" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2377 ;; "READ-WRITE" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2378 ;; "TRYCREATE" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2379 ;; "UIDNEXT" SP nz-number / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2380 ;; "UIDVALIDITY" SP nz-number / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2381 ;; "UNSEEN" SP nz-number / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2382 ;; resp-text-atom [SP 1*<any TEXT-CHAR except "]">] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2383 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2384 ;; resp_code_apnd = "APPENDUID" SPACE nz_number SPACE uniqueid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2385 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2386 ;; resp_code_copy = "COPYUID" SPACE nz_number SPACE set SPACE set |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2387 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2388 ;; set = sequence-num / (sequence-num ":" sequence-num) / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2389 ;; (set "," set) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2390 ;; ; Identifies a set of messages. For message |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2391 ;; ; sequence numbers, these are consecutive |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2392 ;; ; numbers from 1 to the number of messages in |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2393 ;; ; the mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2394 ;; ; Comma delimits individual numbers, colon |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2395 ;; ; delimits between two numbers inclusive. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2396 ;; ; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13, |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2397 ;; ; 14,15 for a mailbox with 15 messages. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2398 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2399 ;; sequence-num = nz-number / "*" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2400 ;; ; * is the largest number in use. For message |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2401 ;; ; sequence numbers, it is the number of messages |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2402 ;; ; in the mailbox. For unique identifiers, it is |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2403 ;; ; the unique identifier of the last message in |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2404 ;; ; the mailbox. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2405 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2406 ;; flag-perm = flag / "\*" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2407 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2408 ;; flag = "\Answered" / "\Flagged" / "\Deleted" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2409 ;; "\Seen" / "\Draft" / flag-keyword / flag-extension |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2410 ;; ; Does not include "\Recent" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2411 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2412 ;; flag-extension = "\" atom |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2413 ;; ; Future expansion. Client implementations |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2414 ;; ; MUST accept flag-extension flags. Server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2415 ;; ; implementations MUST NOT generate |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2416 ;; ; flag-extension flags except as defined by |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2417 ;; ; future standard or standards-track |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2418 ;; ; revisions of this specification. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2419 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2420 ;; flag-keyword = atom |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2421 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2422 ;; resp-text-atom = 1*<any ATOM-CHAR except "]"> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2423 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2424 (defun imap-parse-resp-text-code () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2425 ;; xxx next line for stalker communigate pro 3.3.1 bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2426 (when (looking-at " \\[") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2427 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2428 (when (eq (char-after) ?\[) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2429 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2430 (cond ((search-forward "PERMANENTFLAGS " nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2431 (imap-mailbox-put 'permanentflags (imap-parse-flag-list))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2432 ((search-forward "UIDNEXT \\([0-9]+\\)" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2433 (imap-mailbox-put 'uidnext (match-string 1))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2434 ((search-forward "UNSEEN " nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2435 (imap-mailbox-put 'first-unseen (read (current-buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2436 ((looking-at "UIDVALIDITY \\([0-9]+\\)") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2437 (imap-mailbox-put 'uidvalidity (match-string 1))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2438 ((search-forward "READ-ONLY" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2439 (imap-mailbox-put 'read-only t)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2440 ((search-forward "NEWNAME " nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2441 (let (oldname newname) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2442 (setq oldname (imap-parse-string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2443 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2444 (setq newname (imap-parse-string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2445 (imap-mailbox-put 'newname newname oldname))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2446 ((search-forward "TRYCREATE" nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2447 (imap-mailbox-put 'trycreate t imap-current-target-mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2448 ((looking-at "APPENDUID \\([0-9]+\\) \\([0-9]+\\)") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2449 (imap-mailbox-put 'appenduid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2450 (list (match-string 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2451 (string-to-number (match-string 2))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2452 imap-current-target-mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2453 ((looking-at "COPYUID \\([0-9]+\\) \\([0-9,:]+\\) \\([0-9,:]+\\)") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2454 (imap-mailbox-put 'copyuid (list (match-string 1) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2455 (match-string 2) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2456 (match-string 3)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2457 imap-current-target-mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2458 ((search-forward "ALERT] " nil t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2459 (message "Imap server %s information: %s" imap-server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2460 (buffer-substring (point) (point-max))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2461 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2462 ;; mailbox-list = "(" [mbx-list-flags] ")" SP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2463 ;; (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2464 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2465 ;; mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2466 ;; *(SP mbx-list-oflag) / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2467 ;; mbx-list-oflag *(SP mbx-list-oflag) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2468 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2469 ;; mbx-list-oflag = "\Noinferiors" / flag-extension |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2470 ;; ; Other flags; multiple possible per LIST response |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2471 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2472 ;; mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2473 ;; ; Selectability flags; only one per LIST response |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2474 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2475 ;; QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2476 ;; "\" quoted-specials |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2477 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2478 ;; quoted-specials = DQUOTE / "\" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2479 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2480 (defun imap-parse-data-list (type) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2481 (let (flags delimiter mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2482 (setq flags (imap-parse-flag-list)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2483 (when (looking-at " NIL\\| \"\\\\?\\(.\\)\"") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2484 (setq delimiter (match-string 1)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2485 (goto-char (1+ (match-end 0))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2486 (when (setq mailbox (imap-parse-mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2487 (imap-mailbox-put type t mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2488 (imap-mailbox-put 'list-flags flags mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2489 (imap-mailbox-put 'delimiter delimiter mailbox))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2490 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2491 ;; msg_att ::= "(" 1#("ENVELOPE" SPACE envelope / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2492 ;; "FLAGS" SPACE "(" #(flag / "\Recent") ")" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2493 ;; "INTERNALDATE" SPACE date_time / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2494 ;; "RFC822" [".HEADER" / ".TEXT"] SPACE nstring / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2495 ;; "RFC822.SIZE" SPACE number / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2496 ;; "BODY" ["STRUCTURE"] SPACE body / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2497 ;; "BODY" section ["<" number ">"] SPACE nstring / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2498 ;; "UID" SPACE uniqueid) ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2499 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2500 ;; date_time ::= <"> date_day_fixed "-" date_month "-" date_year |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2501 ;; SPACE time SPACE zone <"> |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2502 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2503 ;; section ::= "[" [section_text / (nz_number *["." nz_number] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2504 ;; ["." (section_text / "MIME")])] "]" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2505 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2506 ;; section_text ::= "HEADER" / "HEADER.FIELDS" [".NOT"] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2507 ;; SPACE header_list / "TEXT" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2508 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2509 ;; header_fld_name ::= astring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2510 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2511 ;; header_list ::= "(" 1#header_fld_name ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2512 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2513 (defsubst imap-parse-header-list () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2514 (when (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2515 (let (strlist) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2516 (while (not (eq (char-after) ?\))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2517 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2518 (push (imap-parse-astring) strlist)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2519 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2520 (nreverse strlist)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2521 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2522 (defsubst imap-parse-fetch-body-section () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2523 (let ((section |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2524 (buffer-substring (point) (1- (re-search-forward "[] ]" nil t))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2525 (if (eq (char-before) ? ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2526 (prog1 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2527 (mapconcat 'identity (cons section (imap-parse-header-list)) " ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2528 (search-forward "]" nil t)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2529 section))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2530 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2531 (defun imap-parse-fetch (response) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2532 (when (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2533 (let (uid flags envelope internaldate rfc822 rfc822header rfc822text |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2534 rfc822size body bodydetail bodystructure flags-empty) |
100874
8698a8bb7d0e
Gnus: Add explanations for recent changes to the code itself.
Michael Olson <mwolson@gnu.org>
parents:
100871
diff
changeset
|
2535 ;; Courier can insert spurious blank characters which will |
8698a8bb7d0e
Gnus: Add explanations for recent changes to the code itself.
Michael Olson <mwolson@gnu.org>
parents:
100871
diff
changeset
|
2536 ;; confuse `read', so skip past them. |
100871
1d5b4a08955f
Gnus: Fix edge cases with no data being returned and Courier eccentricity.
Michael Olson <mwolson@gnu.org>
parents:
94677
diff
changeset
|
2537 (while (let ((moved (skip-chars-forward " \t"))) |
1d5b4a08955f
Gnus: Fix edge cases with no data being returned and Courier eccentricity.
Michael Olson <mwolson@gnu.org>
parents:
94677
diff
changeset
|
2538 (prog1 (not (eq (char-after) ?\))) |
1d5b4a08955f
Gnus: Fix edge cases with no data being returned and Courier eccentricity.
Michael Olson <mwolson@gnu.org>
parents:
94677
diff
changeset
|
2539 (unless (= moved 0) (backward-char)))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2540 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2541 (let ((token (read (current-buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2542 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2543 (cond ((eq token 'UID) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2544 (setq uid (condition-case () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2545 (read (current-buffer)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2546 (error)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2547 ((eq token 'FLAGS) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2548 (setq flags (imap-parse-flag-list)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2549 (if (not flags) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2550 (setq flags-empty 't))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2551 ((eq token 'ENVELOPE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2552 (setq envelope (imap-parse-envelope))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2553 ((eq token 'INTERNALDATE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2554 (setq internaldate (imap-parse-string))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2555 ((eq token 'RFC822) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2556 (setq rfc822 (imap-parse-nstring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2557 ((eq token 'RFC822.HEADER) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2558 (setq rfc822header (imap-parse-nstring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2559 ((eq token 'RFC822.TEXT) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2560 (setq rfc822text (imap-parse-nstring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2561 ((eq token 'RFC822.SIZE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2562 (setq rfc822size (read (current-buffer)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2563 ((eq token 'BODY) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2564 (if (eq (char-before) ?\[) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2565 (push (list |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2566 (upcase (imap-parse-fetch-body-section)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2567 (and (eq (char-after) ?<) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2568 (buffer-substring (1+ (point)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2569 (search-forward ">" nil t))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2570 (progn (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2571 (imap-parse-nstring))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2572 bodydetail) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2573 (setq body (imap-parse-body)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2574 ((eq token 'BODYSTRUCTURE) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2575 (setq bodystructure (imap-parse-body)))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2576 (when uid |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2577 (setq imap-current-message uid) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2578 (imap-message-put uid 'UID uid) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2579 (and (or flags flags-empty) (imap-message-put uid 'FLAGS flags)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2580 (and envelope (imap-message-put uid 'ENVELOPE envelope)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2581 (and internaldate (imap-message-put uid 'INTERNALDATE internaldate)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2582 (and rfc822 (imap-message-put uid 'RFC822 rfc822)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2583 (and rfc822header (imap-message-put uid 'RFC822.HEADER rfc822header)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2584 (and rfc822text (imap-message-put uid 'RFC822.TEXT rfc822text)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2585 (and rfc822size (imap-message-put uid 'RFC822.SIZE rfc822size)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2586 (and body (imap-message-put uid 'BODY body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2587 (and bodydetail (imap-message-put uid 'BODYDETAIL bodydetail)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2588 (and bodystructure (imap-message-put uid 'BODYSTRUCTURE bodystructure)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2589 (run-hooks 'imap-fetch-data-hook))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2590 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2591 ;; mailbox-data = ... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2592 ;; "STATUS" SP mailbox SP "(" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2593 ;; [status-att SP number |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2594 ;; *(SP status-att SP number)] ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2595 ;; ... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2596 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2597 ;; status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2598 ;; "UNSEEN" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2599 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2600 (defun imap-parse-status () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2601 (let ((mailbox (imap-parse-mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2602 (if (eq (char-after) ? ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2603 (forward-char)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2604 (when (and mailbox (eq (char-after) ?\()) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2605 (while (and (not (eq (char-after) ?\))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2606 (or (forward-char) t) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2607 (looking-at "\\([A-Za-z]+\\) ")) |
87097 | 2608 (let ((token (upcase (match-string 1)))) |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2609 (goto-char (match-end 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2610 (cond ((string= token "MESSAGES") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2611 (imap-mailbox-put 'messages (read (current-buffer)) mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2612 ((string= token "RECENT") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2613 (imap-mailbox-put 'recent (read (current-buffer)) mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2614 ((string= token "UIDNEXT") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2615 (and (looking-at "[0-9]+") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2616 (imap-mailbox-put 'uidnext (match-string 0) mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2617 (goto-char (match-end 0)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2618 ((string= token "UIDVALIDITY") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2619 (and (looking-at "[0-9]+") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2620 (imap-mailbox-put 'uidvalidity (match-string 0) mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2621 (goto-char (match-end 0)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2622 ((string= token "UNSEEN") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2623 (imap-mailbox-put 'unseen (read (current-buffer)) mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2624 (t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2625 (message "Unknown status data %s in mailbox %s ignored" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2626 token mailbox) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2627 (read (current-buffer))))))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2628 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2629 ;; acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2630 ;; rights) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2631 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2632 ;; identifier ::= astring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2633 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2634 ;; rights ::= astring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2635 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2636 (defun imap-parse-acl () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2637 (let ((mailbox (imap-parse-mailbox)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2638 identifier rights acl) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2639 (while (eq (char-after) ?\ ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2640 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2641 (setq identifier (imap-parse-astring)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2642 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2643 (setq rights (imap-parse-astring)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2644 (setq acl (append acl (list (cons identifier rights))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2645 (imap-mailbox-put 'acl acl mailbox))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2646 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2647 ;; flag-list = "(" [flag *(SP flag)] ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2648 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2649 ;; flag = "\Answered" / "\Flagged" / "\Deleted" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2650 ;; "\Seen" / "\Draft" / flag-keyword / flag-extension |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2651 ;; ; Does not include "\Recent" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2652 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2653 ;; flag-keyword = atom |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2654 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2655 ;; flag-extension = "\" atom |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2656 ;; ; Future expansion. Client implementations |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2657 ;; ; MUST accept flag-extension flags. Server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2658 ;; ; implementations MUST NOT generate |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2659 ;; ; flag-extension flags except as defined by |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2660 ;; ; future standard or standards-track |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2661 ;; ; revisions of this specification. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2662 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2663 (defun imap-parse-flag-list () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2664 (let (flag-list start) |
100993 | 2665 (assert (eq (char-after) ?\() nil "In imap-parse-flag-list 1") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2666 (while (and (not (eq (char-after) ?\))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2667 (setq start (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2668 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2669 ;; next line for Courier IMAP bug. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2670 (skip-chars-forward " ") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2671 (point))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2672 (> (skip-chars-forward "^ )" (point-at-eol)) 0)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2673 (push (buffer-substring start (point)) flag-list)) |
100993 | 2674 (assert (eq (char-after) ?\)) nil "In imap-parse-flag-list 2") |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2675 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2676 (nreverse flag-list))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2677 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2678 ;; envelope = "(" env-date SP env-subject SP env-from SP env-sender SP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2679 ;; env-reply-to SP env-to SP env-cc SP env-bcc SP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2680 ;; env-in-reply-to SP env-message-id ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2681 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2682 ;; env-bcc = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2683 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2684 ;; env-cc = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2685 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2686 ;; env-date = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2687 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2688 ;; env-from = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2689 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2690 ;; env-in-reply-to = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2691 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2692 ;; env-message-id = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2693 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2694 ;; env-reply-to = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2695 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2696 ;; env-sender = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2697 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2698 ;; env-subject = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2699 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2700 ;; env-to = "(" 1*address ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2701 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2702 (defun imap-parse-envelope () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2703 (when (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2704 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2705 (vector (prog1 (imap-parse-nstring) ;; date |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2706 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2707 (prog1 (imap-parse-nstring) ;; subject |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2708 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2709 (prog1 (imap-parse-address-list) ;; from |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2710 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2711 (prog1 (imap-parse-address-list) ;; sender |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2712 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2713 (prog1 (imap-parse-address-list) ;; reply-to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2714 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2715 (prog1 (imap-parse-address-list) ;; to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2716 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2717 (prog1 (imap-parse-address-list) ;; cc |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2718 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2719 (prog1 (imap-parse-address-list) ;; bcc |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2720 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2721 (prog1 (imap-parse-nstring) ;; in-reply-to |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2722 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2723 (prog1 (imap-parse-nstring) ;; message-id |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2724 (imap-forward))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2725 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2726 ;; body-fld-param = "(" string SP string *(SP string SP string) ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2727 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2728 (defsubst imap-parse-string-list () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2729 (cond ((eq (char-after) ?\() ;; body-fld-param |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2730 (let (strlist str) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2731 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2732 (while (setq str (imap-parse-string)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2733 (push str strlist) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2734 ;; buggy stalker communigate pro 3.0 doesn't print SPC |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2735 ;; between body-fld-param's sometimes |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2736 (or (eq (char-after) ?\") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2737 (imap-forward))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2738 (nreverse strlist))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2739 ((imap-parse-nil) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2740 nil))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2741 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2742 ;; body-extension = nstring / number / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2743 ;; "(" body-extension *(SP body-extension) ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2744 ;; ; Future expansion. Client implementations |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2745 ;; ; MUST accept body-extension fields. Server |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2746 ;; ; implementations MUST NOT generate |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2747 ;; ; body-extension fields except as defined by |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2748 ;; ; future standard or standards-track |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2749 ;; ; revisions of this specification. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2750 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2751 (defun imap-parse-body-extension () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2752 (if (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2753 (let (b-e) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2754 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2755 (push (imap-parse-body-extension) b-e) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2756 (while (eq (char-after) ?\ ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2757 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2758 (push (imap-parse-body-extension) b-e)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2759 (assert (eq (char-after) ?\)) nil "In imap-parse-body-extension") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2760 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2761 (nreverse b-e)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2762 (or (imap-parse-number) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2763 (imap-parse-nstring)))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2764 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2765 ;; body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2766 ;; *(SP body-extension)]] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2767 ;; ; MUST NOT be returned on non-extensible |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2768 ;; ; "BODY" fetch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2769 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2770 ;; body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2771 ;; *(SP body-extension)]] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2772 ;; ; MUST NOT be returned on non-extensible |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2773 ;; ; "BODY" fetch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2774 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2775 (defsubst imap-parse-body-ext () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2776 (let (ext) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2777 (when (eq (char-after) ?\ ) ;; body-fld-dsp |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2778 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2779 (let (dsp) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2780 (if (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2781 (progn |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2782 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2783 (push (imap-parse-string) dsp) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2784 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2785 (push (imap-parse-string-list) dsp) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2786 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2787 ;; With assert, the code might not be eval'd. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2788 ;; (assert (imap-parse-nil) t "In imap-parse-body-ext") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2789 (imap-parse-nil)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2790 (push (nreverse dsp) ext)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2791 (when (eq (char-after) ?\ ) ;; body-fld-lang |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2792 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2793 (if (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2794 (push (imap-parse-string-list) ext) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2795 (push (imap-parse-nstring) ext)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2796 (while (eq (char-after) ?\ ) ;; body-extension |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2797 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2798 (setq ext (append (imap-parse-body-extension) ext))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2799 ext)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2800 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2801 ;; body = "(" body-type-1part / body-type-mpart ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2802 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2803 ;; body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2804 ;; *(SP body-extension)]] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2805 ;; ; MUST NOT be returned on non-extensible |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2806 ;; ; "BODY" fetch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2807 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2808 ;; body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2809 ;; *(SP body-extension)]] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2810 ;; ; MUST NOT be returned on non-extensible |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2811 ;; ; "BODY" fetch |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2812 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2813 ;; body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2814 ;; body-fld-enc SP body-fld-octets |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2815 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2816 ;; body-fld-desc = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2817 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2818 ;; body-fld-dsp = "(" string SP body-fld-param ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2819 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2820 ;; body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/ |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2821 ;; "QUOTED-PRINTABLE") DQUOTE) / string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2822 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2823 ;; body-fld-id = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2824 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2825 ;; body-fld-lang = nstring / "(" string *(SP string) ")" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2826 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2827 ;; body-fld-lines = number |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2828 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2829 ;; body-fld-md5 = nstring |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2830 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2831 ;; body-fld-octets = number |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2832 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2833 ;; body-fld-param = "(" string SP string *(SP string SP string) ")" / nil |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2834 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2835 ;; body-type-1part = (body-type-basic / body-type-msg / body-type-text) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2836 ;; [SP body-ext-1part] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2837 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2838 ;; body-type-basic = media-basic SP body-fields |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2839 ;; ; MESSAGE subtype MUST NOT be "RFC822" |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2840 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2841 ;; body-type-msg = media-message SP body-fields SP envelope |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2842 ;; SP body SP body-fld-lines |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2843 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2844 ;; body-type-text = media-text SP body-fields SP body-fld-lines |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2845 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2846 ;; body-type-mpart = 1*body SP media-subtype |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2847 ;; [SP body-ext-mpart] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2848 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2849 ;; media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2850 ;; "MESSAGE" / "VIDEO") DQUOTE) / string) SP media-subtype |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2851 ;; ; Defined in [MIME-IMT] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2852 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2853 ;; media-message = DQUOTE "MESSAGE" DQUOTE SP DQUOTE "RFC822" DQUOTE |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2854 ;; ; Defined in [MIME-IMT] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2855 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2856 ;; media-subtype = string |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2857 ;; ; Defined in [MIME-IMT] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2858 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2859 ;; media-text = DQUOTE "TEXT" DQUOTE SP media-subtype |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2860 ;; ; Defined in [MIME-IMT] |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2861 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2862 (defun imap-parse-body () |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2863 (let (body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2864 (when (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2865 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2866 (if (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2867 (let (subbody) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2868 (while (and (eq (char-after) ?\() |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2869 (setq subbody (imap-parse-body))) |
100993 | 2870 ;; buggy stalker communigate pro 3.0 inserts a SPC between |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2871 ;; parts in multiparts |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2872 (when (and (eq (char-after) ?\ ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2873 (eq (char-after (1+ (point))) ?\()) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2874 (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2875 (push subbody body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2876 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2877 (push (imap-parse-string) body) ;; media-subtype |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2878 (when (eq (char-after) ?\ ) ;; body-ext-mpart: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2879 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2880 (if (eq (char-after) ?\() ;; body-fld-param |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2881 (push (imap-parse-string-list) body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2882 (push (and (imap-parse-nil) nil) body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2883 (setq body |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2884 (append (imap-parse-body-ext) body))) ;; body-ext-... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2885 (assert (eq (char-after) ?\)) nil "In imap-parse-body") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2886 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2887 (nreverse body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2888 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2889 (push (imap-parse-string) body) ;; media-type |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2890 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2891 (push (imap-parse-string) body) ;; media-subtype |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2892 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2893 ;; next line for Sun SIMS bug |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2894 (and (eq (char-after) ? ) (imap-forward)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2895 (if (eq (char-after) ?\() ;; body-fld-param |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2896 (push (imap-parse-string-list) body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2897 (push (and (imap-parse-nil) nil) body)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2898 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2899 (push (imap-parse-nstring) body) ;; body-fld-id |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2900 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2901 (push (imap-parse-nstring) body) ;; body-fld-desc |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2902 (imap-forward) |
100993 | 2903 ;; Next `or' for Sun SIMS bug. It regards body-fld-enc as a |
2904 ;; nstring and returns nil instead of defaulting back to 7BIT | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2905 ;; as the standard says. |
100993 | 2906 ;; Exchange (2007, at least) does this as well. |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2907 (push (or (imap-parse-nstring) "7BIT") body) ;; body-fld-enc |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2908 (imap-forward) |
100993 | 2909 ;; Exchange 2007 can return -1, contrary to the spec... |
2910 (if (eq (char-after) ?-) | |
2911 (progn | |
2912 (skip-chars-forward "-0-9") | |
2913 (push nil body)) | |
2914 (push (imap-parse-number) body)) ;; body-fld-octets | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2915 |
100993 | 2916 ;; Ok, we're done parsing the required parts, what comes now is one of |
2917 ;; three things: | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2918 ;; |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2919 ;; envelope (then we're parsing body-type-msg) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2920 ;; body-fld-lines (then we're parsing body-type-text) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2921 ;; body-ext-1part (then we're parsing body-type-basic) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2922 ;; |
100993 | 2923 ;; The problem is that the two first are in turn optionally followed |
2924 ;; by the third. So we parse the first two here (if there are any)... | |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2925 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2926 (when (eq (char-after) ?\ ) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2927 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2928 (let (lines) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2929 (cond ((eq (char-after) ?\() ;; body-type-msg: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2930 (push (imap-parse-envelope) body) ;; envelope |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2931 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2932 (push (imap-parse-body) body) ;; body |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2933 ;; buggy stalker communigate pro 3.0 doesn't print |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2934 ;; number of lines in message/rfc822 attachment |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2935 (if (eq (char-after) ?\)) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2936 (push 0 body) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2937 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2938 (push (imap-parse-number) body))) ;; body-fld-lines |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2939 ((setq lines (imap-parse-number)) ;; body-type-text: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2940 (push lines body)) ;; body-fld-lines |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2941 (t |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2942 (backward-char))))) ;; no match... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2943 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2944 ;; ...and then parse the third one here... |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2945 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2946 (when (eq (char-after) ?\ ) ;; body-ext-1part: |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2947 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2948 (push (imap-parse-nstring) body) ;; body-fld-md5 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2949 (setq body (append (imap-parse-body-ext) body))) ;; body-ext-1part.. |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2950 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2951 (assert (eq (char-after) ?\)) nil "In imap-parse-body 2") |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2952 (imap-forward) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2953 (nreverse body))))) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
2954 |
110369
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2955 (when imap-debug ; (untrace-all) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2956 (require 'trace) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2957 (buffer-disable-undo (get-buffer-create imap-debug-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2958 (mapc (lambda (f) (trace-function-background f imap-debug-buffer)) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2959 '( |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2960 imap-utf7-encode |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2961 imap-utf7-decode |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2962 imap-error-text |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2963 imap-kerberos4s-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2964 imap-kerberos4-open |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2965 imap-ssl-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2966 imap-ssl-open |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2967 imap-network-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2968 imap-network-open |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2969 imap-interactive-login |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2970 imap-kerberos4a-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2971 imap-kerberos4-auth |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2972 imap-cram-md5-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2973 imap-cram-md5-auth |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2974 imap-login-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2975 imap-login-auth |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2976 imap-anonymous-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2977 imap-anonymous-auth |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2978 imap-open-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2979 imap-open |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2980 imap-opened |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2981 imap-ping-server |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2982 imap-authenticate |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2983 imap-close |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2984 imap-capability |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2985 imap-namespace |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2986 imap-send-command-wait |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2987 imap-mailbox-put |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2988 imap-mailbox-get |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2989 imap-mailbox-map-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2990 imap-mailbox-map |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2991 imap-current-mailbox |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2992 imap-current-mailbox-p-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2993 imap-current-mailbox-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2994 imap-mailbox-select-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2995 imap-mailbox-select |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2996 imap-mailbox-examine-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2997 imap-mailbox-examine |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2998 imap-mailbox-unselect |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
2999 imap-mailbox-expunge |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3000 imap-mailbox-close |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3001 imap-mailbox-create-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3002 imap-mailbox-create |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3003 imap-mailbox-delete |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3004 imap-mailbox-rename |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3005 imap-mailbox-lsub |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3006 imap-mailbox-list |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3007 imap-mailbox-subscribe |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3008 imap-mailbox-unsubscribe |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3009 imap-mailbox-status |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3010 imap-mailbox-acl-get |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3011 imap-mailbox-acl-set |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3012 imap-mailbox-acl-delete |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3013 imap-current-message |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3014 imap-list-to-message-set |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3015 imap-fetch-asynch |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3016 imap-fetch |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3017 imap-fetch-safe |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3018 imap-message-put |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3019 imap-message-get |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3020 imap-message-map |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3021 imap-search |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3022 imap-message-flag-permanent-p |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3023 imap-message-flags-set |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3024 imap-message-flags-del |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3025 imap-message-flags-add |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3026 imap-message-copyuid-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3027 imap-message-copyuid |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3028 imap-message-copy |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3029 imap-message-appenduid-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3030 imap-message-appenduid |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3031 imap-message-append |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3032 imap-body-lines |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3033 imap-envelope-from |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3034 imap-send-command-1 |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3035 imap-send-command |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3036 imap-wait-for-tag |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3037 imap-sentinel |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3038 imap-find-next-line |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3039 imap-arrival-filter |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3040 imap-parse-greeting |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3041 imap-parse-response |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3042 imap-parse-resp-text |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3043 imap-parse-resp-text-code |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3044 imap-parse-data-list |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3045 imap-parse-fetch |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3046 imap-parse-status |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3047 imap-parse-acl |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3048 imap-parse-flag-list |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3049 imap-parse-envelope |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3050 imap-parse-body-extension |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3051 imap-parse-body |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3052 ))) |
fb6801a4089a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110216
diff
changeset
|
3053 |
86442
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
3054 (provide 'imap) |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
3055 |
3082569ef3c5
Move imap.el from lisp/gnus/ to lisp/net/.
Simon Josefsson <jas@extundo.com>
parents:
diff
changeset
|
3056 ;;; imap.el ends here |