$_prefs['filter'] = array(
// 'value' => serialize(array(
+ // // Attachments filter, enabled by default
+ // new IMP_Search_Filter_Attachment(array(
+ // 'disable' => false
+ // )),
// // 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
+ // )),
+ // // Personal filter, enabled by default
+ // new IMP_Search_Filter_Personal(array(
+ // 'disable' => false
// ))
// ))
- 'value' => 'a:3:{i:0;C:22:"IMP_Search_Filter_Bulk":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}i:1;C:29:"IMP_Search_Filter_Mailinglist":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}i:2;C:26:"IMP_Search_Filter_Personal":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}}'
+ 'value' => 'a:4:{i:0;C:28:"IMP_Search_Filter_Attachment":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}i:1;C:22:"IMP_Search_Filter_Bulk":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}i:2;C:29:"IMP_Search_Filter_Mailinglist":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}i:3;C:26:"IMP_Search_Filter_Personal":30:{a:2:{s:1:"e";i:1;s:1:"v";i:1;}}}'
);
v5.0-git
--------
+[mms] Add attachment message filter.
[mms] Add post_spam hook called after reporting spam/ham (Request #6455).
[mms] Implement stationery support in DIMP.
[mms] Add preference to control displayed content for multipart/alternative
--- /dev/null
+<?php
+/**
+ * This class handles the attachment search query.
+ *
+ * Right now, uses a tremendously simplistic algorithm: it checks if the
+ * base part is 'multipart/mixed' or 'message/rfc822'.
+ *
+ * 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_Attachment 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);
+ }
+
+ /**
+ */
+ public function createQuery($mbox, $queryob)
+ {
+ $ob = new Horde_Imap_Client_Search_Query();
+ $ob2 = clone $ob;
+ $ob3 = clone $ob;
+
+ $ob->headerText('content-type', 'multipart/mixed');
+ $ob2->headerText('content-type', 'message/rfc822');
+
+ /* These searches are OR'd together. Only 1 must match. */
+ $ob3->orSearch(array($ob, $ob2));
+
+ /* ...but the combined OR search must be AND'd with the rest of the
+ * search terms. */
+ $queryob->andSearch(array($ob3));
+
+ return $queryob;
+ }
+
+ /**
+ */
+ public function queryText()
+ {
+ return $this->_data
+ ? _("messages without attachment(s)")
+ : _("messages with attachment(s)");
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * This class provides a filter for messages with attachments.
+ *
+ * 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_Attachment extends IMP_Search_Filter_Builtin
+{
+ /**
+ */
+ protected function _init()
+ {
+ $this->_id = 'filter_attach';
+ $this->_label = _("Messages with Attachments");
+
+ $this->add(new IMP_Search_Element_Attachment());
+ }
+
+}
'label' => _("Bulk Messages"),
'type' => 'filter'
),
+ 'attach' => array(
+ 'label' => _("Contains Attachment(s)"),
+ 'type' => 'filter'
+ ),
'mailinglist' => array(
'label' => _("Mailing List Messages"),
'type' => 'filter'
);
break;
+ case 'attach':
+ $c_list[] = new IMP_Search_Element_Attachment(
+ $val->n
+ );
+ break;
+
case 'mailinglist':
$c_list[] = new IMP_Search_Element_Mailinglist(
$val->n