(gnus-summary-show-thread): Remove useless goto-char.
[gnus] / lisp / sieve-manage.el
1 ;;; sieve-manage.el --- Implementation of the managesive protocol in elisp
2
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 ;;   2008, 2009  Free Software Foundation, Inc.
5
6 ;; Author: Simon Josefsson <simon@josefsson.org>
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;; This library provides an elisp API for the managesieve network
26 ;; protocol.
27 ;;
28 ;; It uses the SASL library for authentication, which means it
29 ;; supports DIGEST-MD5, CRAM-MD5, SCRAM-MD5, NTLM, PLAIN and LOGIN
30 ;; methods.  STARTTLS is not well tested, but should be easy to get to
31 ;; work if someone wants.
32 ;;
33 ;; The API should be fairly obvious for anyone familiar with the
34 ;; managesieve protocol, interface functions include:
35 ;;
36 ;; `sieve-manage-open'
37 ;; open connection to managesieve server, returning a buffer to be
38 ;; used by all other API functions.
39 ;;
40 ;; `sieve-manage-opened'
41 ;; check if a server is open or not
42 ;;
43 ;; `sieve-manage-close'
44 ;; close a server connection.
45 ;;
46 ;; `sieve-manage-authenticate'
47 ;; `sieve-manage-listscripts'
48 ;; `sieve-manage-deletescript'
49 ;; `sieve-manage-getscript'
50 ;; performs managesieve protocol actions
51 ;;
52 ;; and that's it.  Example of a managesieve session in *scratch*:
53 ;;
54 ;; (setq my-buf (sieve-manage-open "my.server.com"))
55 ;; " *sieve* my.server.com:2000*"
56 ;;
57 ;; (sieve-manage-authenticate "myusername" "mypassword" my-buf)
58 ;; 'auth
59 ;;
60 ;; (sieve-manage-listscripts my-buf)
61 ;; ("vacation" "testscript" ("splitmail") "badscript")
62 ;;
63 ;; References:
64 ;;
65 ;; draft-martin-managesieve-02.txt,
66 ;; "A Protocol for Remotely Managing Sieve Scripts",
67 ;; by Tim Martin.
68 ;;
69 ;; Release history:
70 ;;
71 ;; 2001-10-31 Committed to Oort Gnus.
72 ;; 2002-07-27 Added DELETESCRIPT.  Suggested by Ned Ludd.
73 ;; 2002-08-03 Use SASL library.
74
75 ;;; Code:
76
77 ;; For Emacs < 22.2.
78 (eval-and-compile
79   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
80
81 (if (locate-library "password-cache")
82     (require 'password-cache)
83   (require 'password))
84
85 (eval-when-compile
86   (require 'sasl)
87   (require 'starttls))
88 (autoload 'sasl-find-mechanism "sasl")
89 (autoload 'starttls-open-stream "starttls")
90
91 ;; User customizable variables:
92
93 (defgroup sieve-manage nil
94   "Low-level Managesieve protocol