Re: libetpan-0.55 trouble in message flags in IMAP storage

"DINH Viêt Hoà" <[email protected]> Thu, 1 Jan 2009 16:16:43 +0100
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
Hello,

Sorry for the delay.

On Mon, Dec 8, 2008 at 8:51 AM, ????????? ???????????? <[email protected]> wro=
te:
> Sorry for my English!
>
> I want to connect to IMAP server, and delete all message in specified
> folder.
>
> in my program i have this code:
> - -------------------------------BEGIN C CODE-------------------
> #include libetpan/libetpan.h>
>
> struct mailstorage * storage;
> storage =3D mailstorage_new(NULL);
> imap_mailstorage_init(storage, "server",
>    143, NULL, CONNECTION_TYPE_PLAIN, IMAP_AUTH_TYPE_PLAIN,
>    "username", "pass", 0, NULL);
> struct mailfolder * folder;
> folder =3D mailfolder_new(storage,"foldername", NULL);
> struct mailmessage_list * msg_list;
> mailmessage *msg;
> mailfolder_get_messages_list(folder, &msg_list);
> for (index =3D 0; index < carray_count(msg_list->msg_tab); index++)
> {
>        msg =3D carray_get(msg_list->msg_tab, index);
> //
> //DO SOMETHING WITH MESSAGE
> //
>        printf("BEFORE\n");
>        msg->msg_flags->fl_flags =3D msg->msg_flags->fl_flags & MAIL_FLAG_=
DELETED;
>        printf("AFTER\n");
> }
> mailmessage_check(msg);
> mailfolder_expunge(folder);
> - ------------------------------END C CODE-----------------------
>
>
> When i run this program, it's terminate by SIGSEGV and dumping core.
> In my stdout i have:
> BEFORE
> Segmentation fault (core dumped).
>
> Thank you!

You might move mailmessage_check() in the "for" loop.
Do you have the stack trace of your crash ?
you can use gdb for that purpose.

Regards,

-- =

DINH Vi=EAt Ho=E0

---------------------------------------------------------------------------=
---