Opened 14 years ago

Closed 13 years ago

#7458 closed bug (fixed)

New Mail menu item not decrementing

Reported by: jalopeura Owned by: czeidler
Priority: normal Milestone: R1
Component: Kits/Mail Kit Version: R1/Development
Keywords: new mail menu gsoc2011 Cc: jalopeura@…
Blocked By: Blocking: #7748
Platform: All

Description

If I open a mail and read it, the New Mail menu item decrements the count of new mails. However, if I use the Tracker add-on to mark it read, it does not.

If I click on the menu item, the new mail window shows up and it's empty. But the mailbox icon is full and the count in the menu item is not 0.

hrev41256

Attachments (1)

markasdiff.txt (3.7 KB ) - added by jalopeura 14 years ago.
Patch

Download all attachments as: .zip

Change History (16)

comment:1 by jalopeura, 14 years ago

Cc: jalopeura@… added

comment:2 by czeidler, 14 years ago

Could you point me to the tracker add-on? it needs some changes too. I introduced another attribute that set the real status, e.g. the string can't be unread and forwarded...

in reply to:  2 comment:3 by anevilyak, 14 years ago

Replying to czeidler:

Could you point me to the tracker add-on? it needs some changes too. I introduced another attribute that set the real status, e.g. the string can't be unread and forwarded...

http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/tracker/mark_as

comment:4 by czeidler, 14 years ago

ok that was easy :) will fix it soon... @jalopeura you can try to fix it yourself there is a function for that in libmail.so...

comment:5 by jalopeura, 14 years ago

patch: 01

comment:6 by jalopeura, 14 years ago

I added a patch to fix the Mark As add-ons. It still changes MAIL:status, but now it also changes MAIL:read.

Once the new add-ons have been installed, the menu problem can be fixed by running the following query:

(((MAIL:status=="Read")&&(MAIL:read==0))&&(BEOS:TYPE=="text_x-email"))

Then "Select all" and use the add-on to mark them read.

comment:7 by jalopeura, 14 years ago

Keywords: gsoc2011 added

comment:8 by czeidler, 14 years ago

Thanks for the patch! sorry was not very clear in my previous post. There is a helper function in: headers/private/mail/mail_util.h

write_read_attr

think its better to use this function. Probably you have to include the private header path in the Jamfile...

comment:9 by jalopeura, 14 years ago

I discovered that the code in my previous patch would overwrite B_READ with B_SEEN. So I fixed that.

Note that using "Mark As..." and selecting "Read" will still overwrite B_READ with B_SEEN. I can fix that if desired, but it will require moving some code around a little bit.

comment:10 by jalopeura, 14 years ago

Sorry, I hadn't seen the last comment (comment8) when I posted (comment9).

I'm stuck on Windows (doing some word processing) at the moment, but I'll look at those functions later on today.

by jalopeura, 14 years ago

Attachment: markasdiff.txt added

Patch

comment:11 by jalopeura, 14 years ago

Okay, it's now using the mail_util functions.

I noticed while doing this that users can add additional statuses by making a <settings>/Mail/status directory and creating empty files in it. It would be nice to make it so these were not empty files, but contained the value to put into MAIL:read. That way users could map each of their custom status strings to a read_flags value. Perhaps empty files would mean to not change MAIL:read. But I didn't want to make such a drastic change in a bugfix.

comment:12 by czeidler, 14 years ago

Sorry again! was a little bit busy when writing the last comment missed an important part :( the right solution is to go over the mail_daemon: https://dev.haiku-os.org/browser/haiku/trunk/headers/os/mail/MailDaemon.h

there is a MarkAsRead method which send a message to the daemon. The daemon dispatch it to the right add-on and the add-on do the work depending on the protocol... This is necessary because for example the IMAP add-on also sets the read status on the server. This would not happen in the previous solution.

To your proposal, think it is a good idea. I think its better to use the status file as a template for the attributes. For example, you can just at a MAIL:read attribute to the status template file...

comment:13 by axeld, 13 years ago

Blocking: 7748 added

(In #7748) Duplicate of #7458 (which also has a patch set, and more information).

comment:14 by mmu_man, 13 years ago

Applied as hrev42972 with some changes to use the BMailDaemon::MarkAsRead() method. Maybe we'd want to add other methods to mark as new again as well ? It seems to work here but I didn't test all cases nor with an IMAP server, so please test.

comment:15 by pulkomandy, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.