[horde] IMP: default search folder patch

Peter Abrahamsen peidran at u.washington.edu
Thu Oct 30 00:29:08 PST 2003


Apologies for posting to this list, but I'm not subscribed to the IMP list.
I hacked up some code to try to make a more intelligent guess about what
folder the user wants to search. It's my first attempt at working with Horde
or IMP, and I'm no spiffy PHP coder, so this patch should be reviewed for
sanity. It does, however, Work For Me(tm).

Cheers,

Peter

-- 
Peter Abrahamsen              Seattle, Washington, USA
CEP, Phil, iSchool            http://www.abrahamsen.com/peter/
University of Washington      206.525.2702 (home)
"I can't see the lines I used to think I could read between" - Eno
-------------- next part --------------
--- imp/search.php.dist     2003-10-30 00:18:49.000000000 -0800
+++ imp/search.php  2003-10-30 00:22:37.000000000 -0800
@@ -224,7 +224,17 @@
     $total = ceil(count($mailboxes) / 3);
 
     if (empty($search['folders'])) {
-        $search['folders'][] = 'INBOX';
+        /* Try to guess what folder the user wants to search */
+        if (!empty($imp['mailbox']) && $imp['mailbox'] != IMP_SEARCH_MBOX) {
+            $search['folders'][] = $imp['mailbox'];
+        } elseif (!empty($imp['thismailbox']) && $imp['mailbox'] != IMP_SEARCH_MBOX) {
+            $search['folders'][] = $imp['thismailbox'];
+        } elseif ($prefs->getValue('initial_page') &&
+                  $prefs->getValue('initial_page') != 'folders.php') {
+            $search['folders'][] = IMP::addPreambleString($prefs->getValue('initial_page'));
+        } else {
+            $search['folders'][] = 'INBOX';
+        }
     }
 
     foreach ($mailboxes as $mbox) {


More information about the horde mailing list