Mercurial > emacs
annotate lisp/gnus/nnimap.el @ 82980:08aac74a5b90
Remove Gnus image files now in lisp/gnus
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 04 Sep 2004 11:40:51 +0000 |
parents | 5ef78f4dd84f |
children |
rev | line source |
---|---|
31717 | 1 ;;; nnimap.el --- imap backend for Gnus |
82970
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
2 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
31717 | 4 |
5 ;; Author: Simon Josefsson <jas@pdc.kth.se> | |
6 ;; Jim Radford <radford@robby.caltech.edu> | |
7 ;; Keywords: mail | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; Todo, major things: | |
29 ;; | |
30 ;; o Fix Gnus to view correct number of unread/total articles in group buffer | |
31 ;; o Fix Gnus to handle leading '.' in group names (fixed?) | |
32 ;; o Finish disconnected mode (moving articles between mailboxes unplugged) | |
33 ;; o Sieve | |
34 ;; o MIME (partial article fetches) | |
35 ;; o Split to other backends, different split rules for different | |
36 ;; servers/inboxes | |
37 ;; | |
38 ;; Todo, minor things: | |
39 ;; | |
40 ;; o Don't require half of Gnus -- backends should be standalone | |
41 ;; o Verify that we don't use IMAP4rev1 specific things (RFC2060 App B) | |
42 ;; o Dont uid fetch 1,* in nnimap-retrive-groups (slow) | |
43 ;; o Split up big fetches (1,* header especially) in smaller chunks | |
44 ;; o What do I do with gnus-newsgroup-*? | |
45 ;; o Tell Gnus about new groups (how can we tell?) | |
48588 | 46 ;; o Respooling (fix Gnus?) (unnecessary?) |
31717 | 47 ;; o Add support for the following: (if applicable) |
48 ;; request-list-newsgroups, request-regenerate | |
49 ;; list-active-group, | |
50 ;; request-associate-buffer, request-restore-buffer, | |
51 ;; o Do The Right Thing when UIDVALIDITY changes (what's the right thing?) | |
52 ;; o Support RFC2221 (Login referrals) | |
53 ;; o IMAP2BIS compatibility? (RFC2061) | |
54 ;; o ACAP stuff (perhaps a different project, would be nice to ACAPify | |
55 ;; .newsrc.eld) | |
56 ;; o What about Gnus's article editing, can we support it? NO! | |
57 ;; o Use \Draft to support the draft group?? | |
58 ;; o Duplicate suppression | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
59 ;; o Rewrite UID SEARCH UID X as UID FETCH X (UID) for those with slow servers |
31717 | 60 |
61 ;;; Code: | |
62 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
63 (require 'imap) |
31717 | 64 (require 'nnoo) |
65 (require 'nnmail) | |
66 (require 'nnheader) | |
67 (require 'mm-util) | |
68 (require 'gnus) | |
69 (require 'gnus-range) | |
70 (require 'gnus-start) | |
71 (require 'gnus-int) | |
72 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
73 (eval-when-compile (require 'cl)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
74 |
31717 | 75 (nnoo-declare nnimap) |
76 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
77 (defconst nnimap-version "nnimap 1.0") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
78 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
79 (defgroup nnimap nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
80 "Reading IMAP mail with Gnus." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
81 :group 'gnus) |
31717 | 82 |
83 (defvoo nnimap-address nil | |
84 "Address of physical IMAP server. If nil, use the virtual server's name.") | |
85 | |
86 (defvoo nnimap-server-port nil | |
87 "Port number on physical IMAP server. | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
88 If nil, defaults to 993 for TLS/SSL connections and 143 otherwise.") |
31717 | 89 |
90 ;; Splitting variables | |
91 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
92 (defcustom nnimap-split-crosspost t |
31717 | 93 "If non-nil, do crossposting if several split methods match the mail. |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
94 If nil, the first match found will be used." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
95 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
96 :type 'boolean) |
31717 | 97 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
98 (defcustom nnimap-split-inbox nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
99 "Name of mailbox to split mail from. |
31717 | 100 |
101 Mail is read from this mailbox and split according to rules in | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
102 `nnimap-split-rule'. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
103 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
104 This can be a string or a list of strings." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
105 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
106 :type '(choice (string) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
107 (repeat string))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
108 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
109 (define-widget 'nnimap-strict-function 'function |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
110 "This widget only matches values that are functionp. |
31717 | 111 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
112 Warning: This means that a value that is the symbol of a not yet |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
113 loaded function will not match. Use with care." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
114 :match 'nnimap-strict-function-match) |
31717 | 115 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
116 (defun nnimap-strict-function-match (widget value) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
117 "Ignoring WIDGET, match if VALUE is a function." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
118 (functionp value)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
119 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
120 (defcustom nnimap-split-rule nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
121 "Mail will be split according to these rules. |
31717 | 122 |
123 Mail is read from mailbox(es) specified in `nnimap-split-inbox'. | |
124 | |
125 If you'd like, for instance, one mail group for mail from the | |
126 \"gnus-imap\" mailing list, one group for junk mail and leave | |
127 everything else in the incoming mailbox, you could do something like | |
128 this: | |
129 | |
48216
e5026995ea82
(nnimap-split-rule): Doc fix - escape open parens in column 0.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
44512
diff
changeset
|
130 \(setq nnimap-split-rule '((\"INBOX.gnus-imap\" \"From:.*gnus-imap\") |
31717 | 131 (\"INBOX.junk\" \"Subject:.*buy\"))) |
132 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
133 As you can see, `nnimap-split-rule' is a list of lists, where the |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
134 first element in each \"rule\" is the name of the IMAP mailbox (or the |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
135 symbol `junk' if you want to remove the mail), and the second is a |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
136 regexp that nnimap will try to match on the header to find a fit. |
31717 | 137 |
138 The second element can also be a function. In that case, it will be | |
139 called narrowed to the headers with the first element of the rule as | |
140 the argument. It should return a non-nil value if it thinks that the | |
141 mail belongs in that group. | |
142 | |
143 This variable can also have a function as its value, the function will | |
144 be called with the headers narrowed and should return a group where it | |
145 thinks the article should be splitted to. See `nnimap-split-fancy'. | |
146 | |
147 To allow for different split rules on different virtual servers, and | |
148 even different split rules in different inboxes on the same server, | |
149 the syntax of this variable have been extended along the lines of: | |
150 | |
48216
e5026995ea82
(nnimap-split-rule): Doc fix - escape open parens in column 0.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
44512
diff
changeset
|
151 \(setq nnimap-split-rule |
31717 | 152 '((\"my1server\" (\".*\" ((\"ding\" \"ding@gnus.org\") |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
153 (\"junk\" \"From:.*Simon\"))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
154 (\"my2server\" (\"INBOX\" nnimap-split-fancy)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
155 (\"my[34]server\" (\".*\" ((\"private\" \"To:.*Simon\") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
156 (\"junk\" my-junk-func))))) |
31717 | 157 |
158 The virtual server name is in fact a regexp, so that the same rules | |
159 may apply to several servers. In the example, the servers | |
160 \"my3server\" and \"my4server\" both use the same rules. Similarly, | |
161 the inbox string is also a regexp. The actual splitting rules are as | |
162 before, either a function, or a list with group/regexp or | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
163 group/function elements." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
164 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
165 :type '(choice :tag "Rule type" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
166 (repeat :menu-tag "Single-server" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
167 :tag "Single-server list" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
168 (list (string :tag "Mailbox") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
169 (choice :tag "Predicate" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
170 (regexp :tag "A regexp") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
171 (nnimap-strict-function :tag "A function")))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
172 (choice :menu-tag "A function" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
173 :tag "A function" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
174 (function-item nnimap-split-fancy) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
175 (function-item nnmail-split-fancy) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
176 (nnimap-strict-function :tag "User-defined function")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
177 (repeat :menu-tag "Multi-server (extended)" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
178 :tag "Multi-server list" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
179 (list (regexp :tag "Server regexp") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
180 (list (regexp :tag "Incoming Mailbox regexp") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
181 (repeat :tag "Rules for matching server(s) and mailbox(es)" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
182 (list (string :tag "Destination mailbox") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
183 (choice :tag "Predicate" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
184 (regexp :tag "A Regexp") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
185 (nnimap-strict-function :tag "A Function"))))))))) |
31717 | 186 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
187 (defcustom nnimap-split-predicate "UNSEEN UNDELETED" |
31717 | 188 "The predicate used to find articles to split. |
189 If you use another IMAP client to peek on articles but always would | |
190 like nnimap to split them once it's started, you could change this to | |
191 \"UNDELETED\". Other available predicates are available in | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
192 RFC2060 section 6.4.4." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
193 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
194 :type 'string) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
195 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
196 (defcustom nnimap-split-fancy nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
197 "Like the variable `nnmail-split-fancy'." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
198 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
199 :type 'sexp) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
200 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
201 (defvar nnimap-split-download-body-default nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
202 "Internal variable with default value for `nnimap-split-download-body'.") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
203 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
204 (defcustom nnimap-split-download-body 'default |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
205 "Whether to download entire articles during splitting. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
206 This is generally not required, and will slow things down considerably. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
207 You may need it if you want to use an advanced splitting function that |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
208 analyses the body before splitting the article. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
209 If this variable is nil, bodies will not be downloaded; if this |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
210 variable is the symbol `default' the default behaviour is |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
211 used (which currently is nil, unless you use a statistical |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
212 spam.el test); if this variable is another non-nil value bodies |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
213 will be downloaded." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
214 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
215 :type '(choice (const :tag "Let system decide" deault) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
216 boolean)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
217 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
218 ;; Performance / bug workaround variables |
31717 | 219 |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
220 (defcustom nnimap-close-asynchronous t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
221 "Close mailboxes asynchronously in `nnimap-close-group'. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
222 This means that errors cought by nnimap when closing the mailbox will |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
223 not prevent Gnus from updating the group status, which may be harmful. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
224 However, it increases speed." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
225 :type 'boolean |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
226 :group 'nnimap) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
227 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
228 (defcustom nnimap-dont-close t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
229 "Never close mailboxes. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
230 This increases the speed of closing mailboxes (quiting group) but may |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
231 decrease the speed of selecting another mailbox later. Re-selecting |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
232 the same mailbox will be faster though." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
233 :type 'boolean |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
234 :group 'nnimap) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
235 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
236 (defcustom nnimap-retrieve-groups-asynchronous t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
237 "Send asynchronous STATUS commands for each mailbox before checking mail. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
238 If you have mailboxes that rarely receives mail, this speeds up new |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
239 mail checking. It works by first sending STATUS commands for each |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
240 mailbox, and then only checking groups which has a modified UIDNEXT |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
241 more carefully for new mail. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
242 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
243 In summary, the default is O((1-p)*k+p*n) and changing it to nil makes |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
244 it O(n). If p is small, then the default is probably faster." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
245 :type 'boolean |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
246 :group 'nnimap) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
247 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
248 (defvoo nnimap-need-unselect-to-notice-new-mail nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
249 "Unselect mailboxes before looking for new mail in them. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
250 Some servers seem to need this under some circumstances.") |
31717 | 251 |
252 ;; Authorization / Privacy variables | |
253 | |
254 (defvoo nnimap-auth-method nil | |
255 "Obsolete.") | |
256 | |
257 (defvoo nnimap-stream nil | |
258 "How nnimap will connect to the server. | |
259 | |
260 The default, nil, will try to use the \"best\" method the server can | |
261 handle. | |
262 | |
263 Change this if | |
264 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
265 1) you want to connect with TLS/SSL. The TLS/SSL integration |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
266 with IMAP is suboptimal so you'll have to tell it |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
267 specifically. |
31717 | 268 |
269 2) your server is more capable than your environment -- i.e. your | |
270 server accept Kerberos login's but you haven't installed the | |
271 `imtest' program or your machine isn't configured for Kerberos. | |
272 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
273 Possible choices: gssapi, kerberos4, starttls, tls, ssl, network, shell. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
274 See also `imap-streams' and `imap-stream-alist'.") |
31717 | 275 |
276 (defvoo nnimap-authenticator nil | |
277 "How nnimap authenticate itself to the server. | |
278 | |
279 The default, nil, will try to use the \"best\" method the server can | |
280 handle. | |
281 | |
282 There is only one reason for fiddling with this variable, and that is | |
283 if your server is more capable than your environment -- i.e. you | |
284 connect to a server that accept Kerberos login's but you haven't | |
285 installed the `imtest' program or your machine isn't configured for | |
286 Kerberos. | |
287 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
288 Possible choices: gssapi, kerberos4, digest-md5, cram-md5, login, anonymous. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
289 See also `imap-authenticators' and `imap-authenticator-alist'") |
31717 | 290 |
291 (defvoo nnimap-directory (nnheader-concat gnus-directory "overview/") | |
292 "Directory to keep NOV cache files for nnimap groups. | |
293 See also `nnimap-nov-file-name'.") | |
294 | |
295 (defvoo nnimap-nov-file-name "nnimap." | |
296 "NOV cache base filename. | |
297 The group name and `nnimap-nov-file-name-suffix' will be appended. A | |
298 typical complete file name would be | |
299 ~/News/overview/nnimap.pdc.INBOX.ding.nov, or | |
300 ~/News/overview/nnimap/pdc/INBOX/ding/nov if | |
301 `nnmail-use-long-file-names' is nil") | |
302 | |
303 (defvoo nnimap-nov-file-name-suffix ".novcache" | |
304 "Suffix for NOV cache base filename.") | |
305 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
306 (defvoo nnimap-nov-is-evil gnus-agent |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
307 "If non-nil, never generate or use a local nov database for this backend. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
308 Using nov databases should speed up header fetching considerably. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
309 However, it will invoke a UID SEARCH UID command on the server, and |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
310 some servers implement this command inefficiently by opening each and |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
311 every message in the group, thus making it quite slow. |
31717 | 312 Unlike other backends, you do not need to take special care if you |
313 flip this variable.") | |
314 | |
315 (defvoo nnimap-expunge-on-close 'always ; 'ask, 'never | |
316 "Whether to expunge a group when it is closed. | |
317 When a IMAP group with articles marked for deletion is closed, this | |
318 variable determine if nnimap should actually remove the articles or | |
319 not. | |
320 | |
321 If always, nnimap always perform a expunge when closing the group. | |
322 If never, nnimap never expunges articles marked for deletion. | |
323 If ask, nnimap will ask you if you wish to expunge marked articles. | |
324 | |
325 When setting this variable to `never', you can only expunge articles | |
326 by using `G x' (gnus-group-nnimap-expunge) from the Group buffer.") | |
327 | |
328 (defvoo nnimap-list-pattern "*" | |
329 "A string LIMIT or list of strings with mailbox wildcards used to limit available groups. | |
330 See below for available wildcards. | |
331 | |
332 The LIMIT string can be a cons cell (REFERENCE . LIMIT), where | |
333 REFERENCE will be passed as the first parameter to LIST/LSUB. The | |
334 semantics of this are server specific, on the University of Washington | |
335 server you can specify a directory. | |
336 | |
337 Example: | |
338 '(\"INBOX\" \"mail/*\" (\"~friend/mail/\" . \"list/*\")) | |
339 | |
340 There are two wildcards * and %. * matches everything, % matches | |
341 everything in the current hierarchy.") | |
342 | |
343 (defvoo nnimap-news-groups nil | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
344 "IMAP support a news-like mode, also known as bulletin board mode, |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
345 where replies is sent via IMAP instead of SMTP. |
31717 | 346 |
347 This variable should contain a regexp matching groups where you wish | |
348 replies to be stored to the mailbox directly. | |
349 | |
350 Example: | |
351 '(\"^[^I][^N][^B][^O][^X].*$\") | |
352 | |
353 This will match all groups not beginning with \"INBOX\". | |
354 | |
355 Note that there is nothing technically different between mail-like and | |
356 news-like mailboxes. If you wish to have a group with todo items or | |
357 similar which you wouldn't want to set up a mailing list for, you can | |
358 use this to make replies go directly to the group.") | |
359 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
360 (defvoo nnimap-expunge-search-string "UID %s NOT SINCE %s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
361 "IMAP search command to use for articles that are to be expired. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
362 The first %s is replaced by a UID set of articles to search on, |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
363 and the second %s is replaced by a date criterium. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
364 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
365 One useful (and perhaps the only useful) value to change this to would |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
366 be `UID %s NOT SENTSINCE %s' to make nnimap use the Date: header |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
367 instead of the internal date of messages. See section 6.4.4 of RFC |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
368 2060 for more information on valid strings.") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
369 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
370 (defvoo nnimap-importantize-dormant t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
371 "If non-nil, mark \"dormant\" articles as \"ticked\" for other IMAP clients. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
372 Note that within Gnus, dormant articles will still (only) be |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
373 marked as ticked. This is to make \"dormant\" articles stand out, |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
374 just like \"ticked\" articles, in other IMAP clients.") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
375 |
31717 | 376 (defvoo nnimap-server-address nil |
377 "Obsolete. Use `nnimap-address'.") | |
378 | |
379 (defcustom nnimap-authinfo-file "~/.authinfo" | |
380 "Authorization information for IMAP servers. In .netrc format." | |
381 :type | |
382 '(choice file | |
383 (repeat :tag "Entries" | |
384 :menu-tag "Inline" | |
385 (list :format "%v" | |
386 :value ("" ("login" . "") ("password" . "")) | |
387 (string :tag "Host") | |
388 (checklist :inline t | |
389 (cons :format "%v" | |
390 (const :format "" "login") | |
391 (string :format "Login: %v")) | |
392 (cons :format "%v" | |
393 (const :format "" "password") | |
82970
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
394 (string :format "Password: %v")))))) |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
395 :group 'nnimap) |
31717 | 396 |
397 (defcustom nnimap-prune-cache t | |
398 "If non-nil, nnimap check whether articles still exist on server before using data stored in NOV cache." | |
82970
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
399 :type 'boolean |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
400 :group 'nnimap) |
31717 | 401 |
402 (defvar nnimap-request-list-method 'imap-mailbox-list | |
403 "Method to use to request a list of all folders from the server. | |
404 If this is 'imap-mailbox-lsub, then use a server-side subscription list to | |
405 restrict visible folders.") | |
406 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
407 (defcustom nnimap-debug nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
408 "If non-nil, random debug spews are placed in *nnimap-debug* buffer." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
409 :group 'nnimap |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
410 :type 'boolean) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
411 |
31717 | 412 ;; Internal variables: |
413 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
414 (defvar nnimap-debug-buffer "*nnimap-debug*") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
415 (defvar nnimap-mailbox-info (gnus-make-hashtable 997)) |
31717 | 416 (defvar nnimap-current-move-server nil) |
417 (defvar nnimap-current-move-group nil) | |
418 (defvar nnimap-current-move-article nil) | |
419 (defvar nnimap-length) | |
420 (defvar nnimap-progress-chars '(?| ?/ ?- ?\\)) | |
421 (defvar nnimap-progress-how-often 20) | |
422 (defvar nnimap-counter) | |
423 (defvar nnimap-server-buffer-alist nil) ;; Map server name to buffers. | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
424 (defvar nnimap-current-server nil) ;; Current server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
425 (defvar nnimap-server-buffer nil) ;; Current servers' buffer |
31717 | 426 |
427 | |
428 | |
429 (nnoo-define-basics nnimap) | |
430 | |
431 ;; Utility functions: | |
432 | |
433 (defsubst nnimap-get-server-buffer (server) | |
434 "Return buffer for SERVER, if nil use current server." | |
435 (cadr (assoc (or server nnimap-current-server) nnimap-server-buffer-alist))) | |
436 | |
437 (defun nnimap-possibly-change-server (server) | |
438 "Return buffer for SERVER, changing the current server as a side-effect. | |
439 If SERVER is nil, uses the current server." | |
440 (setq nnimap-current-server (or server nnimap-current-server) | |
441 nnimap-server-buffer (nnimap-get-server-buffer nnimap-current-server))) | |
442 | |
443 (defun nnimap-verify-uidvalidity (group server) | |
444 "Verify stored uidvalidity match current one in GROUP on SERVER." | |
445 (let* ((gnusgroup (gnus-group-prefixed-name | |
446 group (gnus-server-to-method | |
447 (format "nnimap:%s" server)))) | |
448 (new-uidvalidity (imap-mailbox-get 'uidvalidity)) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
449 (old-uidvalidity (gnus-group-get-parameter gnusgroup 'uidvalidity)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
450 (dir (file-name-as-directory (expand-file-name nnimap-directory))) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
451 (nameuid (nnheader-translate-file-chars |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
452 (concat nnimap-nov-file-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
453 (if (equal server "") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
454 "unnamed" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
455 server) "." group "." old-uidvalidity |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
456 nnimap-nov-file-name-suffix) t)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
457 (file (if (or nnmail-use-long-file-names |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
458 (file-exists-p (expand-file-name nameuid dir))) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
459 (expand-file-name nameuid dir) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
460 (expand-file-name |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
461 (mm-encode-coding-string |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
462 (nnheader-replace-chars-in-string nameuid ?. ?/) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
463 nnmail-pathname-coding-system) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
464 dir)))) |
31717 | 465 (if old-uidvalidity |
466 (if (not (equal old-uidvalidity new-uidvalidity)) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
467 ;; uidvalidity clash |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
468 (gnus-delete-file file) |
31717 | 469 (gnus-group-set-parameter gnusgroup 'uidvalidity new-uidvalidity) |
470 t) | |
471 (gnus-group-add-parameter gnusgroup (cons 'uidvalidity new-uidvalidity)) | |
472 t))) | |
473 | |
474 (defun nnimap-before-find-minmax-bugworkaround () | |
475 "Function called before iterating through mailboxes with | |
476 `nnimap-find-minmax-uid'." | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
477 (when nnimap-need-unselect-to-notice-new-mail |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
478 ;; XXX this is for UoW imapd problem, it doesn't notice new mail in |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
479 ;; currently selected mailbox without a re-select/examine. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
480 (or (null (imap-current-mailbox nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
481 (imap-mailbox-unselect nnimap-server-buffer)))) |
31717 | 482 |
483 (defun nnimap-find-minmax-uid (group &optional examine) | |
48588 | 484 "Find lowest and highest active article number in GROUP. |
31717 | 485 If EXAMINE is non-nil the group is selected read-only." |
486 (with-current-buffer nnimap-server-buffer | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
487 (when (or (string= group (imap-current-mailbox)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
488 (imap-mailbox-select group examine)) |
31717 | 489 (let (minuid maxuid) |
490 (when (> (imap-mailbox-get 'exists) 0) | |
491 (imap-fetch "1,*" "UID" nil 'nouidfetch) | |
492 (imap-message-map (lambda (uid Uid) | |
493 (setq minuid (if minuid (min minuid uid) uid) | |
494 maxuid (if maxuid (max maxuid uid) uid))) | |
495 'UID)) | |
496 (list (imap-mailbox-get 'exists) minuid maxuid))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
497 |
31717 | 498 (defun nnimap-possibly-change-group (group &optional server) |
499 "Make GROUP the current group, and SERVER the current server." | |
500 (when (nnimap-possibly-change-server server) | |
501 (with-current-buffer nnimap-server-buffer | |
502 (if (or (null group) (imap-current-mailbox-p group)) | |
503 imap-current-mailbox | |
504 (if (imap-mailbox-select group) | |
505 (if (or (nnimap-verify-uidvalidity | |
506 group (or server nnimap-current-server)) | |
507 (zerop (imap-mailbox-get 'exists group)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
508 t ;; for OGnus to see if ignoring uidvalidity |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
509 ;; changes has any bad effects. |
31717 | 510 (yes-or-no-p |
511 (format | |
512 "nnimap: Group %s is not uidvalid. Continue? " group))) | |
513 imap-current-mailbox | |
514 (imap-mailbox-unselect) | |
38413
a26d9b55abb6
Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents:
32995
diff
changeset
|
515 (error "nnimap: Group %s is not uid-valid" group)) |
31717 | 516 (nnheader-report 'nnimap (imap-error-text))))))) |
517 | |
518 (defun nnimap-replace-whitespace (string) | |
519 "Return STRING with all whitespace replaced with space." | |
520 (when string | |
521 (while (string-match "[\r\n\t]+" string) | |
522 (setq string (replace-match " " t t string))) | |
523 string)) | |
524 | |
525 ;; Required backend functions | |
526 | |
527 (defun nnimap-retrieve-headers-progress () | |
528 "Hook to insert NOV line for current article into `nntp-server-buffer'." | |
529 (and (numberp nnmail-large-newsgroup) | |
530 (zerop (% (incf nnimap-counter) nnimap-progress-how-often)) | |
531 (> nnimap-length nnmail-large-newsgroup) | |
532 (nnheader-message 6 "nnimap: Retrieving headers... %c" | |
533 (nth (/ (% nnimap-counter | |
534 (* (length nnimap-progress-chars) | |
535 nnimap-progress-how-often)) | |
536 nnimap-progress-how-often) | |
537 nnimap-progress-chars))) | |
538 (with-current-buffer nntp-server-buffer | |
539 (let (headers lines chars uid mbx) | |
540 (with-current-buffer nnimap-server-buffer | |
541 (setq uid imap-current-message | |
542 mbx imap-current-mailbox | |
543 headers (nnimap-demule | |
544 (if (imap-capability 'IMAP4rev1) | |
545 ;; xxx don't just use car? alist doesn't contain | |
546 ;; anything else now, but it might... | |
547 (nth 2 (car (imap-message-get uid 'BODYDETAIL))) | |
548 (imap-message-get uid 'RFC822.HEADER))) | |
549 lines (imap-body-lines (imap-message-body imap-current-message)) | |
550 chars (imap-message-get imap-current-message 'RFC822.SIZE))) | |
551 (nnheader-insert-nov | |
552 (with-temp-buffer | |
553 (buffer-disable-undo) | |
554 (insert headers) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
555 (let ((head (nnheader-parse-naked-head))) |
31717 | 556 (mail-header-set-number head uid) |
557 (mail-header-set-chars head chars) | |
558 (mail-header-set-lines head lines) | |
559 (mail-header-set-xref | |
560 head (format "%s %s:%d" (system-name) mbx uid)) | |
561 head)))))) | |
562 | |
563 (defun nnimap-retrieve-which-headers (articles fetch-old) | |
564 "Get a range of articles to fetch based on ARTICLES and FETCH-OLD." | |
565 (with-current-buffer nnimap-server-buffer | |
566 (if (numberp (car-safe articles)) | |
567 (imap-search | |
568 (concat "UID " | |
569 (imap-range-to-message-set | |
570 (gnus-compress-sequence | |
571 (append (gnus-uncompress-sequence | |
572 (and fetch-old | |
573 (cons (if (numberp fetch-old) | |
574 (max 1 (- (car articles) fetch-old)) | |
575 1) | |
576 (1- (car articles))))) | |
577 articles))))) | |
578 (mapcar (lambda (msgid) | |
579 (imap-search | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
580 (format "HEADER Message-Id \"%s\"" msgid))) |
31717 | 581 articles)))) |
582 | |
583 (defun nnimap-group-overview-filename (group server) | |
49274
eb2699620e9c
* gnus-agent.el: Don't use `path'.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
48588
diff
changeset
|
584 "Make file name for GROUP on SERVER." |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
585 (let* ((dir (file-name-as-directory (expand-file-name nnimap-directory))) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
586 (uidvalidity (gnus-group-get-parameter |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
587 (gnus-group-prefixed-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
588 group (gnus-server-to-method |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
589 (format "nnimap:%s" server))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
590 'uidvalidity)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
591 (name (nnheader-translate-file-chars |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
592 (concat nnimap-nov-file-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
593 (if (equal server "") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
594 "unnamed" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
595 server) "." group nnimap-nov-file-name-suffix) t)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
596 (nameuid (nnheader-translate-file-chars |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
597 (concat nnimap-nov-file-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
598 (if (equal server "") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
599 "unnamed" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
600 server) "." group "." uidvalidity |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
601 nnimap-nov-file-name-suffix) t)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
602 (oldfile (if (or nnmail-use-long-file-names |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
603 (file-exists-p (expand-file-name name dir))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
604 (expand-file-name name dir) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
605 (expand-file-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
606 (mm-encode-coding-string |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
607 (nnheader-replace-chars-in-string name ?. ?/) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
608 nnmail-pathname-coding-system) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
609 dir))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
610 (newfile (if (or nnmail-use-long-file-names |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
611 (file-exists-p (expand-file-name nameuid dir))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
612 (expand-file-name nameuid dir) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
613 (expand-file-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
614 (mm-encode-coding-string |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
615 (nnheader-replace-chars-in-string nameuid ?. ?/) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
616 nnmail-pathname-coding-system) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
617 dir)))) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
618 (when (and (file-exists-p oldfile) (not (file-exists-p newfile))) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
619 (message "nnimap: Upgrading novcache filename...") |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
620 (sit-for 1) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
621 (gnus-make-directory (file-name-directory newfile)) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
622 (unless (ignore-errors (rename-file oldfile newfile) t) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
623 (if (ignore-errors (copy-file oldfile newfile) t) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
624 (delete-file oldfile) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
625 (error "Can't rename `%s' to `%s'" oldfile newfile)))) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
626 newfile)) |
31717 | 627 |
628 (defun nnimap-retrieve-headers-from-file (group server) | |
629 (with-current-buffer nntp-server-buffer | |
630 (let ((nov (nnimap-group-overview-filename group server))) | |
631 (when (file-exists-p nov) | |
632 (mm-insert-file-contents nov) | |
633 (set-buffer-modified-p nil) | |
634 (let ((min (ignore-errors (goto-char (point-min)) | |
635 (read (current-buffer)))) | |
636 (max (ignore-errors (goto-char (point-max)) | |
637 (forward-line -1) | |
638 (read (current-buffer))))) | |
639 (if (and (numberp min) (numberp max)) | |
640 (cons min max) | |
641 ;; junk, remove it, it's saved later | |
642 (erase-buffer) | |
643 nil)))))) | |
644 | |
645 (defun nnimap-retrieve-headers-from-server (articles group server) | |
646 (with-current-buffer nnimap-server-buffer | |
647 (let ((imap-fetch-data-hook '(nnimap-retrieve-headers-progress)) | |
648 (nnimap-length (gnus-range-length articles)) | |
649 (nnimap-counter 0)) | |
650 (imap-fetch (imap-range-to-message-set articles) | |
651 (concat "(UID RFC822.SIZE BODY " | |
652 (let ((headers | |
653 (append '(Subject From Date Message-Id | |
654 References In-Reply-To Xref) | |
655 (copy-sequence | |
656 nnmail-extra-headers)))) | |
657 (if (imap-capability 'IMAP4rev1) | |
658 (format "BODY.PEEK[HEADER.FIELDS %s])" headers) | |
659 (format "RFC822.HEADER.LINES %s)" headers))))) | |
660 (and (numberp nnmail-large-newsgroup) | |
661 (> nnimap-length nnmail-large-newsgroup) | |
662 (nnheader-message 6 "nnimap: Retrieving headers...done"))))) | |
663 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
664 (defun nnimap-dont-use-nov-p (group server) |
31717 | 665 (or gnus-nov-is-evil nnimap-nov-is-evil |
666 (unless (and (gnus-make-directory | |
667 (file-name-directory | |
668 (nnimap-group-overview-filename group server))) | |
669 (file-writable-p | |
670 (nnimap-group-overview-filename group server))) | |
671 (message "nnimap: Nov cache not writable, %s" | |
672 (nnimap-group-overview-filename group server))))) | |
673 | |
674 (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old) | |
675 (when (nnimap-possibly-change-group group server) | |
676 (with-current-buffer nntp-server-buffer | |
677 (erase-buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
678 (if (nnimap-dont-use-nov-p group server) |
31717 | 679 (nnimap-retrieve-headers-from-server |
680 (gnus-compress-sequence articles) group server) | |
681 (let (uids cached low high) | |
682 (when (setq uids (nnimap-retrieve-which-headers articles fetch-old) | |
683 low (car uids) | |
684 high (car (last uids))) | |
685 (if (setq cached (nnimap-retrieve-headers-from-file group server)) | |
686 (progn | |
687 ;; fetch articles with uids before cache block | |
688 (when (< low (car cached)) | |
689 (goto-char (point-min)) | |
690 (nnimap-retrieve-headers-from-server | |
691 (cons low (1- (car cached))) group server)) | |
692 ;; fetch articles with uids after cache block | |
693 (when (> high (cdr cached)) | |
694 (goto-char (point-max)) | |
695 (nnimap-retrieve-headers-from-server | |
696 (cons (1+ (cdr cached)) high) group server)) | |
697 (when nnimap-prune-cache | |
698 ;; remove nov's for articles which has expired on server | |
699 (goto-char (point-min)) | |
700 (dolist (uid (gnus-set-difference articles uids)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
701 (when (re-search-forward (format "^%d\t" uid) nil t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
702 (gnus-delete-line))))) |
31717 | 703 ;; nothing cached, fetch whole range from server |
704 (nnimap-retrieve-headers-from-server | |
705 (cons low high) group server)) | |
706 (when (buffer-modified-p) | |
707 (nnmail-write-region | |
44512
d9d12d6d22cc
(nnimap-retrieve-headers): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40494
diff
changeset
|
708 (point-min) (point-max) |
d9d12d6d22cc
(nnimap-retrieve-headers): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40494
diff
changeset
|
709 (nnimap-group-overview-filename group server) nil 'nomesg)) |
31717 | 710 (nnheader-nov-delete-outside-range low high)))) |
711 'nov))) | |
712 | |
713 (defun nnimap-open-connection (server) | |
714 (if (not (imap-open nnimap-address nnimap-server-port nnimap-stream | |
715 nnimap-authenticator nnimap-server-buffer)) | |
716 (nnheader-report 'nnimap "Can't open connection to server %s" server) | |
717 (unless (or (imap-capability 'IMAP4 nnimap-server-buffer) | |
718 (imap-capability 'IMAP4rev1 nnimap-server-buffer)) | |
719 (imap-close nnimap-server-buffer) | |
720 (nnheader-report 'nnimap "Server %s is not IMAP4 compliant" server)) | |
721 (let* ((list (gnus-parse-netrc nnimap-authinfo-file)) | |
722 (port (if nnimap-server-port | |
723 (int-to-string nnimap-server-port) | |
724 "imap")) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
725 (alist (or (gnus-netrc-machine list server port "imap") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
726 (gnus-netrc-machine list |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
727 (or nnimap-server-address |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
728 nnimap-address) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
729 port "imap"))) |
31717 | 730 (user (gnus-netrc-get alist "login")) |
731 (passwd (gnus-netrc-get alist "password"))) | |
732 (if (imap-authenticate user passwd nnimap-server-buffer) | |
733 (prog1 | |
734 (push (list server nnimap-server-buffer) | |
735 nnimap-server-buffer-alist) | |
736 (nnimap-possibly-change-server server)) | |
737 (imap-close nnimap-server-buffer) | |
738 (kill-buffer nnimap-server-buffer) | |
739 (nnheader-report 'nnimap "Could not authenticate to %s" server))))) | |
740 | |
741 (deffoo nnimap-open-server (server &optional defs) | |
742 (nnheader-init-server-buffer) | |
743 (if (nnimap-server-opened server) | |
744 t | |
745 (unless (assq 'nnimap-server-buffer defs) | |
746 (push (list 'nnimap-server-buffer (concat " *nnimap* " server)) defs)) | |
747 ;; translate `nnimap-server-address' to `nnimap-address' in defs | |
748 ;; for people that configured nnimap with a very old version | |
749 (unless (assq 'nnimap-address defs) | |
750 (if (assq 'nnimap-server-address defs) | |
751 (push (list 'nnimap-address | |
752 (cadr (assq 'nnimap-server-address defs))) defs) | |
753 (push (list 'nnimap-address server) defs))) | |
754 (nnoo-change-server 'nnimap server defs) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
755 (or nnimap-server-buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
756 (setq nnimap-server-buffer (cadr (assq 'nnimap-server-buffer defs)))) |
31717 | 757 (with-current-buffer (get-buffer-create nnimap-server-buffer) |
758 (nnoo-change-server 'nnimap server defs)) | |
759 (or (and nnimap-server-buffer | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
760 (imap-opened nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
761 (if (with-current-buffer nnimap-server-buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
762 (memq imap-state '(auth select examine))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
763 t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
764 (imap-close nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
765 (nnimap-open-connection server))) |
31717 | 766 (nnimap-open-connection server)))) |
767 | |
768 (deffoo nnimap-server-opened (&optional server) | |
769 "Whether SERVER is opened. | |
770 If SERVER is the current virtual server, and the connection to the | |
771 physical server is alive, this function return a non-nil value. If | |
772 SERVER is nil, it is treated as the current server." | |
773 ;; clean up autologouts?? | |
774 (and (or server nnimap-current-server) | |
775 (nnoo-server-opened 'nnimap (or server nnimap-current-server)) | |
776 (imap-opened (nnimap-get-server-buffer server)))) | |
777 | |
778 (deffoo nnimap-close-server (&optional server) | |
779 "Close connection to server and free all resources connected to it. | |
780 Return nil if the server couldn't be closed for some reason." | |
781 (let ((server (or server nnimap-current-server))) | |
782 (when (or (nnimap-server-opened server) | |
783 (imap-opened (nnimap-get-server-buffer server))) | |
784 (imap-close (nnimap-get-server-buffer server)) | |
785 (kill-buffer (nnimap-get-server-buffer server)) | |
786 (setq nnimap-server-buffer nil | |
787 nnimap-current-server nil | |
788 nnimap-server-buffer-alist | |
789 (delq server nnimap-server-buffer-alist))) | |
790 (nnoo-close-server 'nnimap server))) | |
791 | |
792 (deffoo nnimap-request-close () | |
793 "Close connection to all servers and free all resources that the backend have reserved. | |
794 All buffers that have been created by that | |
795 backend should be killed. (Not the nntp-server-buffer, though.) This | |
796 function is generally only called when Gnus is shutting down." | |
797 (mapcar (lambda (server) (nnimap-close-server (car server))) | |
798 nnimap-server-buffer-alist) | |
799 (setq nnimap-server-buffer-alist nil)) | |
800 | |
801 (deffoo nnimap-status-message (&optional server) | |
802 "This function returns the last error message from server." | |
803 (when (nnimap-possibly-change-server server) | |
804 (nnoo-status-message 'nnimap server))) | |
805 | |
806 (defun nnimap-demule (string) | |
82970
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
807 ;; BEWARE: we used to use string-as-multibyte here which is braindead |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
808 ;; because it will turn accidental emacs-mule-valid byte sequences |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
809 ;; into multibyte chars. --Stef |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
810 (funcall (if (and (fboundp 'string-to-multibyte) |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
811 (subrp (symbol-function 'string-to-multibyte))) |
5ef78f4dd84f
[ Merge from Emacs trunk: ]
Reiner Steib <Reiner.Steib@gmx.de>
parents:
82951
diff
changeset
|
812 'string-to-multibyte |
31717 | 813 'identity) |
814 (or string ""))) | |
815 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
816 (defun nnimap-make-callback (article gnus-callback buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
817 "Return a callback function." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
818 `(lambda () |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
819 (nnimap-callback ,article ,gnus-callback ,buffer))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
820 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
821 (defun nnimap-callback (article gnus-callback buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
822 (when (eq article (imap-current-message)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
823 (remove-hook 'imap-fetch-data-hook |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
824 (nnimap-make-callback article gnus-callback buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
825 (with-current-buffer buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
826 (insert |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
827 (with-current-buffer nnimap-server-buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
828 (nnimap-demule |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
829 (if (imap-capability 'IMAP4rev1) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
830 ;; xxx don't just use car? alist doesn't contain |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
831 ;; anything else now, but it might... |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
832 (nth 2 (car (imap-message-get article 'BODYDETAIL))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
833 (imap-message-get article 'RFC822))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
834 (nnheader-ms-strip-cr) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
835 (funcall gnus-callback t)))) |
31717 | 836 |
837 (defun nnimap-request-article-part (article part prop &optional | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
838 group server to-buffer detail) |
31717 | 839 (when (nnimap-possibly-change-group group server) |
840 (let ((article (if (stringp article) | |
841 (car-safe (imap-search | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
842 (format "HEADER Message-Id \"%s\"" article) |
31717 | 843 nnimap-server-buffer)) |
844 article))) | |
845 (when article | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
846 (gnus-message 10 "nnimap: Fetching (part of) article %d from %s..." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
847 article (or group imap-current-mailbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
848 gnus-newsgroup-name)) |
31717 | 849 (if (not nnheader-callback-function) |
850 (with-current-buffer (or to-buffer nntp-server-buffer) | |
851 (erase-buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
852 (let ((data (imap-fetch article part prop nil |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
853 nnimap-server-buffer))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
854 (insert (nnimap-demule (if detail |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
855 (nth 2 (car data)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
856 data)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
857 (nnheader-ms-strip-cr) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
858 (gnus-message |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
859 10 "nnimap: Fetching (part of) article %d from %s...done" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
860 article (or group imap-current-mailbox gnus-newsgroup-name)) |
31717 | 861 (if (bobp) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
862 (nnheader-report 'nnimap "No such article %d in %s: %s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
863 article (or group imap-current-mailbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
864 gnus-newsgroup-name) |
31717 | 865 (imap-error-text nnimap-server-buffer)) |
866 (cons group article))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
867 (add-hook 'imap-fetch-data-hook |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
868 (nnimap-make-callback article |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
869 nnheader-callback-function |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
870 nntp-server-buffer)) |
31717 | 871 (imap-fetch-asynch article part nil nnimap-server-buffer) |
872 (cons group article)))))) | |
873 | |
874 (deffoo nnimap-asynchronous-p () | |
875 t) | |
876 | |
877 (deffoo nnimap-request-article (article &optional group server to-buffer) | |
878 (if (imap-capability 'IMAP4rev1 nnimap-server-buffer) | |
879 (nnimap-request-article-part | |
880 article "BODY.PEEK[]" 'BODYDETAIL group server to-buffer 'detail) | |
881 (nnimap-request-article-part | |
882 article "RFC822.PEEK" 'RFC822 group server to-buffer))) | |
883 | |
884 (deffoo nnimap-request-head (article &optional group server to-buffer) | |
885 (if (imap-capability 'IMAP4rev1 nnimap-server-buffer) | |
886 (nnimap-request-article-part | |
887 article "BODY.PEEK[HEADER]" 'BODYDETAIL group server to-buffer 'detail) | |
888 (nnimap-request-article-part | |
889 article "RFC822.HEADER" 'RFC822.HEADER group server to-buffer))) | |
890 | |
891 (deffoo nnimap-request-body (article &optional group server to-buffer) | |
892 (if (imap-capability 'IMAP4rev1 nnimap-server-buffer) | |
893 (nnimap-request-article-part | |
894 article "BODY.PEEK[TEXT]" 'BODYDETAIL group server to-buffer 'detail) | |
895 (nnimap-request-article-part | |
896 article "RFC822.TEXT.PEEK" 'RFC822.TEXT group server to-buffer))) | |
897 | |
898 (deffoo nnimap-request-group (group &optional server fast) | |
899 (nnimap-request-update-info-internal | |
900 group | |
901 (gnus-get-info (gnus-group-prefixed-name | |
902 group (gnus-server-to-method (format "nnimap:%s" server)))) | |
903 server) | |
904 (when (nnimap-possibly-change-group group server) | |
905 (nnimap-before-find-minmax-bugworkaround) | |
906 (let (info) | |
907 (cond (fast group) | |
908 ((null (setq info (nnimap-find-minmax-uid group t))) | |
909 (nnheader-report 'nnimap "Could not get active info for %s" | |
910 group)) | |
911 (t | |
912 (nnheader-insert "211 %d %d %d %s\n" (or (nth 0 info) 0) | |
913 (max 1 (or (nth 1 info) 1)) | |
914 (or (nth 2 info) 0) group) | |
915 (nnheader-report 'nnimap "Group %s selected" group) | |
916 t))))) | |
917 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
918 (defun nnimap-update-unseen (group &optional server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
919 "Update the unseen count in `nnimap-mailbox-info'." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
920 (gnus-sethash |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
921 (gnus-group-prefixed-name group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
922 (let ((old (gnus-gethash-safe (gnus-group-prefixed-name group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
923 nnimap-mailbox-info))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
924 (list (nth 0 old) (nth 1 old) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
925 (imap-mailbox-status group 'unseen nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
926 (nth 3 old))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
927 nnimap-mailbox-info)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
928 |
31717 | 929 (defun nnimap-close-group (group &optional server) |
930 (with-current-buffer nnimap-server-buffer | |
931 (when (and (imap-opened) | |
932 (nnimap-possibly-change-group group server)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
933 (nnimap-update-unseen group server) |
31717 | 934 (case nnimap-expunge-on-close |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
935 (always (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
936 (imap-mailbox-expunge nnimap-close-asynchronous) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
937 (unless nnimap-dont-close |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
938 (imap-mailbox-close nnimap-close-asynchronous)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
939 (ask (if (and (imap-search "DELETED") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
940 (gnus-y-or-n-p (format "Expunge articles in group `%s'? " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
941 imap-current-mailbox))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
942 (progn |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
943 (imap-mailbox-expunge nnimap-close-asynchronous) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
944 (unless nnimap-dont-close |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
945 (imap-mailbox-close nnimap-close-asynchronous))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
946 (imap-mailbox-unselect))) |
31717 | 947 (t (imap-mailbox-unselect))) |
948 (not imap-current-mailbox)))) | |
949 | |
950 (defun nnimap-pattern-to-list-arguments (pattern) | |
951 (mapcar (lambda (p) | |
952 (cons (car-safe p) (or (cdr-safe p) p))) | |
953 (if (and (listp pattern) | |
954 (listp (cdr pattern))) | |
955 pattern | |
956 (list pattern)))) | |
957 | |
958 (deffoo nnimap-request-list (&optional server) | |
959 (when (nnimap-possibly-change-server server) | |
960 (with-current-buffer nntp-server-buffer | |
961 (erase-buffer)) | |
962 (gnus-message 5 "nnimap: Generating active list%s..." | |
963 (if (> (length server) 0) (concat " for " server) "")) | |
964 (nnimap-before-find-minmax-bugworkaround) | |
965 (with-current-buffer nnimap-server-buffer | |
966 (dolist (pattern (nnimap-pattern-to-list-arguments nnimap-list-pattern)) | |
967 (dolist (mbx (funcall nnimap-request-list-method | |
968 (cdr pattern) (car pattern))) | |
969 (or (member "\\NoSelect" (imap-mailbox-get 'list-flags mbx)) | |
970 (let ((info (nnimap-find-minmax-uid mbx 'examine))) | |
971 (when info | |
972 (with-current-buffer nntp-server-buffer | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
973 (insert (format "\"%s\" %d %d y\n" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
974 mbx (or (nth 2 info) 0) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
975 (max 1 (or (nth 1 info) 1))))))))))) |
31717 | 976 (gnus-message 5 "nnimap: Generating active list%s...done" |
977 (if (> (length server) 0) (concat " for " server) "")) | |
978 t)) | |
979 | |
980 (deffoo nnimap-request-post (&optional server) | |
981 (let ((success t)) | |
982 (dolist (mbx (message-unquote-tokens | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
983 (message-tokenize-header |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
984 (message-fetch-field "Newsgroups") ", ")) success) |
31717 | 985 (let ((to-newsgroup (gnus-group-prefixed-name mbx gnus-command-method))) |
986 (or (gnus-active to-newsgroup) | |
987 (gnus-activate-group to-newsgroup) | |
988 (if (gnus-y-or-n-p (format "No such group: %s. Create it? " | |
989 to-newsgroup)) | |
990 (or (and (gnus-request-create-group | |
991 to-newsgroup gnus-command-method) | |
992 (gnus-activate-group to-newsgroup nil nil | |
993 gnus-command-method)) | |
994 (error "Couldn't create group %s" to-newsgroup))) | |
995 (error "No such group: %s" to-newsgroup)) | |
996 (unless (nnimap-request-accept-article mbx (nth 1 gnus-command-method)) | |
997 (setq success nil)))))) | |
998 | |
999 ;; Optional backend functions | |
1000 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1001 (defun nnimap-string-lessp-numerical (s1 s2) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1002 "Return t if first arg string is less than second in numerical order." |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1003 (cond ((string= s1 s2) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1004 nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1005 ((> (length s1) (length s2)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1006 nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1007 ((< (length s1) (length s2)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1008 t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1009 ((< (string-to-number (substring s1 0 1)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1010 (string-to-number (substring s2 0 1))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1011 t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1012 ((> (string-to-number (substring s1 0 1)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1013 (string-to-number (substring s2 0 1))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1014 nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1015 (t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1016 (nnimap-string-lessp-numerical (substring s1 1) (substring s2 1))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1017 |
31717 | 1018 (deffoo nnimap-retrieve-groups (groups &optional server) |
1019 (when (nnimap-possibly-change-server server) | |
1020 (gnus-message 5 "nnimap: Checking mailboxes...") | |
1021 (with-current-buffer nntp-server-buffer | |
1022 (erase-buffer) | |
1023 (nnimap-before-find-minmax-bugworkaround) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1024 (let (asyncgroups slowgroups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1025 (if (null nnimap-retrieve-groups-asynchronous) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1026 (setq slowgroups groups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1027 (dolist (group groups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1028 (gnus-message 9 "nnimap: Quickly checking mailbox %s" group) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1029 (add-to-list (if (gnus-gethash-safe |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1030 (gnus-group-prefixed-name group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1031 nnimap-mailbox-info) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1032 'asyncgroups |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1033 'slowgroups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1034 (list group (imap-mailbox-status-asynch |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1035 group '(uidvalidity uidnext unseen) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1036 nnimap-server-buffer)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1037 (dolist (asyncgroup asyncgroups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1038 (let ((group (nth 0 asyncgroup)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1039 (tag (nth 1 asyncgroup)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1040 new old) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1041 (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1042 (if (or (not (string= |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1043 (nth 0 (gnus-gethash (gnus-group-prefixed-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1044 group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1045 nnimap-mailbox-info)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1046 (imap-mailbox-get 'uidvalidity group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1047 nnimap-server-buffer))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1048 (not (string= |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1049 (nth 1 (gnus-gethash (gnus-group-prefixed-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1050 group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1051 nnimap-mailbox-info)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1052 (imap-mailbox-get 'uidnext group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1053 nnimap-server-buffer)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1054 (push (list group) slowgroups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1055 (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1056 group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1057 nnimap-mailbox-info)))))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1058 (dolist (group slowgroups) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1059 (if nnimap-retrieve-groups-asynchronous |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1060 (setq group (car group))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1061 (gnus-message 7 "nnimap: Mailbox %s modified" group) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1062 (imap-mailbox-put 'uidnext nil group nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1063 (or (member "\\NoSelect" (imap-mailbox-get 'list-flags group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1064 nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1065 (let* ((info (nnimap-find-minmax-uid group 'examine)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1066 (str (format "\"%s\" %d %d y\n" group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1067 (or (nth 2 info) 0) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1068 (max 1 (or (nth 1 info) 1))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1069 (when (> (or (imap-mailbox-get 'recent group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1070 nnimap-server-buffer) 0) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1071 0) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1072 (push (list (cons group 0)) nnmail-split-history)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1073 (insert str) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1074 (when nnimap-retrieve-groups-asynchronous |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1075 (gnus-sethash |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1076 (gnus-group-prefixed-name group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1077 (list (or (imap-mailbox-get |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1078 'uidvalidity group nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1079 (imap-mailbox-status |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1080 group 'uidvalidity nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1081 (or (imap-mailbox-get |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1082 'uidnext group nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1083 (imap-mailbox-status |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1084 group 'uidnext nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1085 (or (imap-mailbox-get |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1086 'unseen group nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1087 (imap-mailbox-status |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1088 group 'unseen nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1089 str) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1090 nnimap-mailbox-info))))))) |
31717 | 1091 (gnus-message 5 "nnimap: Checking mailboxes...done") |
1092 'active)) | |
1093 | |
1094 (deffoo nnimap-request-update-info-internal (group info &optional server) | |
1095 (when (nnimap-possibly-change-group group server) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1096 (when info ;; xxx what does this mean? should we create a info? |
31717 | 1097 (with-current-buffer nnimap-server-buffer |
1098 (gnus-message 5 "nnimap: Updating info for %s..." | |
1099 (gnus-info-group info)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1100 |
31717 | 1101 (when (nnimap-mark-permanent-p 'read) |
1102 (let (seen unseen) | |
1103 ;; read info could contain articles marked unread by other | |
1104 ;; imap clients! we correct this | |
1105 (setq seen (gnus-uncompress-range (gnus-info-read info)) | |
1106 unseen (imap-search "UNSEEN UNDELETED") | |
1107 seen (gnus-set-difference seen unseen) | |
1108 ;; seen might lack articles marked as read by other | |
1109 ;; imap clients! we correct this | |
1110 seen (append seen (imap-search "SEEN")) | |
1111 ;; remove dupes | |
1112 seen (sort seen '<) | |
1113 seen (gnus-compress-sequence seen t) | |
1114 ;; we can't return '(1) since this isn't a "list of ranges", | |
1115 ;; and we can't return '((1)) since g-list-of-unread-articles | |
1116 ;; is buggy so we return '((1 . 1)). | |
1117 seen (if (and (integerp (car seen)) | |
1118 (null (cdr seen))) | |
1119 (list (cons (car seen) (car seen))) | |
1120 seen)) | |
1121 (gnus-info-set-read info seen))) | |
1122 | |
1123 (mapcar (lambda (pred) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1124 (when (or (eq (cdr pred) 'recent) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1125 (and (nnimap-mark-permanent-p (cdr pred)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1126 (member (nnimap-mark-to-flag (cdr pred)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1127 (imap-mailbox-get 'flags)))) |
31717 | 1128 (gnus-info-set-marks |
1129 info | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1130 (gnus-update-alist-soft |
31717 | 1131 (cdr pred) |
1132 (gnus-compress-sequence | |
1133 (imap-search (nnimap-mark-to-predicate (cdr pred)))) | |
1134 (gnus-info-marks info)) | |
1135 t))) | |
1136 gnus-article-mark-lists) | |
1137 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1138 (when nnimap-importantize-dormant |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1139 ;; nnimap mark dormant article as ticked too (for other clients) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1140 ;; so we remove that mark for gnus since we support dormant |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1141 (gnus-info-set-marks |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1142 info |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1143 (gnus-update-alist-soft |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1144 'tick |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1145 (gnus-remove-from-range |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1146 (cdr-safe (assoc 'tick (gnus-info-marks info))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1147 (cdr-safe (assoc 'dormant (gnus-info-marks info)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1148 (gnus-info-marks info)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1149 t)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1150 |
31717 | 1151 (gnus-message 5 "nnimap: Updating info for %s...done" |
1152 (gnus-info-group info)) | |
1153 | |
1154 info)))) | |
1155 | |
1156 (deffoo nnimap-request-type (group &optional article) | |
1157 (if (and nnimap-news-groups (string-match nnimap-news-groups group)) | |
1158 'news | |
1159 'mail)) | |
1160 | |
1161 (deffoo nnimap-request-set-mark (group actions &optional server) | |
1162 (when (nnimap-possibly-change-group group server) | |
1163 (with-current-buffer nnimap-server-buffer | |
1164 (let (action) | |
1165 (gnus-message 7 "nnimap: Setting marks in %s..." group) | |
1166 (while (setq action (pop actions)) | |
1167 (let ((range (nth 0 action)) | |
1168 (what (nth 1 action)) | |
1169 (cmdmarks (nth 2 action)) | |
1170 marks) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1171 ;; bookmark can't be stored (not list/range |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1172 (setq cmdmarks (delq 'bookmark cmdmarks)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1173 ;; killed can't be stored (not list/range |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1174 (setq cmdmarks (delq 'killed cmdmarks)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1175 ;; unsent are for nndraft groups only |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1176 (setq cmdmarks (delq 'unsent cmdmarks)) |
31717 | 1177 ;; cache flags are pointless on the server |
1178 (setq cmdmarks (delq 'cache cmdmarks)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1179 ;; seen flags are local to each gnus |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1180 (setq cmdmarks (delq 'seen cmdmarks)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1181 ;; recent marks can't be set |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1182 (setq cmdmarks (delq 'recent cmdmarks)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1183 (when nnimap-importantize-dormant |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1184 ;; flag dormant articles as ticked |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1185 (if (memq 'dormant cmdmarks) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1186 (setq cmdmarks (cons 'tick cmdmarks)))) |
31717 | 1187 ;; remove stuff we are forbidden to store |
1188 (mapcar (lambda (mark) | |
1189 (if (imap-message-flag-permanent-p | |
1190 (nnimap-mark-to-flag mark)) | |
1191 (setq marks (cons mark marks)))) | |
1192 cmdmarks) | |
1193 (when (and range marks) | |
1194 (cond ((eq what 'del) | |
1195 (imap-message-flags-del | |
1196 (imap-range-to-message-set range) | |
1197 (nnimap-mark-to-flag marks nil t))) | |
1198 ((eq what 'add) | |
1199 (imap-message-flags-add | |
1200 (imap-range-to-message-set range) | |
1201 (nnimap-mark-to-flag marks nil t))) | |
1202 ((eq what 'set) | |
1203 (imap-message-flags-set | |
1204 (imap-range-to-message-set range) | |
1205 (nnimap-mark-to-flag marks nil t))))))) | |
1206 (gnus-message 7 "nnimap: Setting marks in %s...done" group)))) | |
1207 nil) | |
1208 | |
1209 (defun nnimap-split-fancy () | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1210 "Like the function `nnmail-split-fancy', but uses `nnimap-split-fancy'." |
31717 | 1211 (let ((nnmail-split-fancy nnimap-split-fancy)) |
1212 (nnmail-split-fancy))) | |
1213 | |
1214 (defun nnimap-split-to-groups (rules) | |
1215 ;; tries to match all rules in nnimap-split-rule against content of | |
1216 ;; nntp-server-buffer, returns a list of groups that matched. | |
1217 (with-current-buffer nntp-server-buffer | |
1218 ;; Fold continuation lines. | |
1219 (goto-char (point-min)) | |
1220 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t) | |
1221 (replace-match " " t t)) | |
1222 (if (functionp rules) | |
1223 (funcall rules) | |
1224 (let (to-groups regrepp) | |
1225 (catch 'split-done | |
1226 (dolist (rule rules to-groups) | |
1227 (let ((group (car rule)) | |
1228 (regexp (cadr rule))) | |
1229 (goto-char (point-min)) | |
1230 (when (and (if (stringp regexp) | |
1231 (progn | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1232 (if (not (stringp group)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1233 (setq group (eval group)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1234 (setq regrepp |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1235 (string-match "\\\\[0-9&]" group))) |
31717 | 1236 (re-search-forward regexp nil t)) |
1237 (funcall regexp group)) | |
1238 ;; Don't enter the article into the same group twice. | |
1239 (not (assoc group to-groups))) | |
1240 (push (if regrepp | |
1241 (nnmail-expand-newtext group) | |
1242 group) | |
1243 to-groups) | |
1244 (or nnimap-split-crosspost | |
1245 (throw 'split-done to-groups)))))))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1246 |
31717 | 1247 (defun nnimap-assoc-match (key alist) |
1248 (let (element) | |
1249 (while (and alist (not element)) | |
1250 (if (string-match (car (car alist)) key) | |
1251 (setq element (car alist))) | |
1252 (setq alist (cdr alist))) | |
1253 element)) | |
1254 | |
1255 (defun nnimap-split-find-rule (server inbox) | |
1256 (if (and (listp nnimap-split-rule) (listp (car nnimap-split-rule)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1257 (list (cdar nnimap-split-rule)) (listp (cadar nnimap-split-rule))) |
31717 | 1258 ;; extended format |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1259 (cadr (nnimap-assoc-match inbox (cdr (nnimap-assoc-match |
31717 | 1260 server nnimap-split-rule)))) |
1261 nnimap-split-rule)) | |
1262 | |
1263 (defun nnimap-split-find-inbox (server) | |
1264 (if (listp nnimap-split-inbox) | |
1265 nnimap-split-inbox | |
1266 (list nnimap-split-inbox))) | |
1267 | |
1268 (defun nnimap-split-articles (&optional group server) | |
1269 (when (nnimap-possibly-change-server server) | |
1270 (with-current-buffer nnimap-server-buffer | |
1271 (let (rule inbox removeorig (inboxes (nnimap-split-find-inbox server))) | |
1272 ;; iterate over inboxes | |
1273 (while (and (setq inbox (pop inboxes)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1274 (nnimap-possibly-change-group inbox)) ;; SELECT |
31717 | 1275 ;; find split rule for this server / inbox |
1276 (when (setq rule (nnimap-split-find-rule server inbox)) | |
1277 ;; iterate over articles | |
1278 (dolist (article (imap-search nnimap-split-predicate)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1279 (when (if (if (eq nnimap-split-download-body 'default) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1280 nnimap-split-download-body-default |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1281 nnimap-split-download-body) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1282 (and (nnimap-request-article article) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1283 (with-current-buffer nntp-server-buffer (mail-narrow-to-head))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1284 (nnimap-request-head article)) |
31717 | 1285 ;; copy article to right group(s) |
1286 (setq removeorig nil) | |
1287 (dolist (to-group (nnimap-split-to-groups rule)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1288 (cond ((eq to-group 'junk) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1289 (message "IMAP split removed %s:%s:%d" server inbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1290 article) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1291 (setq removeorig t)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1292 ((imap-message-copy (number-to-string article) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1293 to-group nil 'nocopyuid) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1294 (message "IMAP split moved %s:%s:%d to %s" server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1295 inbox article to-group) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1296 (setq removeorig t) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1297 (when nnmail-cache-accepted-message-ids |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1298 (with-current-buffer nntp-server-buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1299 (let (msgid) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1300 (and (setq msgid |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1301 (nnmail-fetch-field "message-id")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1302 (nnmail-cache-insert msgid |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1303 to-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1304 (nnmail-fetch-field "subject")))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1305 ;; Add the group-art list to the history list. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1306 (push (list (cons to-group 0)) nnmail-split-history)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1307 (t |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1308 (message "IMAP split failed to move %s:%s:%d to %s" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1309 server inbox article to-group)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1310 (if (if (eq nnimap-split-download-body 'default) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1311 nnimap-split-download-body-default |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1312 nnimap-split-download-body) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1313 (widen)) |
31717 | 1314 ;; remove article if it was successfully copied somewhere |
1315 (and removeorig | |
1316 (imap-message-flags-add (format "%d" article) | |
1317 "\\Seen \\Deleted"))))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1318 (when (imap-mailbox-select inbox) ;; just in case |
31717 | 1319 ;; todo: UID EXPUNGE (if available) to remove splitted articles |
1320 (imap-mailbox-expunge) | |
1321 (imap-mailbox-close))) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1322 (when nnmail-cache-accepted-message-ids |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1323 (nnmail-cache-close)) |
31717 | 1324 t)))) |
1325 | |
1326 (deffoo nnimap-request-scan (&optional group server) | |
1327 (nnimap-split-articles group server)) | |
1328 | |
1329 (deffoo nnimap-request-newgroups (date &optional server) | |
1330 (when (nnimap-possibly-change-server server) | |
1331 (with-current-buffer nntp-server-buffer | |
1332 (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s..." | |
1333 (if (> (length server) 0) " on " "") server) | |
1334 (erase-buffer) | |
1335 (nnimap-before-find-minmax-bugworkaround) | |
1336 (dolist (pattern (nnimap-pattern-to-list-arguments | |
1337 nnimap-list-pattern)) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1338 (dolist (mbx (imap-mailbox-lsub (cdr pattern) (car pattern) nil |
31717 | 1339 nnimap-server-buffer)) |
1340 (or (catch 'found | |
1341 (dolist (mailbox (imap-mailbox-get 'list-flags mbx | |
1342 nnimap-server-buffer)) | |
1343 (if (string= (downcase mailbox) "\\noselect") | |
1344 (throw 'found t))) | |
1345 nil) | |
1346 (let ((info (nnimap-find-minmax-uid mbx 'examine))) | |
1347 (when info | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1348 (insert (format "\"%s\" %d %d y\n" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1349 mbx (or (nth 2 info) 0) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1350 (max 1 (or (nth 1 info) 1))))))))) |
31717 | 1351 (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s...done" |
1352 (if (> (length server) 0) " on " "") server)) | |
1353 t)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1354 |
31717 | 1355 (deffoo nnimap-request-create-group (group &optional server args) |
1356 (when (nnimap-possibly-change-server server) | |
1357 (or (imap-mailbox-status group 'uidvalidity nnimap-server-buffer) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1358 (imap-mailbox-create group nnimap-server-buffer) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1359 (nnheader-report 'nnimap "%S" |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1360 (imap-error-text nnimap-server-buffer))))) |
31717 | 1361 |
1362 (defun nnimap-time-substract (time1 time2) | |
1363 "Return TIME for TIME1 - TIME2." | |
1364 (let* ((ms (- (car time1) (car time2))) | |
1365 (ls (- (nth 1 time1) (nth 1 time2)))) | |
1366 (if (< ls 0) | |
1367 (list (- ms 1) (+ (expt 2 16) ls)) | |
1368 (list ms ls)))) | |
1369 | |
1370 (defun nnimap-date-days-ago (daysago) | |
1371 "Return date, in format \"3-Aug-1998\", for DAYSAGO days ago." | |
40494
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1372 (let* ((time (nnimap-time-substract (current-time) (days-to-time daysago))) |
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1373 (date (format-time-string |
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1374 (format "%%d-%s-%%Y" |
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1375 (capitalize (car (rassoc (nth 4 (decode-time time)) |
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1376 parse-time-months)))) |
4c7be17ecf55
(nnimap-date-days-ago): Defeat locale.
Gerd Moellmann <gerd@gnu.org>
parents:
38413
diff
changeset
|
1377 time))) |
31717 | 1378 (if (eq ?0 (string-to-char date)) |
1379 (substring date 1) | |
1380 date))) | |
1381 | |
1382 (defun nnimap-request-expire-articles-progress () | |
1383 (gnus-message 5 "nnimap: Marking article %d for deletion..." | |
1384 imap-current-message)) | |
1385 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1386 (defun nnimap-expiry-target (arts group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1387 (unless (eq nnmail-expiry-target 'delete) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1388 (with-temp-buffer |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1389 (dolist (art arts) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1390 (nnimap-request-article art group server (current-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1391 ;; hints for optimization in `nnimap-request-accept-article' |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1392 (let ((nnimap-current-move-article art) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1393 (nnimap-current-move-group group) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1394 (nnimap-current-move-server server)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1395 (nnmail-expiry-target-group nnmail-expiry-target group)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1396 ;; It is not clear if `nnmail-expiry-target' somehow cause the |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1397 ;; current group to be changed or not, so we make sure here. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1398 (nnimap-possibly-change-group group server))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1399 |
31717 | 1400 ;; Notice that we don't actually delete anything, we just mark them deleted. |
1401 (deffoo nnimap-request-expire-articles (articles group &optional server force) | |
1402 (let ((artseq (gnus-compress-sequence articles))) | |
1403 (when (and artseq (nnimap-possibly-change-group group server)) | |
1404 (with-current-buffer nnimap-server-buffer | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1405 (let ((days (or (and nnmail-expiry-wait-function |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1406 (funcall nnmail-expiry-wait-function group)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1407 nnmail-expiry-wait))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1408 (cond ((or force (eq days 'immediate)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1409 (let ((oldarts (imap-search |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1410 (concat "UID " |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1411 (imap-range-to-message-set artseq))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1412 (when oldarts |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1413 (nnimap-expiry-target oldarts group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1414 (when (imap-message-flags-add |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1415 (imap-range-to-message-set |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1416 (gnus-compress-sequence oldarts)) "\\Deleted") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1417 (setq articles (gnus-set-difference |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1418 articles oldarts)))))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1419 ((numberp days) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1420 (let ((oldarts (imap-search |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1421 (format nnimap-expunge-search-string |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1422 (imap-range-to-message-set artseq) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1423 (nnimap-date-days-ago days)))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1424 (imap-fetch-data-hook |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1425 '(nnimap-request-expire-articles-progress))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1426 (when oldarts |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1427 (nnimap-expiry-target oldarts group server) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1428 (when (imap-message-flags-add |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1429 (imap-range-to-message-set |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1430 (gnus-compress-sequence oldarts)) "\\Deleted") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1431 (setq articles (gnus-set-difference |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1432 articles oldarts))))))))))) |
31717 | 1433 ;; return articles not deleted |
1434 articles) | |
1435 | |
1436 (deffoo nnimap-request-move-article (article group server | |
1437 accept-form &optional last) | |
1438 (when (nnimap-possibly-change-server server) | |
1439 (save-excursion | |
1440 (let ((buf (get-buffer-create " *nnimap move*")) | |
1441 (nnimap-current-move-article article) | |
1442 (nnimap-current-move-group group) | |
1443 (nnimap-current-move-server nnimap-current-server) | |
1444 result) | |
1445 (and (nnimap-request-article article group server) | |
1446 (save-excursion | |
1447 (set-buffer buf) | |
1448 (buffer-disable-undo (current-buffer)) | |
1449 (insert-buffer-substring nntp-server-buffer) | |
1450 (setq result (eval accept-form)) | |
1451 (kill-buffer buf) | |
1452 result) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1453 (imap-message-flags-add |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1454 (imap-range-to-message-set (list article)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1455 "\\Deleted" 'silent nnimap-server-buffer)) |
31717 | 1456 result)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49274
diff
changeset
|
1457 |
31717 | 1458 (deffoo nnimap-request-accept-article (group &optional server last) |
1459 (when (nnimap-possibly-change-server server) | |
1460 (let (uid) | |
1461 (if (setq uid | |
1462 (if (string= nnimap-current-server nnimap-current-move-server) | |
1463 ;; moving article within same server, speed it up... | |
1464 (and (nnimap-possibly-change-group | |
1465 nnimap-current-move-group) | |
1466 (imap-message-copy (number-to-string | |
1467 nnimap-current-move-article) | |
1468 group 'dontcreate nil | |
1469 nnimap-server-buffer)) | |
1470 (with-current-buffer (current-buffer) | |
1471 (goto-char (point-min)) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1472 ;; remove any 'From blabla' lines, some IMAP servers |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1473 ;; reject the entire message otherwise. |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1474 (when (looking-at "^From[^:]") |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1475 (delete-region (point) (progn (forward-line) (point)))) |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1476 ;; turn into rfc822 format (\r\n eol's) |
31717 | 1477 (while (search-forward "\n" nil t) |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1478 (replace-match "\r\n")) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1479 (when nnmail-cache-accepted-message-ids |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1480 (nnmail-cache-insert (nnmail-fetch-field "message-id") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1481 group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1482 (nnmail-fetch-field "subject")))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1483 (when (and last nnmail-cache-accepted-message-ids) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1484 (nnmail-cache-close)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1485 ;; this 'or' is for Cyrus server bug |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1486 (or (null (imap-current-mailbox nnimap-server-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1487 (imap-mailbox-unselect nnimap-server-buffer)) |
31717 | 1488 (imap-message-append group (current-buffer) nil nil |
1489 nnimap-server-buffer))) | |
1490 (cons group (nth 1 uid)) | |
1491 (nnheader-report 'nnimap (imap-error-text nnimap-server-buffer)))))) | |
1492 | |
1493 (deffoo nnimap-request-delete-group (group force &optional server) | |
1494 (when (nnimap-possibly-change-server server) | |
1495 (with-current-buffer nnimap-server-buffer | |
1496 (if force | |
1497 (or (null (imap-mailbox-status group 'uidvalidity)) | |
1498 (imap-mailbox-delete group)) | |
1499 ;; UNSUBSCRIBE? | |
1500 t)))) | |
1501 | |
1502 (deffoo nnimap-request-rename-group (group new-name &optional server) | |
1503 (when (nnimap-possibly-change-server server) | |
1504 (imap-mailbox-rename group new-name nnimap-server-buffer))) | |
1505 | |
1506 (defun nnimap-expunge (mailbox server) | |
1507 (when (nnimap-possibly-change-group mailbox server) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1508 (imap-mailbox-expunge nil nnimap-server-buffer))) |
31717 | 1509 |
1510 (defun nnimap-acl-get (mailbox server) | |
1511 (when (nnimap-possibly-change-server server) | |
32995
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1512 (and (imap-capability 'ACL nnimap-server-buffer) |
3720ccaca161
2000-10-27 Simon Josefsson <simon@josefsson.org>
Dave Love <fx@gnu.org>
parents:
32153
diff
changeset
|
1513 (imap-mailbox-acl-get mailbox nnimap-server-buffer)))) |
31717 | 1514 |
1515 (defun nnimap-acl-edit (mailbox method old-acls new-acls) | |
1516 (when (nnimap-possibly-change-server (cadr method)) | |
1517 (unless (imap-capability 'ACL nnimap-server-buffer) | |
1518 (error "Your server does not support ACL editing")) | |
1519 (with-current-buffer nnimap-server-buffer | |
1520 ;; delete all removed identifiers | |
1521 (mapcar (lambda (old-acl) | |
1522 (unless (assoc (car old-acl) new-acls) | |
1523 (or (imap-mailbox-acl-delete (car old-acl) mailbox) | |
1524 (error "Can't delete ACL for %s" (car old-acl))))) | |
1525 old-acls) | |
1526 ;; set all changed acl's | |
1527 (mapcar (lambda (new-acl) | |
1528 (let ((new-rights (cdr new-acl)) | |
1529 (old-rights (cdr (assoc (car new-acl) old-acls)))) | |
1530 (unless (and old-rights new-rights | |
1531 (string= old-rights new-rights)) | |
1532 (or (imap-mailbox-acl-set (car new-acl) new-rights mailbox) | |
1533 (error "Can't set ACL for %s to %s" (car new-acl) | |
1534 new-rights))))) | |
1535 new-acls) | |
1536 t))) | |
1537 | |
1538 | |
1539 ;;; Internal functions | |
1540 | |
1541 ;; | |
1542 ;; This is confusing. | |
1543 ;; | |
1544 ;; mark => read, tick, draft, reply etc | |
1545 ;; flag => "\\Seen", "\\Flagged", "\\Draft", "gnus-expire" etc | |
1546 ;; predicate => "SEEN", "FLAGGED", "DRAFT", "KEYWORD gnus-expire" etc | |
1547 ;; | |
1548 ;; Mark should not really contain 'read since it's not a "mark" in the Gnus | |
1549 ;; world, but we cheat. Mark == gnus-article-mark-lists + '(read . read). | |
1550 ;; | |
1551 | |
1552 (defconst nnimap-mark-to-predicate-alist | |
1553 (mapcar | |
1554 (lambda (pair) ; cdr is the mark | |
1555 (or (assoc (cdr pair) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1556 '((read . "SEEN") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1557 (tick . "FLAGGED") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1558 (draft . "DRAFT") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1559 (recent . "RECENT") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1560 (reply . "ANSWERED"))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1561 (cons (cdr pair) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1562 (format "KEYWORD gnus-%s" (symbol-name (cdr pair)))))) |
31717 | 1563 (cons '(read . read) gnus-article-mark-lists))) |
1564 | |
1565 (defun nnimap-mark-to-predicate (pred) | |
1566 "Convert a Gnus mark (a symbol such as read, tick, expire) to a IMAP predicate. | |
1567 This is a string such as \"SEEN\", \"FLAGGED\", \"KEYWORD gnus-expire\", | |
1568 to be used within a IMAP SEARCH query." | |
1569 (cdr (assq pred nnimap-mark-to-predicate-alist))) | |
1570 | |
1571 (defconst nnimap-mark-to-flag-alist | |
1572 (mapcar | |
1573 (lambda (pair) | |
1574 (or (assoc (cdr pair) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1575 '((read . "\\Seen") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1576 (tick . "\\Flagged") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1577 (draft . "\\Draft") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1578 (recent . "\\Recent") |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1579 (reply . "\\Answered"))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1580 (cons (cdr pair) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1581 (format "gnus-%s" (symbol-name (cdr pair)))))) |
31717 | 1582 (cons '(read . read) gnus-article-mark-lists))) |
1583 | |
1584 (defun nnimap-mark-to-flag-1 (preds) | |
1585 (if (and (not (null preds)) (listp preds)) | |
1586 (cons (nnimap-mark-to-flag (car preds)) | |
1587 (nnimap-mark-to-flag (cdr preds))) | |
1588 (cdr (assoc preds nnimap-mark-to-flag-alist)))) | |
1589 | |
1590 (defun nnimap-mark-to-flag (preds &optional always-list make-string) | |
1591 "Convert a Gnus mark (a symbol such as read, tick, expire) to a IMAP flag. | |
1592 This is a string such as \"\\Seen\", \"\\Flagged\", \"gnus-expire\", to | |
1593 be used in a STORE FLAGS command." | |
1594 (let ((result (nnimap-mark-to-flag-1 preds))) | |
1595 (setq result (if (and (or make-string always-list) | |
1596 (not (listp result))) | |
1597 (list result) | |
1598 result)) | |
1599 (if make-string | |
1600 (mapconcat (lambda (flag) | |
1601 (if (listp flag) | |
1602 (mapconcat 'identity flag " ") | |
1603 flag)) | |
1604 result " ") | |
1605 result))) | |
1606 | |
1607 (defun nnimap-mark-permanent-p (mark &optional group) | |
1608 "Return t iff MARK can be permanently (between IMAP sessions) saved on articles, in GROUP." | |
1609 (imap-message-flag-permanent-p (nnimap-mark-to-flag mark))) | |
1610 | |
1611 (when nnimap-debug | |
1612 (require 'trace) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1613 (buffer-disable-undo (get-buffer-create nnimap-debug-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1614 (mapcar (lambda (f) (trace-function-background f nnimap-debug-buffer)) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1615 '( |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1616 nnimap-possibly-change-server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1617 nnimap-verify-uidvalidity |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1618 nnimap-find-minmax-uid |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1619 nnimap-before-find-minmax-bugworkaround |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1620 nnimap-possibly-change-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1621 ;;nnimap-replace-whitespace |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1622 nnimap-retrieve-headers-progress |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1623 nnimap-retrieve-which-headers |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1624 nnimap-group-overview-filename |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1625 nnimap-retrieve-headers-from-file |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1626 nnimap-retrieve-headers-from-server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1627 nnimap-retrieve-headers |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1628 nnimap-open-connection |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1629 nnimap-open-server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1630 nnimap-server-opened |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1631 nnimap-close-server |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1632 nnimap-request-close |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1633 nnimap-status-message |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1634 ;;nnimap-demule |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1635 nnimap-request-article-part |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1636 nnimap-request-article |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1637 nnimap-request-head |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1638 nnimap-request-body |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1639 nnimap-request-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1640 nnimap-close-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1641 nnimap-pattern-to-list-arguments |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1642 nnimap-request-list |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1643 nnimap-request-post |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1644 nnimap-retrieve-groups |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1645 nnimap-request-update-info-internal |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1646 nnimap-request-type |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1647 nnimap-request-set-mark |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1648 nnimap-split-to-groups |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1649 nnimap-split-find-rule |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1650 nnimap-split-find-inbox |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1651 nnimap-split-articles |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1652 nnimap-request-scan |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1653 nnimap-request-newgroups |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1654 nnimap-request-create-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1655 nnimap-time-substract |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1656 nnimap-date-days-ago |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1657 nnimap-request-expire-articles-progress |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1658 nnimap-request-expire-articles |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1659 nnimap-request-move-article |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1660 nnimap-request-accept-article |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1661 nnimap-request-delete-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1662 nnimap-request-rename-group |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1663 gnus-group-nnimap-expunge |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1664 gnus-group-nnimap-edit-acl |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1665 gnus-group-nnimap-edit-acl-done |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1666 nnimap-group-mode-hook |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1667 nnimap-mark-to-predicate |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1668 nnimap-mark-to-flag-1 |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1669 nnimap-mark-to-flag |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1670 nnimap-mark-permanent-p |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
56280
diff
changeset
|
1671 ))) |
31717 | 1672 |
1673 (provide 'nnimap) | |
1674 | |
55398
dd7a1cf22d3d
(nnimap-demule): Avoid string-as-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
1675 ;; arch-tag: 2b001f20-3ff9-4094-a0ad-46807c1ba70b |
31717 | 1676 ;;; nnimap.el ends here |