From a4fcf483a09b3cd26fb7235adac8f1afd9462549 Mon Sep 17 00:00:00 2001 From: daassh Date: Tue, 26 Mar 2019 13:53:22 +0800 Subject: [PATCH 1/2] text support Support seach by mail body. --- imbox/messages.py | 1 + 1 file changed, 1 insertion(+) diff --git a/imbox/messages.py b/imbox/messages.py index d11bec8..8df1770 100644 --- a/imbox/messages.py +++ b/imbox/messages.py @@ -21,6 +21,7 @@ class Messages: 'date__on': '(ON "{}")', 'subject': '(SUBJECT "{}")', 'uid__range': '(UID {})', + 'text': '(TEXT "{}")', } FOLDER_LOOKUP = {} From 77b9c5ef9fb11017dca3a882f7b95ce960c486bb Mon Sep 17 00:00:00 2001 From: daassh Date: Tue, 26 Mar 2019 13:55:02 +0800 Subject: [PATCH 2/2] add text testcase --- tests/query_tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/query_tests.py b/tests/query_tests.py index af9158d..9888a3f 100644 --- a/tests/query_tests.py +++ b/tests/query_tests.py @@ -74,6 +74,10 @@ def test_uid__range(self): res = build_search_query(IMAP_ATTRIBUTE_LOOKUP, uid__range='1000:*') self.assertEqual(res, '(UID 1000:*)') + def test_text(self): + res = build_search_query(IMAP_ATTRIBUTE_LOOKUP, text='mail body') + self.assertEqual(res, '(TEXT "mail body")') + def test_gmail_raw(self): res = build_search_query(GMAIL_ATTRIBUTE_LOOKUP, raw='has:attachment subject:"hey"') self.assertEqual(res, '(X-GM-RAW "has:attachment subject:\'hey\'")')