Discussion:
[bug-mailutils] Getting started with mailutils as a library (GNU Guile bindings)
Amirouche
2017-04-30 11:28:23 UTC
Permalink
Héllo,

I am looking for stable featured imap client to bind in GNU Guile, I
found GNU mailutils.

The library part is not documented yet, nonetheless there is plenty of
use of the library
in mailutils itself.

Like I said I am primarily interested on the imap client. It seems to me
that the general
workflow is to send request to using `mu_imap_*` functions found in
mailutils/imap.h
and listen for response using `mu_imap_register_callback_function`. Is
this correct?

For instance, there is the example code in libproto/imap/mbox.c [1] that
does the following:

static int
_imap_fetch_with_callback (mu_imap_t imap, mu_msgset_t msgset, char *items,
mu_imap_callback_t cb, void *data)
{
int rc;

mu_imap_register_callback_function (imap, MU_IMAP_CB_FETCH, cb, data);
rc = mu_imap_fetch (imap, 0, msgset, items);
mu_imap_register_callback_function (imap, MU_IMAP_CB_FETCH, NULL, NULL);
return rc;
}

AFAIU the callback is unregistred immediatly after being registred. How
can this properly work?

What's the purpose of:

void mu_imap_callback (mu_imap_t imap, int code, size_t sdat, void *pdat);

Thanks in advance!

[1]
http://git.savannah.gnu.org/cgit/mailutils.git/tree/libproto/imap/mbox.c#n61
Loading...