Skip to content

Commit

Permalink
Merge pull request #135 from modoboa/fix/imap_keywords_support
Browse files Browse the repository at this point in the history
Added support for IMAP keywords.
  • Loading branch information
tonioo committed Dec 15, 2017
2 parents f217abf + 99e2cff commit db77e07
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modoboa_webmail/lib/fetch_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FetchResponseParser(object):
r"(?P<section>\[.*\])?(?P<origin_octet>\<\d+\>)?"),
("number", r'[0-9]+'),
("literal_marker", r'{\d+}'),
("flag", r'(\\|\$)?[a-zA-Z0-9]+'),
("flag", r'(\\|\$)?[a-zA-Z0-9\-_]+'),
]

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion modoboa_webmail/lib/imapemail.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def body(self):
data = self.imapc._cmd(
"FETCH", self.mailid, "(BODY.PEEK[%s])" % pnum
)
if not data:
if not data or not int(self.mailid) in data:
continue
content = decode_payload(
part["encoding"], data[int(self.mailid)]["BODY[%s]" % pnum]
Expand Down
2 changes: 1 addition & 1 deletion modoboa_webmail/tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
]

BODYSTRUCTURE_SAMPLE_2 = [
(b'19 (UID 19 FLAGS (\\Seen $label4) BODYSTRUCTURE (("text" "plain" ("charset" "ISO-8859-1" "format" "flowed") NIL NIL "7bit" 2 1 NIL NIL NIL NIL)("message" "rfc822" ("name*" "ISO-8859-1\'\'%5B%49%4E%53%43%52%49%50%54%49%4F%4E%5D%20%52%E9%63%E9%70%74%69%6F%6E%20%64%65%20%76%6F%74%72%65%20%64%6F%73%73%69%65%72%20%64%27%69%6E%73%63%72%69%70%74%69%6F%6E%20%46%72%65%65%20%48%61%75%74%20%44%E9%62%69%74") NIL NIL "8bit" 3632 ("Wed, 13 Dec 2006 20:30:02 +0100" {70}',
(b'19 (UID 19 FLAGS (\\Seen $label4 user_flag-1) BODYSTRUCTURE (("text" "plain" ("charset" "ISO-8859-1" "format" "flowed") NIL NIL "7bit" 2 1 NIL NIL NIL NIL)("message" "rfc822" ("name*" "ISO-8859-1\'\'%5B%49%4E%53%43%52%49%50%54%49%4F%4E%5D%20%52%E9%63%E9%70%74%69%6F%6E%20%64%65%20%76%6F%74%72%65%20%64%6F%73%73%69%65%72%20%64%27%69%6E%73%63%72%69%70%74%69%6F%6E%20%46%72%65%65%20%48%61%75%74%20%44%E9%62%69%74") NIL NIL "8bit" 3632 ("Wed, 13 Dec 2006 20:30:02 +0100" {70}',
b"[INSCRIPTION] R\xe9c\xe9ption de votre dossier d'inscription Free Haut D\xe9bit"),
(b' (("Free Haut Debit" NIL "inscription" "freetelecom.fr")) (("Free Haut Debit" NIL "inscription" "freetelecom.fr")) ((NIL NIL "hautdebit" "freetelecom.fr")) ((NIL NIL "nguyen.antoine" "wanadoo.fr")) NIL NIL NIL "<20061213193125.9DA0919AC@dgroup2-2.proxad.net>") ("text" "plain" ("charset" "iso-8859-1") NIL NIL "8bit" 1428 38 NIL ("inline" NIL) NIL NIL) 76 NIL ("inline" ("filename*" "ISO-8859-1\'\'%5B%49%4E%53%43%52%49%50%54%49%4F%4E%5D%20%52%E9%63%E9%70%74%69%6F%6E%20%64%65%20%76%6F%74%72%65%20%64%6F%73%73%69%65%72%20%64%27%69%6E%73%63%72%69%70%74%69%6F%6E%20%46%72%65%65%20%48%61%75%74%20%44%E9%62%69%74")) NIL NIL) "mixed" ("boundary" "------------040706080908000209030901") NIL NIL NIL) BODY[HEADER.FIELDS (DATE FROM TO CC SUBJECT)] {266}',
b'Date: Tue, 19 Dec 2006 19:50:13 +0100\r\nFrom: Antoine Nguyen <nguyen.antoine@wanadoo.fr>\r\nTo: Antoine Nguyen <tonio@koalabs.org>\r\nSubject: [Fwd: [INSCRIPTION] =?ISO-8859-1?Q?R=E9c=E9ption_de_votre_?=\r\n =?ISO-8859-1?Q?dossier_d=27inscription_Free_Haut_D=E9bit=5D?=\r\n\r\n'),
Expand Down
1 change: 1 addition & 0 deletions test_project/test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'modoboa.core',
'modoboa.lib',
'modoboa.admin',
'modoboa.transport',
'modoboa.relaydomains',
'modoboa.limits',
'modoboa.parameters',
Expand Down

0 comments on commit db77e07

Please sign in to comment.