[Dovecot] Creating and interacting with array inside plugin

Alex Baule alexwbaule at gmail.com
Thu Feb 23 18:19:30 EET 2012

Hi Timo....

I Follow your instruction to look inside quota plugin to get the
notification from dovecot that expunged a message, that's Ok.

Follow the quota, it's use a array to keep all uids from a email
expunged, to compare with uid that is got in notify_sync, that's OK
too, but to me i need to keep uid and a char* with my body name, to
erase it too.

I made this:

struct emexis_ids_x_uis{
    uint32_t ids;
    char *uis_file;

struct emexis_mailbox {
    union mailbox_module_context module_ctx;
    ARRAY_DEFINE(expunge_uids, struct emexis_ids_x_uis);

ok, inside my expunged rewrite function i create the array like quota
does, and append it to my array.

struct emexis_ids_x_uis append_uis;
append_uis.ids = _mail->uid;
 append_uis.uis_file = bodyFile;

array_append(&ebox->expunge_uids, &append_uis, 1);

But when i do a foreach in this Array, my ids is OK, but my uis_file
has tha same value every time (the value is the lasted value

 Append to UID array (156) -->
 Append to UID array (157) -->
 Append to UID array (158) -->
 Calling Sync Expunged --> (156)
 Sync Expunged (156 == 156) -->
 Sync Expunged Match (156 == 156) -->
 Sync Expunged (157 == 156) -->
 Sync Expunged (158 == 156) -->
 Finish Calling Sync Expunged --> (156)

Can i use a struct as a array Item ?? something is wrong with my array
creation, append and etc ?

Tks Timo !!

More information about the dovecot mailing list