diff options
author | Kali Kaneko <kali@leap.se> | 2015-03-23 12:59:12 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-03-30 14:48:07 -0400 |
commit | 76c5a1b7d53fc0c5df0adbbd9382d0713494cea1 (patch) | |
tree | f28a7904384fcd3e77184acea7f632323aee3746 /mail/src/leap/mail/adaptors/soledad.py | |
parent | 822385e16b4f0f7a7d74905984bc4b4d76d187be (diff) |
[bug] re-add fix for multiple headers
This fix stores as multi-line headers that are repeated, and that were
being discarded when storing them in a regular dict.
It had been removed during the last refactor.
I also store headers now as a case-insensitive dict, which solves other
problems with the implementation of the twisted imap.
Releases: 0.4.0
Diffstat (limited to 'mail/src/leap/mail/adaptors/soledad.py')
-rw-r--r-- | mail/src/leap/mail/adaptors/soledad.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/mail/src/leap/mail/adaptors/soledad.py b/mail/src/leap/mail/adaptors/soledad.py index 490e014a..7a1a92db 100644 --- a/mail/src/leap/mail/adaptors/soledad.py +++ b/mail/src/leap/mail/adaptors/soledad.py @@ -1114,6 +1114,7 @@ def _split_into_parts(raw): msg, parts, chash, multi = _parse_msg(raw) size = len(msg.as_string()) + body_phash = walk.get_body_phash(msg) parts_map = walk.walk_msg_tree(parts, body_phash=body_phash) @@ -1161,16 +1162,13 @@ def _build_headers_doc(msg, chash, body_phash, parts_map): It takes into account possibly repeated headers. """ - headers = msg.items() - - # TODO move this manipulation to IMAP - #headers = defaultdict(list) - #for k, v in msg.items(): - #headers[k].append(v) - ## "fix" for repeated headers. - #for k, v in headers.items(): - #newline = "\n%s: " % (k,) - #headers[k] = newline.join(v) + headers = defaultdict(list) + for k, v in msg.items(): + headers[k].append(v) + # "fix" for repeated headers (as in "Received:" + for k, v in headers.items(): + newline = "\n%s: " % (k.lower(),) + headers[k] = newline.join(v) lower_headers = lowerdict(dict(headers)) msgid = first(_MSGID_RE.findall( |