Author Topic: Managesieve patch  (Read 56940 times)

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Managesieve patch
« 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 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
« Last Edit: June 09, 2009, 01:22:22 PM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline mk_asdf

  • Newbie
  • *
  • Posts: 2
Deleting rules
« Reply #1 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.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Managesieve patch
« Reply #2 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
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline mk_asdf

  • Newbie
  • *
  • Posts: 2
Managesieve patch
« Reply #3 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.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Managesieve patch
« Reply #4 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!
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline Aoster

  • Newbie
  • *
  • Posts: 3
Managesieve patch
« Reply #5 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

Offline roe1234

  • Jr. Member
  • **
  • Posts: 20
.2 compatibility
« Reply #6 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.

Offline hosenhans

  • Jr. Member
  • **
  • Posts: 30
cyrus
« Reply #7 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

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Managesieve patch
« Reply #8 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.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline roe1234

  • Jr. Member
  • **
  • Posts: 20
I'm illiterate
« Reply #9 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.

Offline hosenhans

  • Jr. Member
  • **
  • Posts: 30
Managesieve patch
« Reply #10 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 or the Thunderbird sieve add-on suffices. The rules won't show up in the Filters tab anymore then.

Offline vejoun

  • Newbie
  • *
  • Posts: 3
Managesieve patch
« Reply #11 on: December 15, 2008, 10:44:55 AM »
Hi,

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

Regards,
Mike
« Last Edit: December 16, 2008, 08:14:25 AM by vejoun »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Managesieve patch
« Reply #12 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.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline vejoun

  • Newbie
  • *
  • Posts: 3
Managesieve patch
« Reply #13 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)

Offline hosenhans

  • Jr. Member
  • **
  • Posts: 30
Managesieve patch
« Reply #14 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 :)