======================================================================
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000097
======================================================================
Reported By: alessandro
Assigned To: paul
======================================================================
Project: DBMail
Bug ID: 97
Category: IMAP daemon
Reproducibility: always
Severity: minor
Priority: normal
Status: assigned
======================================================================
Date Submitted: 04-Oct-04 15:46 CEST
Last Modified: 19-Mar-05 19:42 CET
======================================================================
Summary: RECENT flag always set
Description:
When connecting via IMAP, all the messages have the \Recent flag set. This
flag should be set only for newly arrived messages, and should be unset by
the server at the end of the session.
See "Additional Information".
======================================================================
----------------------------------------------------------------------
ilja - 05-Oct-04 09:51 CEST
----------------------------------------------------------------------
I'll have a look at this. I guess this is some error that's way deep in the
code..
Paul, can you take care of this in your new (2.1) code? Or have you
already done so?
----------------------------------------------------------------------
paul - 05-Oct-04 10:28 CEST
----------------------------------------------------------------------
I did a quick scan through the code when this first came in. I can't find
any places where the recent_flag is actually set to zero. A complete
ommission it seems.
The procedure is actually quite simple:
when user opens mailbox and user has rw access to mailbox:
update messages set recent_flag=0 where mailbox_idnr matches and
recent_flag=1
So all we need is a db_ call that sets the recent_flag to zero for all
messages in a mailbox, and call this from the correct location in
_ic_select. _ic_select is the only command that is involved, afaik.
Looks easy enough. I'll take care of this.
----------------------------------------------------------------------
paul - 05-Oct-04 16:39 CEST
----------------------------------------------------------------------
Not that simple after all.
The call to the new function db_set_msgflag_recent() has to occur *after*
the current session.
One approach would be to update the recent_flag after each retrieval of
active flags for a message or range of messages. Very tricky at best. The
whole mailbox_t should be passed to those functions so we can move the acl
checks and mailbox permission checks to those calls.
Another approach would be to expand imap_userdata_t to include the
previously selected mailbox_t. On selecting a new mailbox, update the
recent_flag for all messages in the previously selected mailbox.
I'll start working on both.
----------------------------------------------------------------------
aaron - 05-Oct-04 18:48 CEST
----------------------------------------------------------------------
Would it be possible to have a query run at logout/disconnect that marked
all visited mailboxes as no longer recent? During the session, we'd keep a
list of mailboxes that the person visited. At about the time of the
connection cleanup code, call a function that marks those mailboxes as no
longer recent.
----------------------------------------------------------------------
alessandro - 11-Oct-04 18:42 CEST
----------------------------------------------------------------------
hello aaron,
the "recent" flag pertains the single messages, not the mailboxes. plus,
you have to consider concurrent access to the mailbox.
this flag is used so that only the first client to "see" a new message in
a mailbox notifies the user that there's indeed a new message.
----------------------------------------------------------------------
ilja - 12-Oct-04 17:00 CEST
----------------------------------------------------------------------
fixed by Paul
----------------------------------------------------------------------
ilja - 12-Oct-04 20:12 CEST
----------------------------------------------------------------------
hmm, I think I set the wrong bug to 'Resolved', sorry.
----------------------------------------------------------------------
aaron - 02-Nov-04 04:32 CET
----------------------------------------------------------------------
So is this fixed?
----------------------------------------------------------------------
alessandro - 11-Nov-04 13:19 CET
----------------------------------------------------------------------
no, it is not fixed, I have just checked latest 2.0 CVS
----------------------------------------------------------------------
alessandro - 25-Nov-04 00:52 CET
----------------------------------------------------------------------
I have just installed DBMail 2.0.1, and it broke the fix I wrote for my
IMAP client to overcome this server bug.
It seems that now the recent flag is not _always_ set, but the situation
has become too messy, I can't isolate the commands that get the message as
not recent.
Please fix this bug, or at least leave the behaviour unmodified (that is,
always recent) until a proper fix is ready.
regards,
Alessandro Magnolo
----------------------------------------------------------------------
va1210 - 30-Nov-04 19:37 CET
----------------------------------------------------------------------
I tried hooking up the newest cvs-head-versions of horde and imp to my
dbmail-server, and they display all items in the mailboxes as unread.
Could be related to this..
----------------------------------------------------------------------
aaron - 30-Nov-04 19:50 CET
----------------------------------------------------------------------
That's been the case for me with TWIG since just about forever. So the bug
is definitely with DBMail, and it seems that the main problem is finding
the right place in the IMAP session to do the Recent un-flagging.
----------------------------------------------------------------------
paul - 23-Dec-04 15:19 CET
----------------------------------------------------------------------
I think I've got this one nailed now. checkout cvs-head.
on select:
flush list of recent messages from previous select (other mailbox)
if access is rw:
build new list of recent message in this mailbox
on logout:
flush list of recent message
I've added a couple of calls in dbmail-imapsession and imaputil, which are
called from above mentioned locations in _ic_select and _ic_logout
These calls may have to be added in a couple of other places as well, but
the general framework should be valid and functional already.
----------------------------------------------------------------------
alessandro - 03-Jan-05 17:02 CET
----------------------------------------------------------------------
I cannot check the fix because I can't manage to compile the experimental
version.
Will this be fixed in 2.0 branch as well? If so, when?
----------------------------------------------------------------------
paul - 08-Jan-05 19:20 CET
----------------------------------------------------------------------
Like I said on the list: This bug is fixed in cvs-head, and I don't plan on
fixing it in 2.0. If you have issues compiling cvs-head, please send us
some feedback so we can help.
----------------------------------------------------------------------
aaron - 18-Mar-05 17:36 CET
----------------------------------------------------------------------
Let's close this if there are no plans to fix it in 2.0.x.
Bug History
Date Modified Username Field Change
======================================================================
04-Oct-04 15:46alessandro New Bug
05-Oct-04 09:51ilja Bugnote Added: 0000281
05-Oct-04 09:52ilja Status new => acknowledged
05-Oct-04 10:28paul Bugnote Added: 0000282
05-Oct-04 16:39paul Bugnote Added: 0000284
05-Oct-04 18:48aaron Bugnote Added: 0000285
11-Oct-04 18:42alessandro Bugnote Added: 0000306
12-Oct-04 17:00ilja Bugnote Added: 0000307
12-Oct-04 17:00ilja Assigned To => ilja
12-Oct-04 17:00ilja Resolution open => fixed
12-Oct-04 17:00ilja Status acknowledged => resolved
12-Oct-04 20:12ilja Bugnote Added: 0000308
12-Oct-04 20:12ilja Resolution fixed => reopened
12-Oct-04 20:12ilja Status resolved => feedback
14-Oct-04 10:19ilja Assigned To ilja =>
29-Oct-04 11:13alessandro Bug Monitored: alessandro
02-Nov-04 04:32aaron Bugnote Added: 0000332
11-Nov-04 13:19alessandro Bugnote Added: 0000350
25-Nov-04 00:52alessandro Bugnote Added: 0000375
30-Nov-04 19:37va1210 Bugnote Added: 0000396
30-Nov-04 19:50aaron Bugnote Added: 0000397
23-Dec-04 15:19paul Bugnote Added: 0000462
03-Jan-05 17:02alessandro Bugnote Added: 0000485
08-Jan-05 19:20paul Bugnote Added: 0000493
08-Jan-05 19:20paul Assigned To => paul
08-Jan-05 19:20paul Resolution reopened => open
08-Jan-05 19:20paul Status feedback => assigned
18-Mar-05 17:36aaron Bugnote Added: 0000620
19-Mar-05 19:42paul Resolution open => fixed
======================================================================