Re: Sieve vacation script?

2016-01-21 Thread Leena Heino via Info-cyrus

On Sat, 26 Dec 2015, Patrick Goetz via Info-cyrus wrote:

I've been struggling with figuring out how to set up a sieve vacation reply 
script.  The documentation on this is pretty sparse, and the stuff I do find 
doesn't work.  For example,


I have a script that kind of does that. We needed in our organization a 
script that would convert old $HOME/.vacation.msg files to sieve script. 
The script would then install and activate the script on the mail server 
using the mail server admin rights.


The script uses Cyrus::SIEVE::managesieve and blocks of code borrowed from 
sieveshell.


Attached is a perl script that install two files to server: common.script 
and vacation.script. The common.script is just a script that includes 
vacation.script and ingo.script among others.


First question:  is there step by step explanation for manually creating and 
invoking a cyrus sieve script for a particular user?


I think there is no documentation to do it, but all the bits are there in 
sieveshell code.


--
  Leena Heino  University of Tampere / Computer Centre
  ( liinu at uta.fi )  ( http://www.uta.fi/laitokset/tkk )#!/usr/bin/perl

use Cyrus::SIEVE::managesieve;

my $rc = 0;
my $commonrc = 0;
my $horderc = 0;
my $vacationrc = 0;
my $realm = "";
my $server = "";
my $user = "";
my $authz = "";
my $pass = "";

$realm = "";
$server = "imapserver.example.com";
$user = "exampleuser";
$authz = "cyrusadm";
$pass = "adminpassword";

sub prompt {
my($type, $prompt) = @_ ;

if (($type eq "username") && (defined $user)) {
return $user;
} elsif (($type eq "authname") && (defined $authz)) {
return $authz;
} elsif (($type eq "realm") && (defined $realm)) {
return $realm;
}

if (($type eq "password") && (defined $pass)) {
return $pass;
} elsif ($type eq "password") {
my $ostty;
my $str = "";
chomp($ostty = `stty -g`);

system "stty -echo -icanon min 1 time 0 2>/dev/null || " .
   "stty -echo cbreak";
$str = "\n";

print "$prompt: ";

$b = ;
chop($b);

print $str;
system "stty $ostty";

return $b;
}
}

sub list_cb {

my($name, $isactive) = @_ ;

print "$name ";
if ($isactive == 1) {
  print " <- active script\n";
} else {
  print "\n";
}
}

my $obj = sieve_get_handle($server, "prompt", "prompt", "prompt", "prompt");

if (!defined $obj) {
die "unable to connect to server";
}

$rc = sieve_activate($obj, "");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
#print "deactivate failed: $errstr\n";
}

$rc = sieve_delete($obj, "common");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
#print "delete failed: $errstr\n";
}

$rc = sieve_put_file($obj, 
"/tmp/cyrus_sieve.181426.21062.tmpdir/common.script");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
print "upload failed: $errstr\n";
}
$commonrc += $rc;

$rc = sieve_activate($obj, "common");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
print "activate failed: $errstr\n";
}
$commonrc += $rc;

$rc = sieve_delete($obj, "vacation");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
#print "delete failed: $errstr\n";
}

$rc = sieve_put_file($obj, 
"/tmp/cyrus_sieve.181426.21062.tmpdir/vacation.script");
if ($rc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
print "upload failed: $errstr\n";
}
$vacationrc += $rc;

my $listrc = sieve_list($obj, "list_cb");
if ($listrc != 0) {
my $errstr = sieve_get_error($obj);
$errstr = "unknown error" if(!defined($errstr));
print "list failed: $errstr\n";
}

$scriptrc = $commonrc + $horderc + $vacationrc;
exit $scriptrc;

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Re: Trouble with Outlook 2013, especially with the upgrade from 12/8

2015-12-11 Thread Leena Heino via Info-cyrus

On Fri, 11 Dec 2015, André Schild via Info-cyrus wrote:

Outlook and IMAP is just pain, it's not intended to work, otherwise who would 
buy the exchange server?


1) We see this rather seldom, but sometimes mails come in after 2-10 hours, 
not even a "Fetch mail" helps


2) Definitively a major problem of Outlook 2013, working with IMAP folders in 
copy/rename operations is random at best


We might have had similar problems with Outlook 2013:
- Outlook would sometimes fail to create folders or recognize folders it
  had created earlier
- Messages would get deleted or simply lost when they were copied between
  folders

Attached is a patch that we used locally with Cyrus IMAPD 2.4.17 to 
improve compatibility with Outlook 2013.


--
  Leena Heino  University of Tampere / Computer Centre
  ( liinu at uta.fi )  ( http://www.uta.fi/laitokset/tkk )Patch to make Cyrus Imapd compatible with Outlook 2013.
This patch changes XLIST behaviour so that it works the same as in LIST
in a special case. After this patch the output should be:
. LIST "" ""
* LIST (\Noselect) "/" ""
. OK Completed (0.000 secs)
. XLIST "" ""
* XLIST (\Noselect) "/" ""
. OK Completed (0.000 secs)

diff -Naur cyrus-imapd-2.4.17.orig/imap/imapd.c cyrus-imapd-2.4.17/imap/imapd.c
--- cyrus-imapd-2.4.17.orig/imap/imapd.c2012-12-01 21:57:54.0 
+0200
+++ cyrus-imapd-2.4.17/imap/imapd.c 2014-07-24 13:51:26.885893900 +0300
@@ -6029,10 +6029,14 @@
 
 list_callback_calls = 0;
 
-if (!listargs->pat->s[0] && !(listargs->cmd & LIST_CMD_LSUB)) {
+if (!listargs->pat->s[0] && (listargs->cmd == LIST_CMD_LIST)) {
/* special case: query top-level hierarchy separator */
prot_printf(imapd_out, "* LIST (\\Noselect) \"%c\" \"\"\r\n",
imapd_namespace.hier_sep);
+} else if (!listargs->pat->s[0] && (listargs->cmd == LIST_CMD_XLIST)) {
+   /* special case: query top-level hierarchy separator */
+   prot_printf(imapd_out, "* XLIST (\\Noselect) \"%c\" \"\"\r\n",
+   imapd_namespace.hier_sep);
 } else if (((listargs->sel & LIST_SEL_SUBSCRIBED) ||
(listargs->ret & LIST_RET_SUBSCRIBED)) &&
   (backend_inbox || (backend_inbox = 
proxy_findinboxserver(imapd_userid {

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus