commit c5d67b5b6c7f6185a2d2d742025624441d0827f4
parent 4e2734082bebee27bcedead1e58d542ce3d4c78b
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Fri, 9 Apr 2010 13:22:32 -0700
Merge branch 'master' into next
Diffstat:
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -293,22 +293,6 @@ EOS
end
end
- ## if we see a label:deleted or a label:spam term anywhere in the query
- ## string, we set the extra load_spam or load_deleted options to true.
- ## bizarre? well, because the query allows arbitrary parenthesized boolean
- ## expressions, without fully parsing the query, we can't tell whether
- ## the user is explicitly directing us to search spam messages or not.
- ## e.g. if the string is -(-(-(-(-label:spam)))), does the user want to
- ## search spam messages or not?
- ##
- ## so, we rely on the fact that turning these extra options ON turns OFF
- ## the adding of "-label:deleted" or "-label:spam" terms at the very
- ## final stage of query processing. if the user wants to search spam
- ## messages, not adding that is the right thing; if he doesn't want to
- ## search spam messages, then not adding it won't have any effect.
- query[:load_spam] = true if subs =~ /\blabel:spam\b/
- query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
-
## gmail style "is" operator
subs = subs.gsub(/\b(is|has):(\S+)\b/) do
field, label = $1, $2
@@ -326,6 +310,23 @@ EOS
end
end
+ ## if we see a label:deleted or a label:spam term anywhere in the query
+ ## string, we set the extra load_spam or load_deleted options to true.
+ ## bizarre? well, because the query allows arbitrary parenthesized boolean
+ ## expressions, without fully parsing the query, we can't tell whether
+ ## the user is explicitly directing us to search spam messages or not.
+ ## e.g. if the string is -(-(-(-(-label:spam)))), does the user want to
+ ## search spam messages or not?
+ ##
+ ## so, we rely on the fact that turning these extra options ON turns OFF
+ ## the adding of "-label:deleted" or "-label:spam" terms at the very
+ ## final stage of query processing. if the user wants to search spam
+ ## messages, not adding that is the right thing; if he doesn't want to
+ ## search spam messages, then not adding it won't have any effect.
+ query[:load_spam] = true if subs =~ /\blabel:spam\b/
+ query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
+ query[:load_killed] = true if subs =~ /\blabel:killed\b/
+
## gmail style attachments "filename" and "filetype" searches
subs = subs.gsub(/\b(filename|filetype):(\((.+?)\)\B|(\S+)\b)/) do
field, name = $1, ($3 || $4)