[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
inserted).

 Append to UID array (156) -->
(/storage/gss/emexis/common/t/33/88/t33889eb1bccd28fd6643ebc3ecf548b12a1ad095)
 Append to UID array (157) -->
(/storage/gss/emexis/common/t/e3/35/te335c20e978e12d37ad0a35ae009245cd34080c0)
 Append to UID array (158) -->
(/storage/gss/emexis/common/t/0b/83/t0b83efc253c34db35843fc89b655586d628cccaf)
 Calling Sync Expunged --> (156)
 Sync Expunged (156 == 156) -->
(/storage/gss/emexis/common/t/0b/83/t0b83efc253c34db35843fc89b655586d628cccaf)
 Sync Expunged Match (156 == 156) -->
(/storage/gss/emexis/common/t/0b/83/t0b83efc253c34db35843fc89b655586d628cccaf)
 Sync Expunged (157 == 156) -->
(/storage/gss/emexis/common/t/0b/83/t0b83efc253c34db35843fc89b655586d628cccaf)
 Sync Expunged (158 == 156) -->
(/storage/gss/emexis/common/t/0b/83/t0b83efc253c34db35843fc89b655586d628cccaf)
 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