Subject: [Imap-uw] Detecting flag changes from c-client?

From: Mark Sirota <[email-masked]>
Date: Mon, 06 Feb 2006 22:39:35 -0500

We're looking for a way from the c-client to detect whether any message
flags have changed.

We were hoping mail_ping() would call mm_exists() if any flags have
changed, but it does not seem to do so -- if I'm understanding correctly,
mm_exists() will only be called if the number of messages in the mailbox
changes.

The actual situation is that we are developing a c-client based voice
messaging application that will be run from VoIP phones to listen to
voice messages stored on an IMAP server.  If new messages come in, we
turn on the message waiting indicator on the phone using a mail_ping()
loop.  This also works if messages are deleted and expunged from another
phone or IMAP client.  But if those messages are then read but not
deleted, we want to turn the light off, but our client is unaware of the
state change.

Is there some relatively efficient way to detect changes in message
status, or do we need to go and check all the message flags by hand each
time through the loop?

Thanks,

Mark

_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: Mark Crispin <[email-masked]>
Date: Mon, 6 Feb 2006 19:47:58 -0800

> mm_exists() will only be called if the number of messages in the mailbox

The callback that you want is mm_flags().

> status, or do we need to go and check all the message flags by hand each

Yes.  mm_flags().

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: Mark Sirota <[email-masked]>
Date: Tue, 07 Feb 2006 10:36:44 -0500

> The callback that you want is mm_flags().

mail_ping() does not seem to trigger mm_flags() (or mm_expunged() or
mm_exists()) in this instance, where it is another client that is making
the flag changes.  This is using imap-2006.DEV.SNAP-0601131625.

Is there some additional detail we might be able to provide that would help
debug this?

Thanks,

Mark

---

From: Mark Crispin <[email-masked]>
Date: Tue, 7 Feb 2006 08:04:41 -0800

> the flag changes.  This is using imap-2006.DEV.SNAP-0601131625.

What mailbox format are you using?  What operating system?

It works fine for me with mbx format on Linux, Mac OS X, and AIX.

mail_ping() does not always do an mm_exists() callback; it only does so 
when there is new mail.

-- Mark --

---

From: Mark Sirota <[email-masked]>
Date: Wed, 08 Feb 2006 14:38:27 -0500

> What mailbox format are you using?  What operating system?

Good catch.  The test mailbox had fallen back to mbox accidentally 
somewhere
along the way; the problem was the lack of support for simultaneous access.
Sorry for the false alarm...

Thanks,

Mark