summaryrefslogtreecommitdiff
path: root/www/admin/user/forward.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/admin/user/forward.php')
-rw-r--r--www/admin/user/forward.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/www/admin/user/forward.php b/www/admin/user/forward.php
index 3da8131..f183f7e 100644
--- a/www/admin/user/forward.php
+++ b/www/admin/user/forward.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ * Copyright (c) 2004 Klarälvdalens Datakonsult AB
*
* Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
@@ -52,6 +52,15 @@ if( !$errors ) {
$obj = $ldap->read( $auth->dn() );
$sieve =& new Net_Sieve( $auth->uid(), $auth->password(), $obj['kolabHomeServer'][0] );
+ // Fetch script data from server
+ $scripts = $sieve->listScripts();
+ if( in_array( "kolab-deliver.siv", $scripts ) ) {
+ $deliverscript = $sieve->getScript( $scriptname );
+
+ if( ereg('fileinto "INBOX/(.*)";', $deliverscript, $regs ) ) {
+ $inbox = $regs[1];
+ }
+ }
// Update sieve script on server in case we have submit data
if( $_REQUEST['submit'] ) {
@@ -63,7 +72,10 @@ if( !$errors ) {
$errors[] = _('Please enter an email address');
} else {
$script =
- "redirect \"".addslashes($address)."\";".($keep?" keep;":"");
+ "require \"fileinto\";\r\nredirect \"".addslashes($address)."\";".($keep?" keep;":"");
+ if( $inbox ) {
+ $script .= "\r\nif header :contains [\"X-Kolab-Scheduling-Message\"] [\"FALSE\"] {\r\nfileinto \"INBOX/$inbox\";\r\n}\r\n";
+ }
if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) {
$errors[] = $res->getMessage();
$errors[] = _('Script was:');
@@ -80,8 +92,6 @@ if( !$errors ) {
}
}
- // Fetch script data from server
- $scripts = $sieve->listScripts();
if( in_array( $scriptname, $scripts ) ) {
$script = $sieve->getScript( $scriptname );
if( ereg('redirect "(.*)";', $script, $regs ) ) {