1 ;;; sieve-manage.el --- Implementation of the managesive protocol in elisp
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: Simon Josefsson <simon@josefsson.org>
8 ;; This file is part of GNU Emacs.
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, or (at your option)
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.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
27 ;; This library provides an elisp API for the managesieve network
30 ;; It uses the SASL library for authentication, which means it
31 ;; supports DIGEST-MD5, CRAM-MD5, SCRAM-MD5, NTLM, PLAIN and LOGIN
32 ;; methods. STARTTLS is not well tested, but should be easy to get to
33 ;; work if someone wants.
35 ;; The API should be fairly obvious for anyone familiar with the
36 ;; managesieve protocol, interface functions include:
38 ;; `sieve-manage-open'
39 ;; open connection to managesieve server, returning a buffer to be
40 ;; used by all other API functions.
42 ;; `sieve-manage-opened'
43 ;; check if a server is open or not
45 ;; `sieve-manage-close'
46 ;; close a server connection.
48 ;; `sieve-manage-authenticate'
49 ;; `sieve-manage-listscripts'
50 ;; `sieve-manage-deletescript'
51 ;; `sieve-manage-getscript'
52 ;; performs managesieve protocol actions
54 ;; and that's it. Example of a managesieve session in *scratch*:
56 ;; (setq my-buf (sieve-manage-open "my.server.com"))
57 ;; " *sieve* my.server.com:2000*"
59 ;; (sieve-manage-authenticate "myusername" "mypassword" my-buf)
62 ;; (sieve-manage-listscripts my-buf)
63 ;; ("vacation" "testscript" ("splitmail") "badscript")
67 ;; draft-martin-managesieve-02.txt,
68 ;; "A Protocol for Remotely Managing Sieve Scripts",
73 ;; 2001-10-31 Committed to Oort Gnus.
74 ;; 2002-07-27 Added DELETESCRIPT. Suggested by Ned Ludd.
75 ;; 2002-08-03 Use SASL library.
81 (unless (fboundp 'declare-function
) (defmacro declare-function
(&rest r
))))
83 (if (locate-library "password-cache")
84 (require 'password-cache
)
91 (autoload 'sasl-find-mechanism
"sasl")
92 (autoload 'starttls-open-stream
"starttls"))
94 ;; User customizable variables:
96 (defgroup sieve-manage nil
97 "Low-level Managesieve protocol issues."
101 (defcustom sieve-manage-log
"*sieve-manage-log*"
102 "Name of buffer for managesieve session trace."
104 :group
'sieve-manage
)
106 (defcustom sieve-manage-default-user
(user-login-name)
107 "Default username to use."
109 :group
'sieve-manage
)
111 (defcustom sieve-manage-server-eol
"\r\n"
112 "The EOL string sent from the server."
114 :group
'sieve-manage
)
116 (defcustom sieve-manage-client-eol
"\r\n"
117 "The EOL string we send to the server."
119 :group
'sieve-manage
)
121 (defcustom sieve-manage-streams
'(network starttls shell
)
122 "Priority of streams to consider when opening connection to server."
123 :group
'sieve-manage
)
125 (defcustom sieve-manage-stream-alist
126 '((network sieve-manage-network-p sieve-manage-network-open
)
127 (shell sieve-manage-shell-p sieve-manage-shell-open
)
128 (starttls sieve-manage-starttls-p sieve-manage-starttls-open
))
129 "Definition of network streams.
133 NAME names the stream, CHECK is a function returning non-nil if the
134 server support the stream and OPEN is a function for opening the
136 :group
'sieve-manage
)
138 (defcustom sieve-manage-authenticators
'(digest-md5
144 "Priority of authenticators to consider when authenticating to server."
145 :group
'sieve-manage
)
147 (defcustom sieve-manage-authenticator-alist
148 '((cram-md5 sieve-manage-cram-md5-p sieve-manage-cram-md5-auth
)
149 (digest-md5 sieve-manage-digest-md5-p sieve-manage-digest-md5-auth
)
150 (scram-md5 sieve-manage-scram-md5-p sieve-manage-scram-md5-auth
)
151 (ntlm sieve-manage-ntlm-p sieve-manage-ntlm-auth
)
152 (plain sieve-manage-plain-p sieve-manage-plain-auth
)
153 (login sieve-manage-login-p sieve-manage-login-auth
))
154 "Definition of authenticators.
156 \(NAME CHECK AUTHENTICATE)
158 NAME names the authenticator. CHECK is a function returning non-nil if
159 the server support the authenticator and AUTHENTICATE is a function
160 for doing the actual authentication."
161 :group
'sieve-manage
)
163 (defcustom sieve-manage-default-port
2000
164 "Default port number for managesieve protocol."
166 :group
'sieve-manage
)
168 ;; Internal variables:
170 (defconst sieve-manage-local-variables
'(sieve-manage-server
174 sieve-manage-username
175 sieve-manage-password
177 sieve-manage-client-eol
178 sieve-manage-server-eol
179 sieve-manage-capability
))
180 (defconst sieve-manage-default-stream
'network
)
181 (defconst sieve-manage-coding-system-for-read
'binary
)
182 (defconst sieve-manage-coding-system-for-write
'binary
)
183 (defvar sieve-manage-stream nil
)
184 (defvar sieve-manage-auth nil
)
185 (defvar sieve-manage-server nil
)
186 (defvar sieve-manage-port nil
)
187 (defvar sieve-manage-username nil
)
188 (defvar sieve-manage-password nil
)
189 (defvar sieve-manage-state
'closed
191 Valid states are `closed', `initial', `nonauth', and `auth'.")
192 (defvar sieve-manage-process nil
)
193 (defvar sieve-manage-capability nil
)
195 ;; Internal utility functions
197 (defsubst sieve-manage-disable-multibyte
()
198 "Enable multibyte in the current buffer."
199 (when (fboundp 'set-buffer-multibyte
)
200 (set-buffer-multibyte nil
)))
202 (declare-function password-read
"password-cache" (prompt &optional key
))
203 (declare-function password-cache-add
"password-cache" (key password
))
204 (declare-function password-cache-remove
"password-cache" (key))
206 ;; Uses the dynamically bound `reason' variable.
208 (defun sieve-manage-interactive-login (buffer loginfunc
)
209 "Login to server in BUFFER.
210 LOGINFUNC is passed a username and a password, it should return t if
211 it was successful authenticating itself to the server, nil otherwise.
212 Returns t if login was successful, nil otherwise."
213 (with-current-buffer buffer
214 (make-local-variable 'sieve-manage-username
)
215 (make-local-variable 'sieve-manage-password
)
216 (let (user passwd ret reason passwd-key
)
218 (while (or (not user
) (not passwd
))
219 (setq user
(or sieve-manage-username
220 (read-from-minibuffer
221 (concat "Managesieve username for "
222 sieve-manage-server
": ")
223 (or user sieve-manage-default-user
)))
224 passwd-key
(concat "managesieve:" user
"@" sieve-manage-server
225 ":" sieve-manage-port
)
226 passwd
(or sieve-manage-password
227 (password-read (concat "Managesieve password for "
228 user
"@" sieve-manage-server
231 (when (y-or-n-p "Store password for this session? ")
232 (password-cache-add passwd-key
(copy-sequence passwd
)))
233 (when (and user passwd
)
234 (if (funcall loginfunc user passwd
)
236 sieve-manage-username user
)
238 (message "Login failed (reason given: %s)..." reason
)
239 (message "Login failed..."))
240 (password-cache-remove passwd-key
)
241 (setq sieve-manage-password nil
)
245 (quit (with-current-buffer buffer
246 (password-cache-remove passwd-key
)
249 sieve-manage-password nil
)))
250 (error (with-current-buffer buffer
251 (password-cache-remove passwd-key
)
254 sieve-manage-password nil
))))
257 (defun sieve-manage-erase (&optional p buffer
)
258 (let ((buffer (or buffer
(current-buffer))))
259 (and sieve-manage-log
260 (with-current-buffer (get-buffer-create sieve-manage-log
)
261 (sieve-manage-disable-multibyte)
262 (buffer-disable-undo)
263 (goto-char (point-max))
264 (insert-buffer-substring buffer
(with-current-buffer buffer
266 (or p
(with-current-buffer buffer
268 (delete-region (point-min) (or p
(point-max))))
270 (defun sieve-manage-open-1 (buffer)
271 (with-current-buffer buffer
273 (setq sieve-manage-state
'initial
276 (funcall (nth 2 (assq sieve-manage-stream
277 sieve-manage-stream-alist
))
278 "sieve" buffer sieve-manage-server sieve-manage-port
)
280 (when sieve-manage-process
281 (while (and (eq sieve-manage-state
'initial
)
282 (memq (process-status sieve-manage-process
) '(open run
)))
283 (message "Waiting for response from %s..." sieve-manage-server
)
284 (accept-process-output sieve-manage-process
1))
285 (message "Waiting for response from %s...done" sieve-manage-server
)
286 (and (memq (process-status sieve-manage-process
) '(open run
))
287 sieve-manage-process
))))
291 (defun sieve-manage-network-p (buffer)
294 (defun sieve-manage-network-open (name buffer server port
)
295 (let* ((port (or port sieve-manage-default-port
))
296 (coding-system-for-read sieve-manage-coding-system-for-read
)
297 (coding-system-for-write sieve-manage-coding-system-for-write
)
298 (process (open-network-stream name buffer server port
)))
300 (while (and (memq (process-status process
) '(open run
))
301 (set-buffer buffer
) ;; XXX "blue moon" nntp.el bug
302 (goto-char (point-min))
303 (not (sieve-manage-parse-greeting-1)))
304 (accept-process-output process
1)
306 (sieve-manage-erase nil buffer
)
307 (when (memq (process-status process
) '(open run
))
310 (defun imap-starttls-p (buffer)
311 ;; (and (imap-capability 'STARTTLS buffer)
315 (call-process "starttls"))
318 (defun imap-starttls-open (name buffer server port
)
319 (let* ((port (or port sieve-manage-default-port
))
320 (coding-system-for-read sieve-manage-coding-system-for-read
)
321 (coding-system-for-write sieve-manage-coding-system-for-write
)
322 (process (starttls-open-stream name buffer server port
))
325 (while (and (memq (process-status process
) '(open run
))
326 (set-buffer buffer
) ;; XXX "blue moon" nntp.el bug
327 (goto-char (point-min))
328 (not (sieve-manage-parse-greeting-1)))
329 (accept-process-output process
1)
331 (sieve-manage-erase nil buffer
)
332 (sieve-manage-send "STARTTLS")
333 (starttls-negotiate process
))
334 (when (memq (process-status process
) '(open run
))
339 (defun sieve-sasl-auth (buffer mech
)
340 "Login to server using the SASL MECH method."
341 (message "sieve: Authenticating using %s..." mech
)
342 (if (sieve-manage-interactive-login
344 (lambda (user passwd
)
345 (let (client step tag data rsp
)
346 (setq client
(sasl-make-client (sasl-find-mechanism (list mech
))
347 user
"sieve" sieve-manage-server
))
348 (setq sasl-read-passphrase
(function (lambda (prompt) passwd
)))
349 (setq step
(sasl-next-step client nil
))
356 (and (sasl-step-data step
)
359 (base64-encode-string
360 (sasl-step-data step
)
366 (goto-char (point-min))
367 (while (null (or (progn
368 (setq rsp
(sieve-manage-is-string))
369 (if (not (and rsp
(looking-at
370 sieve-manage-server-eol
)))
372 (goto-char (match-end 0))
374 (setq rsp
(sieve-manage-is-okno))))
375 (accept-process-output sieve-manage-process
1)
376 (goto-char (point-min)))
378 (when (sieve-manage-ok-p rsp
)
379 (when (string-match "^SASL \"\\([^\"]+\\)\"" (cadr rsp
))
381 step
(base64-decode-string (match-string 1 (cadr rsp
)))))
382 (if (and (setq step
(sasl-next-step client step
))
383 (setq data
(sasl-step-data step
)))
384 ;; We got data for server but it's finished
385 (error "Server not ready for SASL data: %s" data
)
386 ;; The authentication process is finished.
388 (unless (stringp rsp
)
389 (apply 'error
"Server aborted SASL authentication: %s %s %s"
391 (sasl-step-set-data step
(base64-decode-string rsp
))
392 (setq step
(sasl-next-step client step
))
394 (if (sasl-step-data step
)
396 (base64-encode-string (sasl-step-data step
)
400 (message "sieve: Authenticating using %s...done" mech
)
401 (message "sieve: Authenticating using %s...failed" mech
)))
403 (defun sieve-manage-cram-md5-p (buffer)
404 (sieve-manage-capability "SASL" "CRAM-MD5" buffer
))
406 (defun sieve-manage-cram-md5-auth (buffer)
407 "Login to managesieve server using the CRAM-MD5 SASL method."
408 (sieve-sasl-auth buffer
"CRAM-MD5"))
410 (defun sieve-manage-digest-md5-p (buffer)
411 (sieve-manage-capability "SASL" "DIGEST-MD5" buffer
))
413 (defun sieve-manage-digest-md5-auth (buffer)
414 "Login to managesieve server using the DIGEST-MD5 SASL method."
415 (sieve-sasl-auth buffer
"DIGEST-MD5"))
417 (defun sieve-manage-scram-md5-p (buffer)
418 (sieve-manage-capability "SASL" "SCRAM-MD5" buffer
))
420 (defun sieve-manage-scram-md5-auth (buffer)
421 "Login to managesieve server using the SCRAM-MD5 SASL method."
422 (sieve-sasl-auth buffer
"SCRAM-MD5"))
424 (defun sieve-manage-ntlm-p (buffer)
425 (sieve-manage-capability "SASL" "NTLM" buffer
))
427 (defun sieve-manage-ntlm-auth (buffer)
428 "Login to managesieve server using the NTLM SASL method."
429 (sieve-sasl-auth buffer
"NTLM"))
431 (defun sieve-manage-plain-p (buffer)
432 (sieve-manage-capability "SASL" "PLAIN" buffer
))
434 (defun sieve-manage-plain-auth (buffer)
435 "Login to managesieve server using the PLAIN SASL method."
436 (sieve-sasl-auth buffer
"PLAIN"))
438 (defun sieve-manage-login-p (buffer)
439 (sieve-manage-capability "SASL" "LOGIN" buffer
))
441 (defun sieve-manage-login-auth (buffer)
442 "Login to managesieve server using the LOGIN SASL method."
443 (sieve-sasl-auth buffer
"LOGIN"))
447 (defun sieve-manage-open (server &optional port stream auth buffer
)
448 "Open a network connection to a managesieve SERVER (string).
449 Optional variable PORT is port number (integer) on remote server.
450 Optional variable STREAM is any of `sieve-manage-streams' (a symbol).
451 Optional variable AUTH indicates authenticator to use, see
452 `sieve-manage-authenticators' for available authenticators. If nil, chooses
453 the best stream the server is capable of.
454 Optional variable BUFFER is buffer (buffer, or string naming buffer)
456 (setq buffer
(or buffer
(format " *sieve* %s:%d" server
(or port
2000))))
457 (with-current-buffer (get-buffer-create buffer
)
458 (mapc 'make-local-variable sieve-manage-local-variables
)
459 (sieve-manage-disable-multibyte)
460 (buffer-disable-undo)
461 (setq sieve-manage-server
(or server sieve-manage-server
))
462 (setq sieve-manage-port
(or port sieve-manage-port
))
463 (setq sieve-manage-stream
(or stream sieve-manage-stream
))
464 (message "sieve: Connecting to %s..." sieve-manage-server
)
465 (if (let ((sieve-manage-stream
466 (or sieve-manage-stream sieve-manage-default-stream
)))
467 (sieve-manage-open-1 buffer
))
469 (let (stream-changed)
470 (message "sieve: Connecting to %s...done" sieve-manage-server
)
471 (when (null sieve-manage-stream
)
472 (let ((streams sieve-manage-streams
))
473 (while (setq stream
(pop streams
))
474 (if (funcall (nth 1 (assq stream
475 sieve-manage-stream-alist
)) buffer
)
477 (not (eq (or sieve-manage-stream
478 sieve-manage-default-stream
)
480 sieve-manage-stream stream
482 (unless sieve-manage-stream
483 (error "Couldn't figure out a stream for server"))))
485 (message "sieve: Reconnecting with stream `%s'..."
487 (sieve-manage-close buffer
)
488 (if (sieve-manage-open-1 buffer
)
489 (message "sieve: Reconnecting with stream `%s'...done"
491 (message "sieve: Reconnecting with stream `%s'...failed"
492 sieve-manage-stream
))
493 (setq sieve-manage-capability nil
))
494 (if (sieve-manage-opened buffer
)
495 ;; Choose authenticator
496 (when (and (null sieve-manage-auth
)
497 (not (eq sieve-manage-state
'auth
)))
498 (let ((auths sieve-manage-authenticators
))
499 (while (setq auth
(pop auths
))
500 (if (funcall (nth 1 (assq
502 sieve-manage-authenticator-alist
))
504 (setq sieve-manage-auth auth
506 (unless sieve-manage-auth
507 (error "Couldn't figure out authenticator for server"))))))
508 (message "sieve: Connecting to %s...failed" sieve-manage-server
))
509 (when (sieve-manage-opened buffer
)
513 (defun sieve-manage-opened (&optional buffer
)
514 "Return non-nil if connection to managesieve server in BUFFER is open.
515 If BUFFER is nil then the current buffer is used."
516 (and (setq buffer
(get-buffer (or buffer
(current-buffer))))
517 (buffer-live-p buffer
)
518 (with-current-buffer buffer
519 (and sieve-manage-process
520 (memq (process-status sieve-manage-process
) '(open run
))))))
522 (defun sieve-manage-close (&optional buffer
)
523 "Close connection to managesieve server in BUFFER.
524 If BUFFER is nil, the current buffer is used."
525 (with-current-buffer (or buffer
(current-buffer))
526 (when (sieve-manage-opened)
527 (sieve-manage-send "LOGOUT")
529 (when (and sieve-manage-process
530 (memq (process-status sieve-manage-process
) '(open run
)))
531 (delete-process sieve-manage-process
))
532 (setq sieve-manage-process nil
)
536 (defun sieve-manage-authenticate (&optional user passwd buffer
)
537 "Authenticate to server in BUFFER, using current buffer if nil.
538 It uses the authenticator specified when opening the server. If the
539 authenticator requires username/passwords, they are queried from the
540 user and optionally stored in the buffer. If USER and/or PASSWD is
541 specified, the user will not be questioned and the username and/or
542 password is remembered in the buffer."
543 (with-current-buffer (or buffer
(current-buffer))
544 (if (not (eq sieve-manage-state
'nonauth
))
545 (eq sieve-manage-state
'auth
)
546 (make-local-variable 'sieve-manage-username
)
547 (make-local-variable 'sieve-manage-password
)
548 (if user
(setq sieve-manage-username user
))
549 (if passwd
(setq sieve-manage-password passwd
))
550 (if (funcall (nth 2 (assq sieve-manage-auth
551 sieve-manage-authenticator-alist
)) buffer
)
552 (setq sieve-manage-state
'auth
)))))
554 (defun sieve-manage-capability (&optional name value buffer
)
555 (with-current-buffer (or buffer
(current-buffer))
557 sieve-manage-capability
559 (nth 1 (assoc name sieve-manage-capability
))
560 (when (string-match value
(nth 1 (assoc name sieve-manage-capability
)))
561 (nth 1 (assoc name sieve-manage-capability
)))))))
563 (defun sieve-manage-listscripts (&optional buffer
)
564 (with-current-buffer (or buffer
(current-buffer))
565 (sieve-manage-send "LISTSCRIPTS")
566 (sieve-manage-parse-listscripts)))
568 (defun sieve-manage-havespace (name size
&optional buffer
)
569 (with-current-buffer (or buffer
(current-buffer))
570 (sieve-manage-send (format "HAVESPACE \"%s\" %s" name size
))
571 (sieve-manage-parse-okno)))
573 (defun sieve-manage-putscript (name content
&optional buffer
)
574 (with-current-buffer (or buffer
(current-buffer))
575 (sieve-manage-send (format "PUTSCRIPT \"%s\" {%d+}%s%s" name
576 ;; Here we assume that the coding-system will
577 ;; replace each char with a single byte.
578 ;; This is always the case if `content' is
581 sieve-manage-client-eol content
))
582 (sieve-manage-parse-okno)))
584 (defun sieve-manage-deletescript (name &optional buffer
)
585 (with-current-buffer (or buffer
(current-buffer))
586 (sieve-manage-send (format "DELETESCRIPT \"%s\"" name
))
587 (sieve-manage-parse-okno)))
589 (defun sieve-manage-getscript (name output-buffer
&optional buffer
)
590 (with-current-buffer (or buffer
(current-buffer))
591 (sieve-manage-send (format "GETSCRIPT \"%s\"" name
))
592 (let ((script (sieve-manage-parse-string)))
593 (sieve-manage-parse-crlf)
594 (with-current-buffer output-buffer
596 (sieve-manage-parse-okno))))
598 (defun sieve-manage-setactive (name &optional buffer
)
599 (with-current-buffer (or buffer
(current-buffer))
600 (sieve-manage-send (format "SETACTIVE \"%s\"" name
))
601 (sieve-manage-parse-okno)))
603 ;; Protocol parsing routines
605 (defun sieve-manage-ok-p (rsp)
606 (string= (downcase (or (car-safe rsp
) "")) "ok"))
608 (defsubst sieve-manage-forward
()
609 (or (eobp) (forward-char)))
611 (defun sieve-manage-is-okno ()
612 (when (looking-at (concat
613 "^\\(OK\\|NO\\)\\( (\\([^)]+\\))\\)?\\( \\(.*\\)\\)?"
614 sieve-manage-server-eol
))
615 (let ((status (match-string 1))
616 (resp-code (match-string 3))
617 (response (match-string 5)))
619 (goto-char (match-beginning 5))
620 (setq response
(sieve-manage-is-string)))
621 (list status resp-code response
))))
623 (defun sieve-manage-parse-okno ()
626 (accept-process-output (get-buffer-process (current-buffer)) 1)
627 (goto-char (point-min))
628 (setq rsp
(sieve-manage-is-okno)))
632 (defun sieve-manage-parse-capability-1 ()
633 "Accept a managesieve greeting."
635 (while (setq str
(sieve-manage-is-string))
636 (if (eq (char-after) ?
)
638 (sieve-manage-forward)
639 (push (list str
(sieve-manage-is-string))
640 sieve-manage-capability
))
641 (push (list str
) sieve-manage-capability
))
643 (when (re-search-forward (concat "^OK" sieve-manage-server-eol
) nil t
)
644 (setq sieve-manage-state
'nonauth
)))
646 (defalias 'sieve-manage-parse-greeting-1
'sieve-manage-parse-capability-1
)
648 (defun sieve-manage-is-string ()
649 (cond ((looking-at "\"\\([^\"]+\\)\"")
652 (goto-char (match-end 0))))
653 ((looking-at (concat "{\\([0-9]+\\)}" sieve-manage-server-eol
))
654 (let ((pos (match-end 0))
655 (len (string-to-number (match-string 1))))
656 (if (< (point-max) (+ pos len
))
658 (goto-char (+ pos len
))
659 (buffer-substring pos
(+ pos len
)))))))
661 (defun sieve-manage-parse-string ()
664 (accept-process-output (get-buffer-process (current-buffer)) 1)
665 (goto-char (point-min))
666 (setq rsp
(sieve-manage-is-string)))
667 (sieve-manage-erase (point))
670 (defun sieve-manage-parse-crlf ()
671 (when (looking-at sieve-manage-server-eol
)
672 (sieve-manage-erase (match-end 0))))
674 (defun sieve-manage-parse-listscripts ()
677 (while (null (or (setq rsp
(sieve-manage-is-okno))
678 (setq tmp
(sieve-manage-is-string))))
679 (accept-process-output (get-buffer-process (current-buffer)) 1)
680 (goto-char (point-min)))
682 (while (not (looking-at (concat "\\( ACTIVE\\)?"
683 sieve-manage-server-eol
)))
684 (accept-process-output (get-buffer-process (current-buffer)) 1)
685 (goto-char (point-min)))
687 (push (cons 'active tmp
) data
)
689 (goto-char (match-end 0))
692 (if (sieve-manage-ok-p rsp
)
696 (defun sieve-manage-send (cmdstr)
697 (setq cmdstr
(concat cmdstr sieve-manage-client-eol
))
698 (and sieve-manage-log
699 (with-current-buffer (get-buffer-create sieve-manage-log
)
700 (sieve-manage-disable-multibyte)
701 (buffer-disable-undo)
702 (goto-char (point-max))
704 (process-send-string sieve-manage-process cmdstr
))
706 (provide 'sieve-manage
)
708 ;; arch-tag: 321c4640-1371-4495-9baf-8ccb71dd5bd1
709 ;; sieve-manage.el ends here