// // Bulk filter, enabled by default
// new IMP_Search_Filter_Bulk(array(
// 'disable' => false
+ // )),
+ // // Mailing list filter, enabled by default
+ // new IMP_Search_Filter_Mailinglist(array(
+ // 'disable' => false
// ))
// ))
- 'value' => 'a:1:{i:0;C:22:"IMP_Search_Filter_Bulk":88:{a:3:{s:1:"c";a:1:{i:0;C:23:"IMP_Search_Element_Bulk":5:{[1,0]}}s:1:"e";i:1;s:1:"v";i:1;}}}'
+ 'value' => 'a:2:{i:0;C:22:"IMP_Search_Filter_Bulk":88:{a:3:{s:1:"c";a:1:{i:0;C:23:"IMP_Search_Element_Bulk":5:{[1,0]}}s:1:"e";i:1;s:1:"v";i:1;}}i:1;C:29:"IMP_Search_Filter_Mailinglist":95:{a:3:{s:1:"c";a:1:{i:0;C:30:"IMP_Search_Element_Mailinglist":5:{[1,0]}}s:1:"e";i:1;s:1:"v";i:1;}}}'
);
v5.0-git
--------
+[mms] Add mailing list message filter (Request #8659).
[mms] Add ability to define search criteria to be applied to any mailbox
(Request #8659).
[mms] Use recipient search (To/Cc/Bcc) by default instead of To search.
}
break;
+ case 'IMP_Search_Element_Mailinglist':
+ this.insertFilter('mailinglist', crit);
+ break;
+
case 'IMP_Search_Element_Or':
this.insertOr();
break;
--- /dev/null
+<?php
+/**
+ * This class handles the mailing list search query.
+ *
+ * Uses the List-Id header defined by RFC 2919 to identify mailing list
+ * messages.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/gpl.html GPL
+ * @package IMP
+ */
+class IMP_Search_Element_Mailinglist extends IMP_Search_Element
+{
+ /**
+ * Constructor.
+ *
+ * @param boolean $not If true, do a 'NOT' search of $text.
+ */
+ public function __construct($not = false)
+ {
+ /* Data element: (integer) Do a NOT search? */
+ $this->_data = intval($not);
+ }
+
+ /**
+ * Adds the current query item to the query object.
+ *
+ * @param Horde_Imap_Client_Search_Query The query object.
+ *
+ * @return Horde_Imap_Client_Search_Query The query object.
+ */
+ public function createQuery($queryob)
+ {
+ $queryob->headerText('list-id', '', $this->_data);
+
+ return $queryob;
+ }
+
+ /**
+ * Return search query text representation.
+ *
+ * @return array The textual description of this search element.
+ */
+ public function queryText()
+ {
+ return ($this->_data ? _("not") . ' ' : '') . _("Mailing List Message");
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * This class provides a filter for mailing list messages.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/gpl.html GPL
+ * @package IMP
+ */
+class IMP_Search_Filter_Mailinglist extends IMP_Search_Filter
+{
+ /**
+ * Can this query be edited?
+ *
+ * @var boolean
+ */
+ protected $_canEdit = false;
+
+ /**
+ * List of serialize entries not to save.
+ *
+ * @var array
+ */
+ protected $_nosave = array('i', 'l');
+
+ /**
+ * Constructor.
+ *
+ * The 'add', 'id', 'label', and 'mboxes' parameters are ignored.
+ *
+ * @see parent::__construct()
+ */
+ public function __construct(array $opts = array())
+ {
+ $this->enabled = empty($opts['disable']);
+
+ $this->add(new IMP_Search_Element_Mailinglist());
+
+ $this->_init();
+ }
+
+ /**
+ * Initialization tasks.
+ */
+ protected function _init()
+ {
+ $this->_id = 'filter_mlist';
+ $this->_label = _("Mailing List Messages");
+ }
+
+ /**
+ * Unserialization.
+ *
+ * @param string $data Serialized data.
+ *
+ * @throws Exception
+ */
+ public function unserialize($data)
+ {
+ parent::unserialize($data);
+ $this->_init();
+ }
+
+}
'label' => _("Bulk Messages"),
'type' => 'filter'
),
+ 'mailinglist' => array(
+ 'label' => _("Mailing List Messages"),
+ 'type' => 'filter'
+ ),
);
/* Define some constants. */
);
break;
+ case 'mailinglist':
+ $c_list[] = new IMP_Search_Element_Mailinglist(
+ $val->n
+ );
+ break;
+
case 'flag':
/* Flag search. */
$formdata = $imp_flags->parseFormId($val->v);