Add arch taglines
[gnus] / texi / sieve.texi
1 \input texinfo                  @c -*-texinfo-*-
2
3 @setfilename sieve
4 @settitle Emacs Sieve Manual
5 @synindex fn cp
6 @synindex vr cp
7 @synindex pg cp
8 @dircategory Emacs
9 @direntry
10 * Sieve: (sieve).               Managing Sieve scripts in Emacs.
11 @end direntry
12 @iftex
13 @finalout
14 @end iftex
15 @setchapternewpage odd
16
17 @ifnottex
18
19 This file documents the Emacs Sieve package.
20
21 Copyright (C) 2001 Free Software Foundation, Inc.
22
23 Permission is granted to copy, distribute and/or modify this document
24 under the terms of the GNU Free Documentation License, Version 1.1 or
25 any later version published by the Free Software Foundation; with no
26 Invariant Sections, with the Front-Cover texts being ``A GNU
27 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
28 license is included in the section entitled ``GNU Free Documentation
29 License'' in the Emacs manual.
30
31 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
32 this GNU Manual, like GNU software.  Copies published by the Free
33 Software Foundation raise funds for GNU development.''
34
35 This document is part of a collection distributed under the GNU Free
36 Documentation License.  If you want to distribute this document
37 separately from the collection, you can do so by adding a copy of the
38 license to the document, as described in section 6 of the license.
39 @end ifnottex
40
41 @tex
42
43 @titlepage
44 @title Emacs Sieve Manual
45
46 @author by Simon Josefsson
47 @page
48
49 @vskip 0pt plus 1filll
50 Copyright @copyright{} 2001 Free Software Foundation, Inc.
51
52 Permission is granted to copy, distribute and/or modify this document
53 under the terms of the GNU Free Documentation License, Version 1.1 or
54 any later version published by the Free Software Foundation; with the
55 Invariant Sections being none, with the Front-Cover texts being ``A GNU
56 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
57 license is included in the section entitled ``GNU Free Documentation
58 License'' in the Emacs manual.
59
60 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
61 this GNU Manual, like GNU software.  Copies published by the Free
62 Software Foundation raise funds for GNU development.''
63
64 This document is part of a collection distributed under the GNU Free
65 Documentation License.  If you want to distribute this document
66 separately from the collection, you can do so by adding a copy of the
67 license to the document, as described in section 6 of the license.
68 @end titlepage
69 @page
70
71 @end tex
72
73 @node Top
74 @top Sieve Support for Emacs
75
76 This manual documents the Emacs Sieve package.
77
78 It is intended as a users manual for Sieve Mode and Manage Sieve, and
79 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
80 API.
81
82 Sieve is a language for server-side filtering of mail.  The language
83 is documented in RFC 3028.  This manual does not attempt to document
84 the language, so keep RFC 3028 around.
85
86 A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
87
88 @menu
89 * Installation::          Getting ready to use the package.
90 * Sieve Mode::            Editing Sieve scripts.
91 * Managing Sieve::        Managing Sieve scripts on a remote server.
92 * Examples ::             A few Sieve code snippets.
93 * Manage Sieve API ::     Interfacing to the Manage Sieve Protocol API.
94 * Standards::             A summary of RFCs and working documents used.
95 * Index::                 Function and variable index.
96 @end menu
97
98
99 @node Installation
100 @chapter Installation
101 @cindex Install
102 @cindex Setup
103
104 The Sieve package should come with your Emacs version, and should be
105 ready for use directly.
106
107 However, to manually set up the package you can put the following
108 commands in your @code{~/.emacs}:
109
110 @lisp
111 (autoload 'sieve-mode "sieve-mode")
112 @end lisp
113 @lisp
114 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
115                             auto-mode-alist))
116 @end lisp
117
118
119 @node Sieve Mode
120 @chapter Sieve Mode
121
122 Sieve mode provides syntax-based indentation, font-locking support and
123 other handy functions to make editing Sieve scripts easier.
124
125 Use @samp{M-x sieve-mode} to switch to this major mode.  This command
126 runs the hook @code{sieve-mode-hook}.
127
128 @vindex sieve-mode-map
129 @vindex sieve-mode-syntax-table
130 Sieve mode is derived from @code{c-mode}, and is very similar except
131 for the syntax of comments.  The keymap (@code{sieve-mode-map}) is
132 inherited from @code{c-mode}, as are the variables for customizing
133 indentation.  Sieve mode has its own abbrev table
134 (@code{sieve-mode-abbrev-table}) and syntax table
135 (@code{sieve-mode-syntax-table}).
136
137 In addition to the editing utility functions, Sieve mode also contains
138 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
139
140 @table @kbd
141
142 @item C-c RET
143 @kindex C-c RET
144 @findex sieve-manage
145 @cindex manage remote sieve script
146 Open a connection to a remote server using the Managesieve protocol.
147
148 @item C-c C-l
149 @kindex C-c C-l
150 @findex sieve-upload
151 @cindex upload sieve script
152 Upload the Sieve script to the currently open server.
153
154 @end table
155
156
157 @node Managing Sieve
158 @chapter Managing Sieve
159
160 Manage Sieve is a special mode used to display Sieve scripts available
161 on a remote server.  It can be invoked with @kbd{M-x sieve-manage
162 RET}, which queries the user for a server and if necessary, user
163 credentials to use.
164
165 When a server has been successfully contacted, the Manage Sieve buffer
166 looks something like:
167
168 @example
169 Server  : mailserver:2000
170
171 2 scripts on server, press RET on a script name edits it, or
172 press RET on <new script> to create a new script.
173         <new script>
174  ACTIVE .sieve
175         template.siv
176 @end example
177
178 One of the scripts are highlighted, and standard point navigation
179 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
180 list.
181
182 The following commands are available in the Manage Sieve buffer:
183
184 @table @kbd
185
186 @item m
187 @kindex m
188 @findex sieve-activate
189 Activates the currently highlighted script.
190
191 @item u
192 @kindex u
193 @findex sieve-deactivate
194 Deactivates the currently highlighted script.
195
196 @item C-M-?
197 @kindex C-M-?
198 @findex sieve-deactivate-all
199 Deactivates all scripts.
200
201 @item r
202 @kindex r
203 @findex sieve-remove
204 Remove currently highlighted script.
205
206 @item RET
207 @item mouse-2
208 @item f
209 @kindex RET
210 @kindex mouse-2
211 @kindex f
212 @findex sieve-edit-script
213 Bury the server buffer and download the currently highlighted script
214 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
215
216 @item o
217 @kindex o
218 @findex sieve-edit-script-other-window
219 Create a new buffer in another window containing the currently
220 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
221
222 @item q
223 @kindex q
224 @findex sieve-bury-buffer
225 Bury the Manage Sieve buffer without closing the connection.
226
227 @item ?
228 @item h
229 @kindex ?
230 @kindex h
231 @findex sieve-help
232 Displays help in the minibuffer. 
233
234 @end table
235
236 @node Examples
237 @chapter Examples
238
239 If you are not familiar with Sieve, this chapter contains a few simple
240 code snippets that you can cut'n'paste and modify at will, until you
241 feel more comfortable with the Sieve language to write the rules from
242 scratch.
243
244 The following complete Sieve script places all messages with a matching
245 @samp{Sender:} header into the given mailbox.  Many mailing lists uses
246 this format.  The first line makes sure your Sieve server understands
247 the @code{fileinto} command.
248
249 @example
250 require "fileinto";
251
252 if address "sender" "owner-w3-beta@@xemacs.org" @{
253         fileinto "INBOX.w3-beta";
254 @}
255 @end example
256
257 A few mailing lists do not use the @samp{Sender:} header, but does
258 contain some unique identifier in some other header.  The following is
259 not a complete script, it assumes that @code{fileinto} has already been
260 required.
261
262 @example
263 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
264         fileinto "INBOX.auc-tex";
265 @}
266 @end example
267
268 At last, we have the hopeless mailing lists that does not have any
269 unique identifier and you are forced to match on the @samp{To:} and
270 @samp{Cc} headers.  As before, this snippet assumes that @code{fileinto}
271 has been required.
272
273 @example
274 if address ["to", "cc"] "kerberos@@mit.edu" @{
275         fileinto "INBOX.kerberos";
276 @}
277 @end example
278
279 @node Manage Sieve API
280 @chapter Manage Sieve API
281
282 The @file{sieve-manage.el} library contains low-level functionality
283 for talking to a server with the @sc{managesieve} protocol.
284
285 A number of user-visible variables exist, which all can be customized
286 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
287
288 @table @code
289
290 @item sieve-manage-default-user
291 @vindex sieve-manage-default-user
292 Sets the default username.
293
294 @item sieve-manage-default-port
295 @vindex sieve-manage-default-port
296 Sets the default port to use, the suggested port number is @code{2000}.
297
298 @item sieve-manage-log
299 @vindex sieve-manage-log
300 If non-@code{nil}, should be a string naming a buffer where a protocol trace
301 is dumped (for debugging purposes).
302
303 @end table
304
305 The API functions include:
306
307 @table @code
308
309 @item sieve-manage-open
310 @findex sieve-manage-open
311 Open connection to managesieve server, returning a buffer to be used
312 by all other API functions.
313
314 @item sieve-manage-opened
315 @findex sieve-manage-opened
316 Check if a server is open or not.
317
318 @item sieve-manage-close
319 @findex sieve-manage-close
320 Close a server connection.
321
322 @item sieve-manage-authenticate
323 @findex sieve-manage-authenticate
324 Authenticate to the server.
325
326 @item sieve-manage-capability
327 @findex sieve-manage-capability
328 Return a list of capabilities the server support.
329
330 @item sieve-manage-listscripts
331 @findex sieve-manage-listscripts
332 List scripts on the server.
333
334 @item sieve-manage-havespace
335 @findex sieve-manage-havespace
336 Returns non-@code{nil} iff server have roam for a script of given
337 size.
338
339 @item sieve-manage-getscript
340 @findex sieve-manage-getscript
341 Download script from server.
342
343 @item sieve-manage-putscript
344 @findex sieve-manage-putscript
345 Upload script to server.
346
347 @item sieve-manage-setactive
348 @findex sieve-manage-setactive
349 Indicate which script on the server should be active.
350
351 @end table
352
353 @node Standards
354 @chapter Standards
355
356 The Emacs Sieve package implements all or parts of a small but
357 hopefully growing number of RFCs and drafts documents.  This chapter
358 lists the relevant ones.  They can all be fetched from
359 @uref{http://quimby.gnus.org/notes/}.
360
361 @table @dfn
362
363 @item RFC3028
364 Sieve: A Mail Filtering Language.
365
366 @item draft-martin-managesieve-03
367 A Protocol for Remotely Managing Sieve Scripts
368
369 @end table
370
371
372 @node Index
373 @chapter Index
374 @printindex cp
375
376 @summarycontents
377 @contents
378 @bye
379
380 @c End:
381
382 @ignore
383    arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3
384 @end ignore