Identify if a message_part is an attachment ?

Sai Kiran Gummaraj saikiran.gummaraj at gmail.com
Tue Dec 27 11:22:56 UTC 2016


Hello,

This is my first post to this group. I have read through the instructions
before posting. I hope am doing the right thing. If not my sincere
apologies.

I am in the process of developing a dovecot IMAP plugin (over v2.2.25). The
plugin works with mdbox/sdbox which has ability to keep attachments as
external references (via SiS POSIX). The plugin must enable fetching
attachment from REDIS instead of local-store.

To accomplish this I was following dovecot via my debugger. I wanted to
understand if there was a way to determine a message_part to be of an
attachment type ?

Thanks.

--
Regards,
Sai Kiran

cmd_fetch()
|_ imap_fetch_more()
  |_ imap_fetch_more_int()
    |_
	imap_fetch_state *state = &ctx->state;
	state->cur_mail is NULL.
	search mailbox
    |_ mailbox_search_next(state->search_ctx, &state->cur_mail)
      |_ mailbox_search_next_nonblock (via vfunc)
        |_ index_storage_search_next_nonblock
          |_ search_more_with_prefetching(ctx, mail_r)
            |_
               mail = index_search_get_mail(ctx)
               |_ allocates mail (vfunc mail_alloc) and calls hook.
               |_ also allocates index_mails
               ret = search_more_with_mail(ctx, mail);	
    |_ call handler (*h) => fetch_body_msgpart
      |_ imap_msgpart_open
        |_ imap_msgpart_find_part(mail, msgpart, &part); /* only mail
comes here */
             mail (uid=1739, seq=5)
             msgpart (section_number = 2,
             fetch_type = FETCH_MIME_BODY,
             partial_offset = 0, partial_size = 512,
             decode_cte_to_binary = 0)
           |_ mail_get_parts(mail, &parts) /* atmail send msgpart */
             |_ call to p->v.get_parts(mail, parts_r)
                (index_mail_get_parts) /* atmail over-ride this function */
                 |_ get_cached_parts(mail) /* sets data->part */
                   |_ get_unserialized_parts(index_mail)
                     |_ get_serialized_parts(mail, &part_buf)
                       |_ index_mail_cache_lookup_field
                         |_ mail_cache_lookup_field
        |_ imap_msgpart_open_normal()
          |_ .. see call stack below ..


More information about the dovecot mailing list