data .= $node['text']; } } function execute() { $str ="
"._("Comment"); $str .=""; $str .="
"; return($str); } } class sieve_require { var $data = array(); function sieve_require($data) { foreach($data['ELEMENTS'] as $node ){ if(in_array($node['class'],array("quoted-string","text"))){ $this->data[] = preg_replace("/\"/","",$node['text']); } } } function execute() { $str = "
"._("Script includes"); foreach($this->data as $req){ $str .= " ".$req.""; } $str .="
"; return($str); } } class sieve_discard { var $data = array(); function sieve_discard($data) { } function execute() { $str = "
"._("Discard message"); $str .="
"; return($str); } } class sieve_reject { var $data = array(); function sieve_reject($data) { $str = ""; foreach($data['ELEMENTS'] as $node ){ if(in_array($node['class'],array("quoted-string","text"))){ $str .= $node['text']; } } $this->data = preg_replace("/\"/","",$str); } function execute() { $str = "
"._("Reject mail"); $str .= " "; $str .="
"; return($str); } } class sieve_redirect { var $data = array(); function sieve_redirect($data) { foreach($data['ELEMENTS'] as $node ){ if(in_array($node['class'],array("quoted-string","text"))){ $this->data[] = $node['text']; } } } function execute() { $str = "
"._("Redirect to"); foreach($this->data as $dest){ $str .= "
"; } $str .="
"; return($str); } } class sieve_fileinto { var $data = array(); function sieve_fileinto($data) { foreach($data['ELEMENTS'] as $node ){ if(in_array($node['class'],array("quoted-string","text"))){ $this->data[] = preg_replace("/\"/","",$node['text']); } } } function execute() { $str = "
"._("File into"); $str .= ""; $str .="
"; return($str); } } class sieve_vacation { var $days = FALSE; var $subject = FALSE; var $from = ""; var $mime = ""; var $hanlde = ""; var $reason = ""; var $addresses= array(); function sieve_vacation($data) { /* Usage: vacation [":days" number] [":subject" string] [":from" string] [":addresses" string-list] [":mime"] [":handle" string] */ /* Not all attribute types are supported by the sieve class right now */ $known_attrs = array(":days",":subject",":from",":mime",":handle"); /* Walk through elements */ for($i = 0 ; $i < count($data['ELEMENTS']) ; $i ++){ /* get current element */ $node = $data['ELEMENTS'][$i]; /* Check if tag is in the specified list of attributes */ if($node['class'] == "tag" && in_array($node['text'],$known_attrs)){ $var = preg_replace("/\:/","",$node['text']); $this->$var = $data['ELEMENTS'][$i+1]['text']; $i ++; } /* Check for addresses */ if($node['class'] == "tag" && $node['text'] == ":addresses") { $this->addresses = array(); $i ++; /* Multiple or single address given */ if($data['ELEMENTS'][$i]['class'] == "left-bracket"){ while($data['ELEMENTS'][$i]['class'] != "right-bracket" && ($i < count($data['ELEMENTS']))){ $i ++; if($data['ELEMENTS'][$i]['class'] == "quoted-string"){ $this->addresses[] = preg_replace("/\"/i","",$data['ELEMENTS'][$i]['text']); } } }else{ $this->addresses[] = $data['ELEMENTS'][$i]['text'] ; } } /* Add the vacation message */ if($node['class'] == "quoted-string"){ $this->reason = $node['text']; } } } function execute() { $str =""; $str .=""._("Vacation message").""; foreach($this->addresses as $addr){ $str .="
"; } $str .="
"; return($str); } } class sieve_block_start { function execute() { return("
"); } } class sieve_block_end { function execute() { return("
"); } } /* This class handles the keep statement */ class sieve_keep { function execute() { $str = "
". _("Keep message"); $str .="
"; return($str); } } /* This class handles the stop statement */ class sieve_stop { function execute() { $str = "
". _("Stop here"); $str .="
"; return($str); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>