Index: haiku/src/add-ons/tracker/mark_as/MarkAs.cpp =================================================================== --- haiku/src/add-ons/tracker/mark_as/MarkAs.cpp (revision 41271) +++ haiku/src/add-ons/tracker/mark_as/MarkAs.cpp (working copy) @@ -16,6 +16,8 @@ #include #include #include +//#include +#include static BPoint @@ -94,7 +96,29 @@ && node.ReadAttrString("BEOS:TYPE", &type) == B_OK && type == "text/x-email") { BString previousStatus; + read_flags previousRead; + + // Update the MAIL:read flag + if (status == "New") { + if (read_read_attr(node, previousRead) != B_OK || + previousRead != B_UNREAD) + write_read_attr(node, B_UNREAD); + } + else if (status == "Read") { + // if we're marking it via the add-on, we haven't really read it + // so use B_SEEN instead of B_READ + // Check both B_SEEN and B_READ + // (so we don't overwrite B_READ with B_SEEN) + if (read_read_attr(node, previousRead) != B_OK || + (previousRead != B_SEEN && previousRead != B_READ)) + write_read_attr(node, B_SEEN); + } + // ignore "Replied"; no matching MAIL:read status + // We want to keep the previous behavior of updating the status + // string, but write_read_attr will only change the status string + // if it's one of "New", "Seen", or "Read" (and not, for example, + // "Replied"), so we change the status string here // Only update the attribute if there is an actual change if (node.ReadAttrString("MAIL:status", &previousStatus) != B_OK || previousStatus != status) Index: haiku/src/add-ons/tracker/mark_as/Jamfile =================================================================== --- haiku/src/add-ons/tracker/mark_as/Jamfile (revision 41271) +++ haiku/src/add-ons/tracker/mark_as/Jamfile (working copy) @@ -2,15 +2,17 @@ SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders mail ; + AddResources Mark\ as… : MarkAs.rdef ; AddResources Mark\ as\ Read-R : MarkAsRead.rdef ; Addon Mark\ as… : MarkAs.cpp - : be tracker $(TARGET_LIBSUPC++) + : be tracker $(TARGET_LIBSUPC++) libmail.so ; Addon Mark\ as\ Read-R : MarkAsRead.cpp - : be tracker $(TARGET_LIBSUPC++) + : be tracker $(TARGET_LIBSUPC++) libmail.so ; Index: haiku/src/add-ons/tracker/mark_as/MarkAsRead.cpp =================================================================== --- haiku/src/add-ons/tracker/mark_as/MarkAsRead.cpp (revision 41271) +++ haiku/src/add-ons/tracker/mark_as/MarkAsRead.cpp (working copy) @@ -9,8 +9,9 @@ #include #include #include +//#include +#include - extern "C" void process_refs(entry_ref dir, BMessage* message, void* /*reserved*/) { @@ -24,7 +25,22 @@ && type == "text/x-email") { BString previousStatus; BString status("Read"); + read_flags previousRead; + // if we're marking it via the add-on, we haven't really read it + // so use B_SEEN instead of B_READ + read_flags read = B_SEEN; + + // Update the MAIL:read status to match + // Check both B_SEEN and B_READ + // (so we don't overwrite B_READ with B_SEEN) + if (read_read_attr(node, previousRead) != B_OK || + (previousRead != B_SEEN && previousRead != B_READ)) + write_read_attr(node, read); + // We want to keep the previous behavior of updating the status + // string, but write_read_attr will only change the status string + // if it's one of "New", "Seen", or "Read" (and not, for example, + // "Replied"), so we change the status string here // Only update the attribute if there is an actual change if (node.ReadAttrString("MAIL:status", &previousStatus) != B_OK || previousStatus != status)