it might be possible to solve both of these in the same (possibly slightly ineligant) solution. the roundcube ruleset is activated each time save is pressed unless there the multiple ruleset feature is enabled. when the save is completed a hook could be executed to allow any one to do anything they want, in this case, set the active one back to the ispconfig one and copy the rules into ispconfig. what do you think?
I'm not quite sure if I understood what you meant. But I rather think it's the right way to modify the save function. (What do you mean with multiple ruleset feature? That more than one condition / rule is applied to one filter?)
if not you just need to modify the save function, somewhere around line 920 in the repo version of sieverules.php
Yeah - we found that line and tried to modify it by inserting a function. A set of problems arised (to be honest: we are not php-godlords):
We defined our script as function at the beginning of sieverules.php:
and then called the function:
if ($save && $result === true) {
$this->api->output->command('display_message', $this->gettext('filtersaved1'), 'confirmation');
//osterhase inserted:
$user = 'testen@domain.net';
api_ispconfig($user);
// end of insert
if ($script['disabled'] == 1)
$filter_name = $script['name'] . ' (' . $this->gettext('disabled') . ')';
else
$filter_name = $script['name'];
The function was actually executed but we stumbled over the security concept of our servers:
Aug 18 10:23:01 flux01 roundcube: PHP Warning: file(/var/vmail/domain.net/testen/sieve/roundcube.sieve): failed to open stream: Die Operation ist nicht erlaubt in /var/www/clients/client7/web45/web/plugins/sieverules/sieverules.php on line 56
The problem there is that the user which executes the script is not allowed to leave his web-directory and so we cannot read in the roundcube.sieve-file. This lead us to the general question how the sieverule-plugin is doing that (I assumed that it would do that via connecting to the managesieve-server and let this one do the changes in the maildir) - is that correct?
This is the first and major problem we have in customizing the sieverule-plugin - how to bypass our own security concept. Actually sounds weird...
My only idea at the moment is to get sieverules.php to save the roundcube.sieve file temporarlly in the tmp directory of roundcube until it is read in by the api_ispconfig function. Any other suggestions?
Edit: Is it possible to catch the content of roundcube.sieve before it is actually written? If yes, with which variable can it be called? So it would be possible to replace $spamfilter with that.
do you mean the sieve variables extension? there is limited support for that when doing fileinto and for setting the the from address on vacation messages but thats about it.
As you can see in the inserted lines we actually need the email-address of the current email-user to determine the correct database entry - my question was rather directed into this direction.
I've attached the modified sieverules.php (the "prints" are for debugging - obviously) and would be really thankful if you would have further suggestions.