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