bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Set mail status to 'R'


From: Alain Magloire
Subject: Re: [bug-mailutils] Set mail status to 'R'
Date: Mon, 16 Jun 2003 16:14:39 -0400 (EDT)

> 
> Hi,
> 
> I'm using mailutils in Linux.
> 
> I want to set mail status to 'R'ead using my
> applcation program :
> 
> char type[] = "R";
> 
>         status = header_set_value (header,
> MU_HEADER_STATUS, type, 1);
> 
> But the status is not changed when I try to verify by
> accessing it through mail.
> 
> How can I change the mail status in my application
> program without reading it through mail ?
> 

You should probably use, the attributes:
{
        mailbox_t mbox;
        message_t msg = NULL;
        int mesgnu = 1;
        attribute_t attr = NULL;

        ....

        mailbox_get_message (mbox, msgnum, &msg);
        message_get_attribute(msg, &attr);
        attribute_set_read(attr);

        ....

        mailbox_flush(mbox, 1);

        // or you can use expunge.
        // mailbox_expunge(mbox);
        // mailbox_save_attributes(mbox); 

}

setting the attribute on a message will not "commit" the changes on the file 
system
not until you call mailbox_flush(), mailbox_expunge or mailbox_save_atributes().

Also, I you can see I recommand to use the attribute_t object from the the 
message,
some mailbox format will not use things like setting "R" on the "Status:" field
but rather other shemes like moving to a different folder etc ..  Using the
the attribute_t object, let the to the underlying implementation of the mailbox
do the right thing .. in theory.

But if you insist on do changing the header, it is the same step you will
need to call mailbox_flush(), mailbox_expunge or mailbox_save_atributes().
For you changes to take effect .i.e written back to the file system.

All changes are in memory until commited by mailbox_expunge().





reply via email to

[Prev in Thread] Current Thread [Next in Thread]