#!/usr/bin/perl # # Abhijit Menon-Sen # # This is a quick hack to manage Sieve (RFC 3028) scripts on the Sieve # server (draft-martin-managesieve-*) in Archiveopteryx 1.16 and later. # There is no warranty, express or implied, not even of being able to # speak to any other compliant managesieve server. use IO::Socket; use MIME::Base64; $server = "imap.example.org:4190"; # TODO: no TLS? $user = $ENV{USER} || (getpwuid($<))[0]; $name = ""; $script = ""; $get = 0; $put = 0; $list = 0; $check = 0; $delete = 0; $activate = 0; $explain = 0; sub usage { print STDERR <<"HELP"; Syntax: $0 [-u username] <-l | -c | -[adgp] > [file] -u specifies the username to authenticate as (the default is the name of the logged-in user). -l issues a LISTSCRIPT command and displays the results. -a issues SETACTIVE on the named script. If a script file is also specified, the script is created with its contents first. -g issues GETSCRIPT on the named script. -p issues PUTSCRIPT on the named script. A script file must be specified with this option. -c issues a PUTSCRIPT command with an empty script name, to check the syntax of the contents of the script file. -d issues DELETESCRIPT on the named script. -x