Roundcube Community Forum

Third Party Contributions => Old Style Plug-Ins => Topic started by: JohnDoh on November 30, 2008, 06:00:56 AM

Title: Managesieve patch
Post by: JohnDoh on November 30, 2008, 06:00:56 AM
Hi,

Here is a patch to integrate management of Sieve filter rules into RC. The patch uses the managesieve protocol to communicate with the server. Most of the code for this patch was taken from Alec’s Roundcube managesieve patch Roundcube :: Managesieve plugin (http://alec.pl/roundcube/managesieve/) I just changed the UI and added a new option or two, Alec did all the hard work! The patch has been tested with Dovecot-managesieve.

The rule files on the server are written in a certain way that this code can understand so editing rules with other clients will not work.

The patch works with rev2099 (SVN Version) and adds a 'Filters' tab to the 'Personal Settings'. I have attached a screenshot as well as the patch. At the moment there is no version of this patch against a release version of RC, there are two many changes since 0.2b to be able to apply it easily.

Install
=======
To apply the patch run `patch -ul -d /path/to/roundcubemail/ -p1 < /path/to/patch`. This should be all you need to do to install the patch.

Config
======
The config file is located in plugins/sieverules/config.inc.php
* Set the host where managesieve is listening
* Set the port managesieve is listening on
* Set the folder delimiter (if your managesieve implementation uses a different one to your IMAP server
* Set the name of the ruleset in which your sieve rules are stored
* Enable/disable the actions you want
* Define any predefined rules you wish to use

**UPDATE 20081214**
I have added a new verison of the patch, sieverules.BETA.r2149.patch. This version has a new config variable - include_imap_root to specify whether or not the imap_root should be added to the folder path in the sieve script.

**UPDATE 20081221**
I have added a new version of the patch, sieverules.BETA.r2184.patch. This version fixes a bug making it impossible to delete the first rule in the list and adds a disable rule option to the UI so that rules don’t have to be deleted to stop them being used.

**UPDATE 20090102**
I have added a new version of the patch, sieverules.BETA.0_2.patch. This version works with the 0.2 stable release of RoundCube. I have also made a number of improvements to the script, including:
* Added support for rexeg tests
* Added support for imapflags
* Added support for relational operators and comparators
* Added support for subaddress tests
* Added support for notify action

**UPDATE 20090108**
sieverules.BETA.0_2stable.patch - works with the release on the RC site
sieverules.BETA.r2198.patch - works with the SVN version



THIS PATCH IS NO LONGER SUPPORTED. IT HAS NOW BEEN CONVERTED TO USE THE PLUGIN API. FURTHER DISCUSSION CAN BE FOUND HERE http://www.roundcubeforum.net/api-based-plugins/4878-sieverules-managesieve-plugin.html
Title: Deleting rules
Post by: mk_asdf on December 08, 2008, 10:36:47 AM
Hello,

thanks for this plugin, it works great, except that I can't delete rules. If I click on Delete button, it asks me if I am really sure, I confirm it by clicking on OK button, but nothing happens, that rule is still there. Do you know how can I fix it?

I have RoundCube from SVN trunk (r2133) and I am running Dovecot.
Title: Managesieve patch
Post by: JohnDoh on December 09, 2008, 03:36:15 AM
The deleting seems to be working for me, could you give me a bit more information - what browser are you using? do you see any JS errors? do you see anything in the roundcube error log?

Thanks
Title: Managesieve patch
Post by: mk_asdf on December 09, 2008, 08:24:56 AM
I have tried Konqueror 3.5.9 and Firefox 3. It doesn't work in any of them. I would like to provide you a bit more information, but unfortunately there is nothing interesting in Roundcube error log or in mail server logs.
Title: Managesieve patch
Post by: JohnDoh on December 10, 2008, 05:03:19 AM
I tried it in Knoqueror 3.5.5 and the deleting works. Without any error messages its difficult for me to know where to start looking. Where there any problems applying the patch may be? Sorry i dont have any more helpful suggestions, i am a bit stumpped!
Title: Managesieve patch
Post by: Aoster on December 12, 2008, 07:40:38 AM
Hello JohnDoh,

I have successfully patched roundcube with the sieve extension but have run into a little problem. When I create a rule which tests the subject for the occurrence of  a sting containing "<" everything from this character on will be dropped. I tried to find the place of this in the sources but could not find it.
Can you give me a hint how and where to change this behaviour?

hanks for your help

Andreas
Title: .2 compatibility
Post by: roe1234 on December 12, 2008, 09:53:22 AM
I saw in an above post that this will not work with 0.2.  Is this a permanent thing?  I really like this plug-in, and unfortunately I am experiencing some bugs in my current version of roundcube that need to be addressed, thus forcing my hand to upgrade.  I would really like to not lose this plug in though.
Title: cyrus
Post by: hosenhans on December 13, 2008, 07:53:42 AM
I just tried your patch with Cyrus timsieved v2.2.13 - and it almost works :) When I create new rules they look like

Code: [Select]
require [&quot;fileinto&quot;];
# rule:[zuz]
if anyof (header :contains &quot;Subject&quot; &quot;zuzu&quot;)
{
fileinto &quot;Trash&quot;;
}


Unfortunately this doesn't work because the folder structure of my IMAP server relies on the "INBOX"-prefix. So if I change the rule manually to the following, it works:

Code: [Select]
require ["fileinto"];
# rule:[zuz]
if anyof (header :contains "Subject" "zuzu")
{
fileinto "[B][COLOR=Green]INBOX.[/COLOR][/B]Trash";
}


Is there any way this could be set in the configuration file of your sieve plugin? Or maybe get the right configuration from roundcube?

Thanks
Title: Managesieve patch
Post by: JohnDoh on December 14, 2008, 09:56:49 AM
Hi, thanks for the feedback everyone...

Aoster: at the moment all html tags are stripped from the input (so anything starting with < ) i'm not quite sure what the best solution is yet but i will think about it, any ideas welcome.

roe1234: no, i dont plan on ever reverse engineering this patch back to work with older versions of RC, these patches work with the recent SVN versions which are way ahead of 0.2b

hosenhans: the folder code was copied from RC but i think i found the bit i missed, I have attached an updated patch to the first post and added a new config variable "include_imap_root" please try it.
Title: I'm illiterate
Post by: roe1234 on December 14, 2008, 07:57:29 PM
my fault, I mis-read your post, I thought it was only available for 0.1.1 - Great news that it is current, I just downloaded and installed the newest from SVN with your patch, so far so good.  Roundcube however does seem a bit more sluggish from SVN, but I imagine that will fix the release gets closer.
Title: Managesieve patch
Post by: hosenhans on December 15, 2008, 10:00:49 AM
JohnDoh,

thanks for the new patch. The sieve plugin works fine now wrt to the IMAP root setting :)

However I encountered a new problem. Whenever I edit the rules created by roundcube within another application the ruleset disappears in roundcube. By editing I don't necessarily mean changing the ruleset. Just opening and saving it unchanged in e.g. smartsieve (http://smartsieve.sourceforge.net/) or the Thunderbird sieve add-on (http://sieve.mozdev.org/) suffices. The rules won't show up in the Filters tab anymore then.
Title: Managesieve patch
Post by: vejoun on December 15, 2008, 10:44:55 AM
Hi,

Attached a little patch:
german (de_DE) localization for the last patch.

Regards,
Mike
Title: Managesieve patch
Post by: JohnDoh on December 15, 2008, 02:05:39 PM
hosenhans:
Quote from: JohnDoh;15525
The rule files on the server are written in a certain way that this code can understand so editing rules with other clients will not work.


i think all GUIs for managesieve have the same problem unless support for multiply types of syntax has been built in.

vejoun:thanks for the translation, i will see if i can add it to the patch with the next update.
Title: Managesieve patch
Post by: vejoun on December 15, 2008, 02:19:13 PM
Hi JohnDoh,

do you plan to add an checkbox near the filter in the filter list to simply disable/enable them? Now the filter must be deleted and new created.

Should "multiple_actions" work? I get always "server error", the filter cannot be saved.
dovecot 1.1.7 with dovecot-managesieve

PS: I've reuploaded the translation (2 typos fixed)
Title: Managesieve patch
Post by: hosenhans on December 15, 2008, 03:11:15 PM
JohnDoh,

sorry you had to quote yourself. It seems I have to stay with your sieve plugin only. Which isn't all that bad, because the user interface is well done :)
Title: Managesieve patch
Post by: JohnDoh on December 21, 2008, 11:11:34 AM
mk_asdf: I think I tracked down the problem with deleting rules, it only happened with the first rule and it should be fixed in the latest version of the patch (r2184).

Aoster: I had another look at the problem of putting “<” in the filter text. I have removed the stripping of HTML tags and instead encode/decode the characters as needed, this allows you to use “<” but I am not sure if it opens the script up to other problems.

Thanks again to everyone for their feedback. The new version also includes to possibility to disable a rule rather than delete it.
Title: Managesieve patch
Post by: timtraver on January 05, 2009, 07:45:26 PM
ok, trying to add your plugin, and am getting an odd behavior.

It appears to have patched properly (I used the latest stable release and used your patch). The only thing I had to do was remove the two entries to create the png images, because somehow, those weren't working.

But, the real issue, is that now when I go to use the "Filters" tab, nothing gets triggered, meaning nothing happens. I can click around on the Identities and Folders tabs, but the Filters tab simply doesn't work.

I noticed the URL that gets created from those tabs, and changed the URL to point to ?_task=settings&_action=sieverules and it did go to your sive filter page...

Does anyone have any idea as to why the tab isn't clicking??? Is it not enabled?

Thanks,

Tim.
Title: Managesieve patch
Post by: timtraver on January 05, 2009, 07:57:49 PM
wait...I found out that the patch to app.js failed.... not sure why, because I did it on the 0.2 stable release...

you may want to check your patches against that...I will see if I can find it...

Tim
Title: Managesieve patch
Post by: timtraver on January 05, 2009, 08:28:36 PM
ok, I found the issue.

I guess a recent development is to remove all of the comments and whitespace from the app.js to make it smaller, so there is now an app.js.src which has the full code that you patched against, and the app.js file is a stripped version.

So, not sure how you want to handle that....I suppose I can just change the patch locally to point to the src file and then remove the whitespace, or just copy the app.js.src file to the app.js file when finished...

Tim.
Title: Managesieve patch
Post by: JohnDoh on January 06, 2009, 06:26:16 AM
yes you are quite right. the version of 0.2 stable in the svn has regular JS files while the tarball on the RC site has compacted ones. I wonder why they are different, no matter, I will try and make a new version of the patch later for the compacted js files.
Title: Managesieve patch
Post by: JohnDoh on January 08, 2009, 05:03:59 PM
added a patch for the release version from the RC website, please see top post.
Title: Managesieve patch
Post by: swartel on January 10, 2009, 02:35:47 PM
Hi John,
I tried to patch RC 0.2 beta. All seem ok except for the file function.js that does not exist anymore in this release.
So, when I click on the tab, i get a blank page with the url ?_task=settings&_action=sieverules

What do I need to modify ? maybe something in app.js ?
Thanks by advance for your help ;)

Stephane
Title: Managesieve patch
Post by: JohnDoh on January 11, 2009, 05:21:09 AM
The patch is for version 0.2stable. It will not work with 0.2beta, the code uses functions that were not added until after 0.2beta was released.
Title: slurp existing file
Post by: roe1234 on January 11, 2009, 01:15:30 PM
I can't seem to get roundcube to see an existing rule file, written by hand.  I have ensured it is "active", meaning .dovecot-sieve is pointing to it, and that it is named "roundcube.sieve.  Any thoughts?
Title: Managesieve patch
Post by: JohnDoh on January 11, 2009, 01:29:26 PM
The rule files on the server are written in a certain way that this code can understand, if you wrote a rule by hand the script probably wont understand it unless you have used the right formatting.
Title: I would appreciate your indulgence
Post by: roe1234 on January 11, 2009, 07:27:48 PM
general pastebin - Mine - post number 1306161 (http://www.pastebin.ca/1306161)

this pastebin represent both the one "real" filter created by hand and a test one I created using your plugin.  I can't see a difference between the two formats.  It is altogether possible I am blind though.
Title: Managesieve patch
Post by: JohnDoh on January 12, 2009, 08:11:58 AM
I cant see a difference either. I loaded your rules into my sieve file and the plugin recognised them fine. Are there any errors in the RC error log or in the dovecot log?
Title: No Errors
Post by: roe1234 on January 12, 2009, 10:28:37 AM
The only thing that I can think is that we are not using the newest roundcube/patch combo.  We are still using the pre0.2stable version
Title: Managesieve patch
Post by: JohnDoh on January 12, 2009, 10:56:27 AM
do you mean 0.2beta or an SVN version?
Title: SVN version
Post by: roe1234 on January 12, 2009, 11:45:42 AM
and SVN version
Title: Managesieve patch
Post by: JohnDoh on January 12, 2009, 03:05:08 PM
hmm it definatly loads for me, which SVN version is it? can you attach the actual roundcube.sieve file? may be i am loosing something in copy/paste.
Title: Managesieve patch
Post by: oscar on January 15, 2009, 04:36:45 AM
Hi JohnDoe!

Patched my RC with your patchset (are you collaborating with Alec btw?) without problems. I'm running Dovecot 1.0 with pysieved. Everything works okay, except when trying to use "setflag". I just get a server error. I haven't tried everything else, but it seems the other functions work.. Any ideas?
Title: Managesieve patch
Post by: JohnDoh on January 15, 2009, 01:43:52 PM
Hi,

This patch is based on Alec's work but i am not actually colaborating with him. Could you send me any example of the rule you are trying to create and i will try it. I havent had any problems myself but i am testing using Dovecot Managesieve, may be there is something in the syntax pysieved doesnt like.
Title: Managesieve patch
Post by: oscar on January 15, 2009, 06:19:17 PM
Ok, it's always good to colaborate ;)

To reproduce for me:
"Match all messages"
"Mark message as" "whatever"

Would want to run ManageSieve for Dovecot, but I don't want to compile it myself just because of that.. So I'm using cmusieve, and it says that it supports a draft version of imapflags and notify (haven't tried notify myself):
LDA/Sieve - Dovecot Wiki (http://wiki.dovecot.org/LDA/Sieve#head-dbfc997c9116af04a80c35e44db9891dc629e1bf)

Please let me know if you want me to test anything.
Title: Managesieve patch
Post by: JohnDoh on January 16, 2009, 03:58:25 AM
ah you are quite right. setflag doesnt work when you select all messages. It works fine with the other 2 options :/ I will look into it.

colaboration is good but i think Alec is busy at the moment, he hasnt made a lot of updates to his patch recently.
Title: Managesieve patch
Post by: oscar on January 16, 2009, 05:13:02 AM
Using cmusieve/pysieved I can't get any setflag to work (the filtering itself works if I create the rule manually, it's just when I use the web interface).

So, setting "match all/any"  "Subject contains 'aa'" -> "setflag read"  doesn't work here either.

Let me know if I need to test anything directly against sieve or sievec (I'm guessing that's how pysieve checks and rejects stuff?)
Title: Managesieve patch
Post by: JohnDoh on January 16, 2009, 05:22:14 AM
Please try this: in plugins/sieverules/rcube_sieve_script.php, line 44, change 'imapflags' to 'setflag'.

I found a few JS bugs just now as well so I will release an updated version in the next few days any way.
Title: Managesieve patch
Post by: oscar on January 16, 2009, 06:06:18 AM
Nope sorry, still the same.
Title: Feature Request
Post by: roe1234 on January 18, 2009, 02:47:30 PM
I would like to use sieve to give users the ability to build a vacation message.  The MDA is ideal for this so people can choose *not* to automatically respond to spam and mailing-lists etc.  Keeping this in mind, is there a way to extend this plug-in to allow users to build a rudimentary body message with a "reply" option?
Title: Managesieve patch
Post by: JohnDoh on January 19, 2009, 05:47:10 AM
I'm sorry I dont understand.
Title: Clarification
Post by: roe1234 on January 19, 2009, 08:19:19 AM
For clarification, here is the rfc:

RFC 5230 - Sieve Email Filtering: Vacation Extension (http://tools.ietf.org/html/rfc5230)
Title: Problem with TLS
Post by: vejoun on January 21, 2009, 03:00:11 PM
With this config all is ok. I can see the rules and add rules.
Code: [Select]
$sieverules_config['managesieve_host'] = 'ssl.foo.de';
$sieverules_config['managesieve_port'] = 2000;
$sieverules_config['usetls'] = false;
$sieverules_config['folder_delimiter'] = null;
$sieverules_config['include_imap_root'] = FALSE;
$sieverules_config['ruleset_name'] = 'roundcube';
$sieverules_config['multiple_actions'] = TRUE;

If I change the conf to
Code: [Select]
$sieverules_config['usetls'] = true;
I see no rules. No error. I can create a rule which will be saved with an ok, but the rules list stays empty.

If I switch back to non-TLS the new rule appears.

The server is an dovecot 1.1.8 with build-in ManageSieve. I tested the managesieve port with telnet and with  gnutls-cli --starttls -p 2000 ssl.foo.de.
It behave the same with non-TLS and TLS.

Mike
Title: Managesieve patch
Post by: JohnDoh on January 22, 2009, 03:22:51 AM
This is a bug in the PEAR::Net_Sieve class (see PEAR :: Bug #14205 :: fetch the CAPABILITY string send after STARTTLS (http://pear.php.net/bugs/bug.php?id=14205)). There is a patch which fixes it so I will apply that in the next release.
Title: Managesieve patch
Post by: oscar on January 22, 2009, 09:57:11 AM
JohnDoh, did you have any further suggestions for the SetFlag issue?
Title: Managesieve patch
Post by: JohnDoh on January 22, 2009, 11:01:31 AM
oscar: please check your private messages. :)
Title: trouble applying patch
Post by: kuyaedz on January 27, 2009, 12:01:08 AM
I am using roundcube v0.2 stable and I'm unable to apply the patch sieverules.BETA.r2240.patch.

When I try to apply the patch I get the following:

Quote
[root@mail ~]# patch -ul -d /usr/local/www/roundcube/ -p1 < sieverules.BETA.r2240.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Naur --exclude='*.svn*' roundcube_svn/index.php roundcube_pub/index.php
|--- roundcube_svn/index.php    2009-01-18 11:24:41.000000000 +0000
|+++ roundcube_pub/index.php    2009-01-18 18:46:19.000000000 +0000
--------------------------
Patching file index.php using Plan A...
Hunk #1 succeeded at 193.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Naur --exclude='*.svn*' roundcube_svn/plugins/sieverules/add.png roundcube_pub/plugins/sieverules/add.png
|--- roundcube_svn/plugins/sieverules/add.png   1970-01-01 01:00:00.000000000 +0100
|+++ roundcube_pub/plugins/sieverules/add.png   2009-01-18 18:46:18.000000000 +0000
--------------------------
Patching file plugins/sieverules/add.png using Plan A...
patch: **** malformed patch at line 19: diff -Naur --exclude='*.svn*' roundcube/plugins/sieverules/config.inc.php roundcube_pub/plugins/sieverules/config.inc.php


Any tips?
Title: Managesieve patch
Post by: JohnDoh on January 27, 2009, 04:25:54 AM
a couple of things. first it looks like the patch may have been altered since you downloaded it from my site, there is no line `diff -Naur --exclude='*.svn*' roundcube/plugins/sieverules/config.inc.php` in my version it is `diff -Naur --exclude='*.svn*' roundcube_svn/plugins/sieverules/config.inc.php`

second if you are patching 0.2stable, the version from the RC website (not the SVN) then this patch will not work. Look in the older versions section and get the one for the release.
Title: Managesieve patch
Post by: kuyaedz on January 27, 2009, 05:31:20 PM
Quote from: JohnDoh;16705

second if you are patching 0.2stable, the version from the RC website (not the SVN) then this patch will not work. Look in the older versions section and get the one for the release.


ok, I reinstalled roundcube to make sure it was pristine and then tried this patch (http://www.tehinterweb.co.uk/roundcube/sieverules.BETA.r2198.patch) but I get a similar error.

Is there any more info I can give you toward finding the right patch for the right version?
Title: Managesieve patch
Post by: JohnDoh on January 28, 2009, 10:04:02 AM
I'm sorry you are having problems but i have run the patches again without problems. I know other people havent had problems either. The best thing i can suggest if the patches dont work for you is that you apply them manually (there is an html version of the diff to help with that).
Title: Managesieve patch
Post by: kuyaedz on January 28, 2009, 10:32:48 AM
Quote from: JohnDoh;16733
I'm sorry you are having problems but i have run the patches again without problems. I know other people havent had problems either. The best thing i can suggest if the patches dont work for you is that you apply them manually (there is an html version of the diff to help with that).


One last try here..

my install directory is /usr/local/www/roundcube.  The patch has paths for roundcube_svn and roundcube_pub.  Do I need to alter the patch to match my install path?  There has got to be some simple reason why I'm having trouble with this patch and not had trouble with others..

I'm running:
patch -ul -d /usr/local/www/roundcube/ -p1 < sieverules.BETA.r2198.patch

It appears to properly create the add.png and then crashes out on the next file in the patch.

Any other guesses?
Title: Managesieve patch
Post by: nmgl on February 04, 2009, 09:14:06 AM
Quote from: kuyaedz;16724
ok, I reinstalled roundcube to make sure it was pristine and then tried this patch (http://www.tehinterweb.co.uk/roundcube/sieverules.BETA.r2198.patch) but I get a similar error.

Is there any more info I can give you toward finding the right patch for the right version?

I have this error. It is due to the patch command. On FreeBSD, the patch command does not like the diff binary. So, the solution is to use a Linux, install a roundcube and patch it. And after, you can use these files.



Just another question. I see in the author page: More Sieve features like regexp, body, imapflags, comparators. And what about vacation? It's an important feature of Sieve. In my mind.
Title: Managesieve patch
Post by: JohnDoh on February 04, 2009, 10:08:03 AM
Thanks for the info about FreeBSD, I did not know that. Does it help if you use the --binary option for the patch command?

The sieverules patch has more features than the original script made my Alec, so far from that list it supports regexp, imapflags, comparators, and vacation. The changes are in the changelog but I should probably may them clearer. I will add the supported features to the readme.
Title: Managesieve patch
Post by: nmgl on February 06, 2009, 04:01:29 AM
Quote from: JohnDoh;16841
Thanks for the info about FreeBSD, I did not know that. Does it help if you use the --binary option for the patch command?

There's no --binary option in patch(1) (http://www.freebsd.org/cgi/man.cgi?query=patch&apropos=0&sektion=0&manpath=FreeBSD+7.1-RELEASE&format=html).

Quote from: JohnDoh;16841
The sieverules patch has more features than the original script made my Alec, so far from that list it supports regexp, imapflags, comparators, and vacation. The changes are in the changelog but I should probably may them clearer. I will add the supported features to the readme.

And where find this patch? I only know Alec patch (http://alec.pl/roundcube/managesieve/) (managesieve plugin).
Title: Managesieve patch
Post by: JohnDoh on February 08, 2009, 05:35:16 AM
its the patch this thread is all about... RoundCube Patches (http://www.tehinterweb.co.uk/roundcube)
Title: Managesieve patch
Post by: ridnhard19 on February 11, 2009, 01:19:45 PM
This is great!  I've applied this to .2 stable without any issues and its working great thus far with Cyrus IMAP/SIEVE.

Thanks for your hard work on this. :)
Title: Managesieve patch
Post by: nmgl on February 15, 2009, 04:59:36 AM
The patch has some errors.
I'm on a GNU/Linux Debian. I download roundcube from official website (http://roundcube.net/downloads) (0.2-stable). So, I'm on a clean and a from-scratch roundcube. No modifications. I want to use SieveRules patch (http://www.tehinterweb.co.uk/roundcube/#sieverules) (BETA.r2264.patch).And, when I apply the patch:

Code: [Select]
root@domain roundcubemail-0.2-stable # patch -ul -d /root/roundcubemail-0.2-stable -p1 < sieverules.BETA.r2264.patch
patching file index.php
Hunk #1 succeeded at 193 (offset -4 lines).
patching file plugins/sieverules/add.png
patching file plugins/sieverules/config.inc.php
patching file plugins/sieverules/help.png
patching file plugins/sieverules/Net_Sieve.php
patching file plugins/sieverules/rcube_sieve.php
patching file plugins/sieverules/rcube_sieve_script.php
patching file plugins/sieverules/sieverules_func.inc
patching file plugins/sieverules/sieverules.php
patching file program/js/app.js
Hunk #1 FAILED at 288.
Hunk #2 FAILED at 301.
Hunk #3 FAILED at 1080.
Hunk #4 FAILED at 2835.
4 out of 4 hunks FAILED -- saving rejects to file program/js/app.js.rej
patching file program/js/sieverules.js
patching file program/localization/en_US/labels.inc
patching file program/localization/en_US/messages.inc
patching file program/steps/settings/delete_sieverule.inc
patching file program/steps/settings/edit_sieverule.inc
patching file program/steps/settings/save_sieverule.inc
patching file program/steps/settings/sieverules_ajax.inc
patching file program/steps/settings/sieverules.inc
patching file skins/default/functions.js
patching file skins/default/includes/settingstabs.html
patching file skins/default/sieverules.css
patching file skins/default/templates/editsieverule.html
patching file skins/default/templates/sieverules.html


Code: [Select]
root@domain roundcubemail-0.2-stable # cat program/js/app.js.rej
***************
*** 288,293 ****

        case 'settings':
          this.enable_command('preferences', 'identities', 'save', 'folders', true);

          if (this.env.action=='identities' || this.env.action=='edit-identity' || this.env.action=='add-identity') {
            this.enable_command('add', this.env.identities_level < 2);
--- 288,294 ----

        case 'settings':
          this.enable_command('preferences', 'identities', 'save', 'folders', true);
+         this.enable_command('sieverules', true);

          if (this.env.action=='identities' || this.env.action=='edit-identity' || this.env.action=='add-identity') {
            this.enable_command('add', this.env.identities_level < 2);
***************
*** 300,305 ****
          if (this.env.action=='folders')
            this.enable_command('subscribe', 'unsubscribe', 'create-folder', 'rename-folder', 'delete-folder', true);

          if (this.gui_objects.identitieslist)
            {
            this.identity_list = new rcube_list_widget(this.gui_objects.identitieslist, {multiselect:false, draggable:false, keyboard:false});
--- 301,323 ----
          if (this.env.action=='folders')
            this.enable_command('subscribe', 'unsubscribe', 'create-folder', 'rename-folder', 'delete-folder', true);

+         if ((this.env.action=='sieverules' || this.env.action=='edit-sieverule' || this.env.action=='add-sieverule') && !this.env.sieveruleserror)
+           this.enable_command('add-sieverule', true);
+
+         if (this.env.action=='edit-sieverule' || this.env.action=='add-sieverule')
+           this.enable_command('save-sieverule', 'delete-sieverule', true);
+
+         if (this.gui_objects.sieveruleslist)
+           {
+           this.sievefilters_list = new rcube_list_widget(this.gui_objects.sieveruleslist, {multiselect:false, draggable:false, keyboard:false});
+           this.sievefilters_list.addEventListener('select', function(o){ sieverule_select(o); });
+           this.sievefilters_list.init();
+           this.sievefilters_list.focus();
+
+           if (!isNaN(this.env.iid))
+             this.sievefilters_list.highlight_row(this.env.iid);
+           }
+
          if (this.gui_objects.identitieslist)
            {
            this.identity_list = new rcube_list_widget(this.gui_objects.identitieslist, {multiselect:false, draggable:false, keyboard:false});
***************
*** 1062,1067 ****
          this.delete_folder(props);
          break;

        }

      return obj ? false : true;
--- 1080,1103 ----
          this.delete_folder(props);
          break;

+       case 'sieverules':
+         this.goto_url('sieverules', '', true);
+         break;
+
+       case 'add-sieverule':
+         this.goto_url('add-sieverule', '', true);
+         break;
+
+       case 'save-sieverule':
+         if (sieverules_check_input())
+           this.gui_objects.editform.submit();
+         break;
+
+       case 'delete-sieverule':
+         if (confirm(rcmail.get_label('filterdeleteconfirm')))
+           this.goto_url('delete-sieverule', '_iid=' + this.env.iid, true);
+         break;
+
        }

      return obj ? false : true;
***************
*** 2799,2804 ****
    /*********        user settings methods          *********/
    /*********************************************************/

    this.init_subscription_list = function()
      {
      var p = this;
--- 2835,2844 ----
    /*********        user settings methods          *********/
    /*********************************************************/

+   this.sieverules_updatelist = function(action, name, id) {
+     sieverules_updatelist(action, name, id);
+   }
+
    this.init_subscription_list = function()
      {
      var p = this;

Anybody could say me a roundcube version for this patch?
Title: Managesieve patch
Post by: JohnDoh on February 15, 2009, 06:09:59 AM
You are using the wrong version of the patch, as it says on the site you need a special version for the 0.2stable tarball becuase of the compressed JS files.

Click on "old versions" under SieveRules and you should see it.
Title: Managesieve patch
Post by: nmgl on February 15, 2009, 06:33:08 AM
Thanks a lot!

(need some help for the french translation?)
Title: Managesieve patch
Post by: JohnDoh on February 16, 2009, 06:20:55 AM
if you could make a french translation that would be create, there is a translator on the website that should show you all the text.
Title: Managesieve patch
Post by: Nyro on February 25, 2009, 02:36:00 PM
Quote from: JohnDoh;17068
if you could make a french translation that would be create, there is a translator on the website that should show you all the text.


Hi JohnDoh,

I can't use your plugin in my roundcube installation.
I just downloaded it from the roundcube website.

I read that I should'nt use the last version but a special one.
I used: sieverules.BETA.r2198.rl.patch

After running the patch command, it's not working. Clicking on the filters tab doesn't do anything at all.

I also tried with the last patched version and it's the same.

Once it will work, I'll be glad to create the French translation ;)
Title: Managesieve patch
Post by: JohnDoh on February 26, 2009, 03:36:52 AM
are there any JS errors or errors in the RC log? the file with .rl. in the name is the right one for the 0.2stable release. did it apply cleanly? it is possible that all you need to do is clear you cache, without any errors i cant tell what is wrong.
Title: Managesieve patch
Post by: Nyro on February 26, 2009, 03:47:21 AM
Quote from: JohnDoh;17315
are there any JS errors or errors in the RC log? the file with .rl. in the name is the right one for the 0.2stable release. did it apply cleanly? it is possible that all you need to do is clear you cache, without any errors i cant tell what is wrong.


Looks like you're right.
After cleaning my cache it worked perfectly...
Sorry for the noob error...

Attached are my translating files.
Hope it fits good, if an other French guy could review them to be sure it looks great regarding the sieve stuff (I'm totally new with that, so the French term could be different)
Title: Managesieve patch
Post by: JohnDoh on February 26, 2009, 02:00:49 PM
thats great thanks, i have added them to the site :D
Title: Managesieve patch
Post by: zamri on March 08, 2009, 05:00:12 AM
I use dbmail-timsieved which is compatible with cyrus-timsieve. I discovered that Sender is not working to filter emails based on sender. I discovered that roundcube used X-Sender. I tried to use that to filter mails by sender and it works.

How to adjust it to Sender by default. I mean Sender is actually means filter by X-Sender and users shouldn't be bothered to select other header?

i use dbmail 2.2.10 and roundcube 0.2stable.

Keep up with the good work John!. :)
Title: Managesieve patch
Post by: JohnDoh on March 08, 2009, 06:13:18 AM
Thanks.

Look in program/steps/settings/edit_sieverule.inc. Find `'from' => 'address::Sender',` and replace it with `'from' => 'header::X-Sender',`. I cant test it right now but I think it will work.

I had not realised that RC always uses X-Sender. Perhaps I should modify the code so when you look for Sender it checks both Sender and X-Sender automatically. What does everyone think? Can any one think of a better solution?
Title: Managesieve patch
Post by: zamri on March 08, 2009, 06:51:59 AM
Well i think you should put X-Sender instead of Sender in the dropdown list by default and get rid of Sender. Maybe in the future if RC revert to Sender, you can change it accordingly. :)

Any better idea?
Title: Managesieve patch
Post by: JohnDoh on March 08, 2009, 02:16:13 PM
I dont want to do that for 2 reasons, the first is a, slightly stupid, UI one, the option is called Sender not X-Sender and the second is that although RC uses X-Sender other clients use Sender, so simply switching from one to the other will solve nothing. ATM I am really not sure what the best solution is.
Title: Managesieve patch
Post by: zamri on March 10, 2009, 05:57:47 AM
Do u think RC shoud use Sender instead of X-Sender?
Title: Managesieve patch
Post by: zamri on March 11, 2009, 07:39:05 AM
I applied sieverules.BETA.r2264.patch into http://nightly.roundcube.net/trunk/roundcubemail-trunk-r2332-20090306.tgz successfully.

patching file index.php                                                                    
patching file plugins/sieverules/add.png                                                    
patching file plugins/sieverules/config.inc.php                                            
patching file plugins/sieverules/help.png                                                  
patching file plugins/sieverules/Net_Sieve.php                                              
patching file plugins/sieverules/rcube_sieve.php                                            
patching file plugins/sieverules/rcube_sieve_script.php                                    
patching file plugins/sieverules/sieverules_func.inc                                        
patching file plugins/sieverules/sieverules.php                                            
patching file program/js/app.js                                                            
Hunk #4 succeeded at 2839 (offset 4 lines).                                                
patching file program/js/sieverules.js                                                      
patching file program/localization/en_US/labels.inc                                        
patching file program/localization/en_US/messages.inc                                      
patching file program/steps/settings/delete_sieverule.inc                                  
patching file program/steps/settings/edit_sieverule.inc                                    
patching file program/steps/settings/save_sieverule.inc                                    
patching file program/steps/settings/sieverules_ajax.inc                                    
patching file program/steps/settings/sieverules.inc                                        
patching file skins/default/functions.js                                                    
patching file skins/default/includes/settingstabs.html                                      
patching file skins/default/sieverules.css                                                  
patching file skins/default/templates/editsieverule.html                                    
patching file skins/default/templates/sieverules.html        

When I clicked on the filter tab nothing happened. The reason I want to use this RC trunk is because it loads faster and many bugs have been fixed since 0.2stable.
Title: Managesieve patch
Post by: JohnDoh on March 11, 2009, 10:05:03 AM
well you can see from the output that the patch did not apply cleanly but i expect it is simply a caching issue, clear your cache and try again.

Also version 0.2.1 of RC has just been realsed, there are new versions of the patches for that.

about the X-Sender thing, no i dont think RC should use Sender, that should only be used when you are sure what you are putting in there is a valid email address.
Title: Managesieve patch
Post by: zamri on March 11, 2009, 10:36:51 AM
But it WORKED JOhn. I just have to relogin or clear browser's cache. thanks.
Title: 0d0a
Post by: roe1234 on March 12, 2009, 12:00:17 PM
I am trying to bring in an existing sieve filter file so that this patch recognizes the rules.  However, even though I did my best to make the file format *exactly* what this patch expects, still no dice.  The only difference I see is on a hex dump, the pattern this plug-in expects is '0a' (LF) but the characters I am supplying are '0d0a' (CR+LF).  I will work on trying to convert my file to jus 0a but I think this is a bug, if for no other reason 0d0a is more "correct"

**UPDATE**
Sorry got my dos and unix mixed up.  This is not anything to fix on your end
Title: List of folders
Post by: roe1234 on March 12, 2009, 12:26:47 PM
A use case scenario that might not have been thought of...

I am building sieve filters through the plugin while looking at the folders available in Tbird.  If a folder doesn't exist I create it in tbird (much quicker) but the roundcube plug-doesn't see the new folder until I logout and then log back in.

I'm not sure what can be done about this... perhaps populating that dropdown via javascript?
Title: 0d0a revisited
Post by: roe1234 on March 12, 2009, 06:39:31 PM
Well after further analysis, I found from the RFC:

RFC 5228           Sieve: An Email Filtering Language       January 2008


2.2.  Whitespace

   Whitespace is used to separate tokens.  Whitespace is made up of
   tabs, newlines (CRLF, never just CR or LF), and the space character.
   The amount of whitespace used is not significant.


So I guess this bug *is* a bug for the roundcube plugin
Title: Managesieve patch
Post by: JohnDoh on March 14, 2009, 06:02:06 AM
hmm i did not know that. It doesnt seem to stop my script working though, may be dovecot just doesnt care.

As a temporary fix you can swap
Code: [Select]
if ($tokens = preg_split('/(# rule:\[.*\])\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) {for
Code: [Select]
if ($tokens = preg_split('/(# rule:\[.*\])\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) {in plugins/sieverules/rcube_sieve_script.php
Title: Everything works fine
Post by: roe1234 on March 14, 2009, 09:01:48 AM
I've been playing with the sieve add-on for Tbird as well as this one.  The only "negative" side affect is that rules created by the tbird patch are not seen by the roundcube plugin because of the the CRLF, as soon as I remove the CR, it shows up.
Title: Exim sieve script file header
Post by: kokisan on March 30, 2009, 01:16:16 PM
Hi JohnDoh,
great work. I'm trying to run sieve script in Exim&Cyrus enviroment. There is a problem with generated .script file. Exim needs "# Sieve filter" on the first line of the file.
See Exim Filter Specification chapter 2 (http://www.exim.org/exim-html-4.40/doc/html/filter_2.html) for specification. When I add this text on the first line, the sieve script works fine. Is there any variable where can I add this first line prefix?
Title: Managesieve patch
Post by: JohnDoh on April 04, 2009, 06:11:13 AM
Hi Kokisan,
There is no config variable to set a header but its really easy to edit the script to do it. open plugins/sueverules/rcube_sieve_script.php, find this at the end of the as_text function:
Code: [Select]
// requires
$exts = array_unique($exts);
if (sizeof($exts))
$script = 'require [&quot;' . implode('&quot;,&quot;', $exts) . &quot;\&quot;];\n&quot; . $script;

return $script;

change it to something like:
Code: [Select]
// requires
$exts = array_unique($exts);
if (sizeof($exts))
$script = 'require ["' . implode('","', $exts) . "\"];\n" . $script;

return "# Sieve filter\n" . $script;
Title: Exim works
Post by: kokisan on April 08, 2009, 06:36:06 AM
Hi JohnDoh,
thank you for the patch. It works perfectly.
Title: avelsieve/Managesieve roundcube patch incompatible
Post by: jalbstmeijer on April 25, 2009, 11:45:27 AM
It seems both the 'managesieve roundcube patch' and the 'avelsieve squirrelmail plugin' depend on custom commented lines in the sieve script.
This seems to make it impossible to use both sieve extentions side by side.
Or is there an other reason,  the 'managesieve roundcube patch' does not see the 'avelsieve squirrelmail plugin' created rules.
By adding a rule trough 'managesieve roundcube patch', all 'avelsieve squirrelmail' rules get overwritten.

Justin.
Title: Managesieve patch
Post by: JohnDoh on April 27, 2009, 11:13:34 AM
Quote from: JohnDoh;15525
The rule files on the server are written in a certain way that this code can understand so editing rules with other clients will not work.

In a future version there should be a way to import filters from avelsieve (or others) into this plugin i think but at the moment there are no plans. I dont use avelsieve and have no examples to work from.
Title: Managesieve patch
Post by: myo on July 06, 2009, 09:36:21 AM
Hi!

Sorry for hijacking this thread but is there a way of getting a managesieve-patch for roundcube 0.2.2 stable? The latest managesieve-patch (r2400) doesn't work because of rejected hunks and i don't want to upgrade to roundcube 0.3-beta. Or is it possible to get the roundcube 0.3-beta managesieve-plugin working for roundcube 0.2.2?

I would be glad if someone could help me with my problem.

Greets
myo
Title: Managesieve patch
Post by: JohnDoh on July 07, 2009, 03:20:24 AM
I moved your post to the thread about the patch rather than the plugin, I hope thats OK. I'm guessing the only rejected hunks are in app.js, is that right? If so try renaming app.js.src to app.js and the patch r2400 patch might work.
Title: sieverules not working with roundcube 0.2.2
Post by: deichels on July 29, 2009, 12:56:21 PM
Hi,

I tried to rename app.js.src to app.js to get the sieverules.BETA.r2400.patch running with roundcube 0.2.2, but it didn't work. There is no "filter"-tab in the preferences in the frontend shown.

The problem seems to be regarding that output:

patching file plugins/sieverules/sieverules.php
patching file program/js/app.js
Hunk #1 FAILED at 287.
Hunk #2 FAILED at 300.
Hunk #3 FAILED at 1079.
Hunk #4 FAILED at 2843.
4 out of 4 hunks FAILED -- saving rejects to file program/js/app.js.rej

Is there any possibility to get the sieve-features running under the actual stable version of roundcube?

Thanks a lot,
Peter
Title: Managesieve patch
Post by: JohnDoh on July 30, 2009, 02:20:52 PM
Hi,

I just tried it and it defiantly works for me. The filter tab shows up just as expected. Can you track down why the patch didn’t apply? Have you applied any other patches? The only message I got was about an offset in program/localization/en_US/labels.inc. I think 0.3 stable will be out in a few weeks any way so if you really cant get it to apply then just wait till then and you can use the plugin. I know its an idea solution but its the best I can offer I'm afraid.