[geary] Allow from:me/to:me/etc. in search box



commit 48944449a2bf8ce014e3d43ce49611e3c6efa3f3
Author: Charles Lindsay <chaz yorba org>
Date:   Fri Feb 14 12:53:10 2014 -0800

    Allow from:me/to:me/etc. in search box
    
    This simply replaces the "me" with your email address.  Highlighting
    follows suit.
    
    Closes: bgo #720875

 src/engine/imap-db/imap-db-account.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index dde70cb..db21827 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -656,6 +656,11 @@ private class Geary.ImapDB.Account : BaseObject {
         /// messages received by a particular person.
         field_names.set(_("to"), "receivers");
         
+        // Fields we allow the token to be "me" as in from:me.
+        string[] addressable_fields = {
+            _("bcc"), _("cc"), _("from"), _("to"),
+        };
+        
         // If they stopped at "field:", treat it as if they hadn't typed the :
         if (Geary.String.is_empty_or_whitespace(parts[1])) {
             token = parts[0];
@@ -665,6 +670,12 @@ private class Geary.ImapDB.Account : BaseObject {
         string key = parts[0].down();
         if (key in field_names.keys) {
             token = parts[1];
+            if (key in addressable_fields) {
+                // "me" can be typed like from:me or cc:me, etc. as a shorthand
+                // to find mail to or from yourself in search.
+                if (token.down() == _("me"))
+                    token = account_information.email;
+            }
             return field_names.get(key);
         }
         


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]