1<?php 2/** 3 * Copyright 2011-2017 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file COPYING for license information (GPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/gpl. 7 * 8 * @category Horde 9 * @copyright 2011-2017 Horde LLC 10 * @license http://www.horde.org/licenses/gpl GPL 11 * @package IMP 12 */ 13 14/** 15 * Handle "automatically generated" message search query. 16 * 17 * RFC 3834 defines a method to indicate whether a message was automatically 18 * generated without explicit user direction. This search object queries 19 * the message headers for this information. 20 * 21 * @author Michael Slusarz <slusarz@horde.org> 22 * @category Horde 23 * @copyright 2011-2017 Horde LLC 24 * @license http://www.horde.org/licenses/gpl GPL 25 * @package IMP 26 */ 27class IMP_Search_Element_Autogenerated extends IMP_Search_Element 28{ 29 /** 30 * Constructor. 31 * 32 * @param boolean $not If true, do a 'NOT' search of $text. 33 */ 34 public function __construct($not = false) 35 { 36 /* Data element: (integer) Do a NOT search? */ 37 $this->_data = intval(!empty($not)); 38 } 39 40 /** 41 */ 42 public function createQuery($mbox, $queryob) 43 { 44 $search_ob = new Horde_Imap_Client_Search_Query(); 45 46 $ob1 = clone $search_ob; 47 $ob1->headerText('auto-submitted', 'auto-generated', $this->_data); 48 49 $ob2 = clone $search_ob; 50 $ob2->headerText('auto-submitted', 'auto-replied', $this->_data); 51 52 $queryob->orSearch(array($ob1, $ob2)); 53 54 return $queryob; 55 } 56 57 /** 58 */ 59 public function queryText() 60 { 61 return ($this->_data ? _("not") . ' ' : '') . _("Automatically Generated Messages"); 62 } 63 64} 65