* message.texi (MIME): Describe mml-dnd-protocol-alist and
[gnus] / texi / sieve.texi
index a2894f0..184ec87 100644 (file)
@@ -5,21 +5,13 @@
 @synindex fn cp
 @synindex vr cp
 @synindex pg cp
-@dircategory Emacs
-@direntry
-* Sieve: (sieve).               Managing Sieve scripts in Emacs.
-@end direntry
-@iftex
-@finalout
-@end iftex
-@setchapternewpage odd
-
-@ifnottex
 
+@copying
 This file documents the Emacs Sieve package.
 
-Copyright (C) 2001 Free Software Foundation, Inc.
+Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
+@quotation
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1 or
 any later version published by the Free Software Foundation; with no
@@ -36,39 +28,27 @@ This document is part of a collection distributed under the GNU Free
 Documentation License.  If you want to distribute this document
 separately from the collection, you can do so by adding a copy of the
 license to the document, as described in section 6 of the license.
-@end ifnottex
+@end quotation
+@end copying
 
-@tex
+@dircategory Emacs
+@direntry
+* Sieve: (sieve).               Managing Sieve scripts in Emacs.
+@end direntry
+@iftex
+@finalout
+@end iftex
+@setchapternewpage odd
 
 @titlepage
 @title Emacs Sieve Manual
 
 @author by Simon Josefsson
 @page
-
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2001 Free Software Foundation, Inc.
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
-any later version published by the Free Software Foundation; with the
-Invariant Sections being none, with the Front-Cover texts being ``A GNU
-Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
-license is included in the section entitled ``GNU Free Documentation
-License'' in the Emacs manual.
-
-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-this GNU Manual, like GNU software.  Copies published by the Free
-Software Foundation raise funds for GNU development.''
-
-This document is part of a collection distributed under the GNU Free
-Documentation License.  If you want to distribute this document
-separately from the collection, you can do so by adding a copy of the
-license to the document, as described in section 6 of the license.
+@insertcopying
 @end titlepage
-@page
 
-@end tex
 
 @node Top
 @top Sieve Support for Emacs
@@ -83,10 +63,13 @@ Sieve is a language for server-side filtering of mail.  The language
 is documented in RFC 3028.  This manual does not attempt to document
 the language, so keep RFC 3028 around.
 
+A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
+
 @menu
 * Installation::          Getting ready to use the package.
 * Sieve Mode::            Editing Sieve scripts.
 * Managing Sieve::        Managing Sieve scripts on a remote server.
+* Examples ::             A few Sieve code snippets.
 * Manage Sieve API ::     Interfacing to the Manage Sieve Protocol API.
 * Standards::             A summary of RFCs and working documents used.
 * Index::                 Function and variable index.
@@ -108,7 +91,7 @@ commands in your @code{~/.emacs}:
 (autoload 'sieve-mode "sieve-mode")
 @end lisp
 @lisp
-(setq auto-mode-alist (cons '("\\.si\\(v\\|eve\\)\\'" . sieve-mode)
+(setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
                             auto-mode-alist))
 @end lisp
 
@@ -126,13 +109,13 @@ runs the hook @code{sieve-mode-hook}.
 @vindex sieve-mode-syntax-table
 Sieve mode is derived from @code{c-mode}, and is very similar except
 for the syntax of comments.  The keymap (@code{sieve-mode-map}) is
-inherited from @code{c-mode}, as are the the variables for customizing
+inherited from @code{c-mode}, as are the variables for customizing
 indentation.  Sieve mode has its own abbrev table
 (@code{sieve-mode-abbrev-table}) and syntax table
 (@code{sieve-mode-syntax-table}).
 
 In addition to the editing utility functions, Sieve mode also contains
-bindings to manage Sieve scripts remotely. @pxref{Managing Sieve}.
+bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
 
 @table @kbd
 
@@ -159,7 +142,7 @@ on a remote server.  It can be invoked with @kbd{M-x sieve-manage
 RET}, which queries the user for a server and if necessary, user
 credentials to use.
 
-When a server has been succesfully contacted, the Manage Sieve buffer
+When a server has been successfully contacted, the Manage Sieve buffer
 looks something like:
 
 @example
@@ -230,6 +213,49 @@ Displays help in the minibuffer.
 
 @end table
 
+@node Examples
+@chapter Examples
+
+If you are not familiar with Sieve, this chapter contains a few simple
+code snippets that you can cut'n'paste and modify at will, until you
+feel more comfortable with the Sieve language to write the rules from
+scratch.
+
+The following complete Sieve script places all messages with a matching
+@samp{Sender:} header into the given mailbox.  Many mailing lists uses
+this format.  The first line makes sure your Sieve server understands
+the @code{fileinto} command.
+
+@example
+require "fileinto";
+
+if address "sender" "owner-w3-beta@@xemacs.org" @{
+       fileinto "INBOX.w3-beta";
+@}
+@end example
+
+A few mailing lists do not use the @samp{Sender:} header, but does
+contain some unique identifier in some other header.  The following is
+not a complete script, it assumes that @code{fileinto} has already been
+required.
+
+@example
+if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
+       fileinto "INBOX.auc-tex";
+@}
+@end example
+
+At last, we have the hopeless mailing lists that does not have any
+unique identifier and you are forced to match on the @samp{To:} and
+@samp{Cc} headers.  As before, this snippet assumes that @code{fileinto}
+has been required.
+
+@example
+if address ["to", "cc"] "kerberos@@mit.edu" @{
+       fileinto "INBOX.kerberos";
+@}
+@end example
+
 @node Manage Sieve API
 @chapter Manage Sieve API
 
@@ -251,7 +277,7 @@ Sets the default port to use, the suggested port number is @code{2000}.
 
 @item sieve-manage-log
 @vindex sieve-manage-log
-If non-nil, should be a string naming a buffer where a protocol trace
+If non-@code{nil}, should be a string naming a buffer where a protocol trace
 is dumped (for debugging purposes).
 
 @end table
@@ -287,7 +313,8 @@ List scripts on the server.
 
 @item sieve-manage-havespace
 @findex sieve-manage-havespace
-Returns non-nil iff server have roam for a script of given size.
+Returns non-@code{nil} iff server have roam for a script of given
+size.
 
 @item sieve-manage-getscript
 @findex sieve-manage-getscript
@@ -309,7 +336,7 @@ Indicate which script on the server should be active.
 The Emacs Sieve package implements all or parts of a small but
 hopefully growing number of RFCs and drafts documents.  This chapter
 lists the relevant ones.  They can all be fetched from
-@samp{http://quimby.gnus.org/notes/}.
+@uref{http://quimby.gnus.org/notes/}.
 
 @table @dfn
 
@@ -331,3 +358,7 @@ A Protocol for Remotely Managing Sieve Scripts
 @bye
 
 @c End:
+
+@ignore
+   arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3
+@end ignore