seantis/Roundcube-Plugin-SieveRules-Managesieve

Name: Roundcube-Plugin-SieveRules-Managesieve

Owner: seantis gmbh

Description: Adds a 'Filters' tab to the 'Personal Settings' to allow the user to manage their Sieve mail rules.

Created: 2016-06-28 09:44:04.0

Updated: 2016-06-28 09:44:05.0

Pushed: 2016-06-09 16:08:35.0

Homepage: http://plugins.roundcube.net/packages/johndoh/

Size: 1353

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Roundcube Webmail SieveRules

This plugin adds the ability for users to manage their sieve mail filter rules. Inspiration and most of the code for this plugin was taken from: Aleksander Machniak - original Roundcube managesieve patch Tested with Dovecot-managesieve

ATTENTION

This is just a snapshot from the GIT repository and is NOT A STABLE version of SieveRules. It is Intended for use with the GIT-master version of Roundcube and it may not be compatible with older versions. Stable versions of SieveRules are available from the Roundcube plugin repository (for 1.0 and above) or the releases section of the GitHub repository.

Requirements
Supported Extensions

comparators envelope fileinto imapflags/imap4flags notify/enotify regex reject/ereject relational subaddress vacation vacation-seconds body copy spamtest virustest variables date editheader

License

This plugin is released under the GNU General Public License Version 3+.

Even if skins might contain some programming work, they are not considered as a linked part of the plugin and therefore skins DO NOT fall under the provisions of the GPL license. See the README file located in the core skins folder for details on the skin license.

Install

NB: When downloading the plugin from GitHub you will need to create a directory called sieverules and place the files in there, ignoring the root directory in the downloaded archive.

Config

The default config file is plugins/sieverules/config.inc.php.dist Rename this to plugins/sieverules/config.inc.php

Predefined rules

The predefined rules option allows you specify a set of simple rules which are available in the UI identified by their name. All other rule options are hidden when a predefined rule is selected.

The following options are available in each field:

The name, header, and target fields do not have set values

Examples:

  1. Simple spam filter:

    y(
    e' => 'Is Spam',
    e' => 'header',
    der' => 'X-Spam-Flag',
    rator' => 'exists',
    ra' => '',
    get' => '')
    
  2. Big message filter:

    y(
    e' => 'Big messages',
    e' => 'size',
    der' => '',
    rator' => 'over',
    ra' => '',
    get' => '5M')
    
  3. Spam score filter:

    y(
    e' => 'Definitely spam',
    e' => 'header',
    der' => 'X-Spam-Score',
    rator' => 'value "ge"',
    ra' => 'i;ascii-numeric',
    get' => '10')
    
Advanced editor

The advanced editor allows users to edit the sieve file directly, without the restrictions of the UI. Please note any changes made to the file directly which cannot be parsed by the script will be lost if rules are saved in the normal mode.

IMPORTANT: There is no validation of the script, please be careful when editing it directly or you could break all your filtering!

Default sieve rule file

If a default sieve rule file is specified then when a user has no sieve rules defined this file is loaded instead and the rules are displayed just as if they belong to the user. The file can be stored any where on your server and the user under which your web server runs must have permission to read it. The file must be in a the format that SieveRules can understand the easiest way to do this is to create the initial file using this plugin.

Example sieve rule file

If an example sieve rule file is specified then the filters from this script are loaded and displayed in a list in the bottom right of the screen. Users can select one of these example rules, it will load in the just as one of their rules, edit it and then save it to their rule set. The file can be stored any where on your server and the user under which your web server runs must have permission to read it. The file can be stored any where on your server and the user under which your web server runs must have permission to read it. The file must be in a the format that SieveRules can understand the easiest way to do this is to create the initial file using this plugin.

Import existing rulesets

The plugin contains a basic import system and 2 example import filters. These filters are not perfect, use them with care you may lose some rule data! You can create your own filter (or modify existing ones). To create an import filter you must either rename one of the example files by removing .ex from the end of the file name or create your own file in the importFilters directory. The file must contain a class named 'srimport_[filename]'. Each import filter must have:

The importer function can return either a string to be parsed by the SieveRules parser or an array, similar to the one created by the SieveRules parser.

The structure of the rule file

By default this plugin uses \r\n to seperate lines (RFC 5228) if you want to use \n instead then set

ne('RCUBE_SIEVE_NEWLINE', "\n");

in your config. Add

ne('RCUBE_SIEVE_INDENT', "\t");

to change the indent character. By default this plugin places a simple comment at the top of the rule file to show it was generated by the plugin. This header can be overridden by setting

ne('RCUBE_SIEVE_HEADER', "## Generated by Roundcube SieveRules ##");

in your config.

sieverules_connect hook

This hook is triggered right before connecting to the managesieve server and can be used to change connection details dynamically Arguments/Return:

sieverules_init hook

This hook allows other plugins to manipulate the default values displayed in the UI. Arguments/Return:

sieverules_load hook

Before filter information is loaded into the UI the plugin hook sieverules_load is executed, this allows you to perform any custom actions like hiding rules you dont want end users to see.

NOTE: rules removed using this hook will need to be added back via the sieverules_save hook if you want to keep them on the server. Arguments:

Return:

sieverules_save hook

Before filter information is saved to the managesieve server the plugin hook sieverules_save is executed, this allows you to perform any custom actions like updating another system or performing further validation. Arguments:

Return:

sieverules_list_rules hook

Before the list of rules is displayed in the UI the plugin hook sieverules_list_rules is executed, this allows you to hide rules from the list. It affects display only not the raw rules. Arguments:

Return:

sieverules_list_rulesets hook

Before the list of rulesets is displayed in the UI the plugin hook sieverules_list_rulesets is executed, this allows you to hide rulesets from the list. It affects display only not the raw rules. Arguments:

Return:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.