Subject: mc->valid

From: Eduardo Chappa <[email-masked]>
Date: Wed, 12 Dec 2001 18:01:35 -0800 (PST)

Hello,

  I have a question about the MESSAGECACHE structure. My question is
specifically about the "valid" component.

  I read in

http://www.cs.cmu.edu/~brians/comp/imap-client.html

that the component valid has the following meaning

 unsigned int valid : 1;         flags are valid in this elt; an elt
                                 that was newly created but never
                                 loaded with flags won't have this set.

So does this mean that if mc->valid is equal to zero I can't trust the
values of mc->seen, mc->recent, etc? If the answer to the above question
is "Yes, you can not trust :)", then is there a way to get valid
information on the flags? or am I misundertanding the meaning of valid?.

  Thank you,

-- 
Eduardo
http://www.math.washington.edu/~chappa/personal.html

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Wed, 12 Dec 2001 18:51:41 -0800 (Pacific Standard Time)

On Wed, 12 Dec 2001, Eduardo Chappa wrote:
> values of mc->seen, mc->recent, etc?

That is a correct; and it is a bug in your program if this happens.  Your
program should ALWAYS do a mail_fetch_fast() or mail_fetch_structure()
call before accessing an elt

mail_fetch_flags() is also possible, but since it will not load
rfc822_size or internaldate its use is discouraged.

> If the answer to the above question

Answer is above.

There is no reason why most applications should ever need to test valid,
because only through a logic bug will they access an elt without having
first ensured that its cache was loaded.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.