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