Beispiel #1
0
def _split_into_parts(raw):
    # TODO signal that we can delete the original message!-----
    # when all the processing is done.
    # TODO add the linked-from info !
    # TODO add reference to the original message?
    # TODO populate Default FLAGS/TAGS (unseen?)
    # TODO seed propely the content_docs with defaults??

    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)
    cdocs_list = list(walk.get_raw_docs(msg, parts))
    cdocs_phashes = [c['phash'] for c in cdocs_list]

    mdoc = _build_meta_doc(chash, cdocs_phashes)
    fdoc = _build_flags_doc(chash, size, multi)
    hdoc = _build_headers_doc(msg, chash, body_phash, parts_map)

    # The MessageWrapper expects a dict, one-indexed
    cdocs = dict(enumerate(cdocs_list, 1))

    return mdoc, fdoc, hdoc, cdocs
Beispiel #2
0
def _split_into_parts(raw):
    # TODO signal that we can delete the original message!-----
    # when all the processing is done.
    # TODO add the linked-from info !
    # TODO add reference to the original message?
    # TODO populate Default FLAGS/TAGS (unseen?)
    # TODO seed propely the content_docs with defaults??

    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)
    cdocs_list = list(walk.get_raw_docs(msg, parts))
    cdocs_phashes = [c['phash'] for c in cdocs_list]

    mdoc = _build_meta_doc(chash, cdocs_phashes)
    fdoc = _build_flags_doc(chash, size, multi)
    hdoc = _build_headers_doc(msg, chash, body_phash, parts_map)

    # The MessageWrapper expects a dict, one-indexed
    cdocs = dict(enumerate(cdocs_list, 1))

    return mdoc, fdoc, hdoc, cdocs
Beispiel #3
0
 def _get_body_phash(self):
     return walk.get_body_phash(self._mime_multipart)
Beispiel #4
0
 def _get_body_phash(self):
     return walk.get_body_phash(self._mime_multipart)