8 Jun 2007 slamb   » (Journeyer)

spam flags

I mentioned before that Thunderbird and Mail.app have slightly different flags for indicating that a message is ham rather than spam. Well, their interaction seemed to be even weirder than that alone would explain - if a message was marked as not junk in Mail.app, no attempt to mark it as junk in Thunderbird would stick. Look for NonJunk and you'll find this (reformatted to fit your television):

PRBool messageClassified = PR_TRUE;
if (FindInReadable(NS_LITERAL_CSTRING("NonJunk"), keywords...)
  mDatabase->SetStringProperty(uidOfMessage, "junkscore", "0");
// Mac Mail uses "NotJunk"
else if (FindInReadable(NS_LITERAL_CSTRING("NotJunk"), keywords...)
  mDatabase->SetStringProperty(uidOfMessage, "junkscore", "0");
// ### TODO: we really should parse the keywords into
// space delimited keywords before checking
else if (FindInReadable(NS_LITERAL_CSTRING("Junk"), keywords...)
  PRUint32 newFlags;
  dbHdr->AndFlags(~MSG_FLAG_NEW, &newFlags);
  mDatabase->SetStringProperty(uidOfMessage, "junkscore", "100");
  messageClassified = PR_FALSE;

On startup, Thunderbird says that a message is not junk if Mail.app said it was NotJunk. When marking a message as Junk, it doesn't clear Mail.app's NotJunk flags. Brilliant! How could this plan possibly fail?

What annoys me is that Thunderbird added this feature after Mail.app but made a subtle change that broke interoperability. Then they realized their parsing sucked and they were interpreting Mail.app's NotJunk as saying Junk. They fixed it with this hack job and the bug popped up elsewhere - now Thunderbird's attempt to change the marking to junk won't stay across restarts. A little forethought and there wouldn't have been this mess.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!