Example #1
0
 /**
  */
 public function listHeadersExist()
 {
     $lhdrs = new Horde_ListHeaders();
     return $lhdrs->listHeadersExist($this->_headers);
 }
Example #2
0
 /**
  * Adds all blocks necessary for the vacation rule.
  *
  * @param Ingo_Rule $rule  Rule object.
  */
 protected function _addVacationBlocks(Ingo_Rule $rule)
 {
     if (!count($rule)) {
         return;
     }
     $action = $tests = array();
     $action[] = new Ingo_Script_Sieve_Action_Vacation(array('subject' => $rule->subject, 'days' => $rule->days, 'addresses' => $rule->addresses, 'start' => $rule->start, 'start_year' => $rule->start_year, 'start_month' => $rule->start_month, 'start_day' => $rule->start_day, 'end' => $rule->end, 'end_year' => $rule->end_year, 'end_month' => $rule->end_month, 'end_day' => $rule->end_day, 'reason' => $rule->reason));
     if ($rule->ignore_list) {
         $lheaders = new Horde_ListHeaders();
         $headers = $lheaders->headers();
         $headers['Mailing-List'] = null;
         foreach (array_keys($headers) as $h) {
             $tests[] = new Ingo_Script_Sieve_Test_Not(new Ingo_Script_Sieve_Test_Exists(array('headers' => $h)));
         }
         $tests[] = new Ingo_Script_Sieve_Test_Not(new Ingo_Script_Sieve_Test_Header(array('headers' => 'Precedence', 'match-type' => ':is', 'strings' => "list\nbulk\njunk", 'comparator' => 'i;ascii-casemap')));
         $tests[] = new Ingo_Script_Sieve_Test_Not(new Ingo_Script_Sieve_Test_Header(array('headers' => 'To', 'match-type' => ':matches', 'strings' => 'Multiple recipients of*', 'comparator' => 'i;ascii-casemap')));
     }
     if (count($rule->exclude)) {
         $tests[] = new Ingo_Script_Sieve_Test_Not(new Ingo_Script_Sieve_Test_Address(array('headers' => "From\nSender\nResent-From", 'addresses' => implode("\n", $rule->exclude))));
     }
     $this->_addItem(Ingo::RULE_VACATION, new Ingo_Script_Sieve_Comment(_("Vacation")));
     if ($tests) {
         $test = new Ingo_Script_Sieve_Test_Allof($tests);
         $if = new Ingo_Script_Sieve_If($test);
         $if->setActions($action);
         $this->_addItem(Ingo::RULE_VACATION, $if);
     } else {
         $this->_addItem(Ingo::RULE_VACATION, $action[0]);
     }
 }