Studying dovecot source code (searching for mail_deliver_hook_set)

chaouche yacine
Tue, 28 Mar 2017 16:50:01 -0000

Hello dovecot,

I would like to study how dovecot manages quota, especially how it deals with
the maildirsize file if one chooses to implement quota according to the
maildir++ specification.

I made a number of assumptions :

1. mail is (always/sometimes) delivered with the dovecot-lda binary, which
source code is in src/lda.
2. mail is sent with the mail_deliver function which is called from
src/lda/main.c and is defined in src/lib-lda/mail-deliver.c
3. mail_deliver function calls the deliver_mail function (it seems to be pointer
to a function)

4. according to src/lib-lda/mail-deliver.h, deliver_mail is set with the
mail_deliver_hook_set function. Here's what the comment says

/* Sets the deliver_mail hook and returns the previous hook,
which the new_hook should call if it's non-NULL. */
deliver_mail_func_t *mail_deliver_hook_set(deliver_mail_func_t *new_hook);



The problem at this point is that I can't find where is this function
called. A grep on the sources only reveals two results :



-*- mode: grep; default-directory:
"~/DOWNLOADS/APPS/dovecot-2.2.13/src/" -*-
Grep started at Tue Mar 28 17:01:50

grep -nH -e 'mail_deliver_hook_set' -r .
./lib-lda/mail-deliver.c:428:deliver_mail_func_t
*mail_deliver_hook_set(deliver_mail_func_t *new_hook)
./lib-lda/mail-deliver.h:103:deliver_mail_func_t
*mail_deliver_hook_set(deliver_mail_func_t *new_hook);

Grep finished (matches found) at Tue Mar 28 17:01:50

According to the changelog this function has been introduced back in 2010. I
don't know if it's really used ?



* I am working on the 2.2.13 sources because that's what's installed on
my server.
* I couldn't find a developers mailling listed in
http://www.dovecot.org/mailinglists.html so I'm just posting this here.

  -- Yassine.