Well done Matt, it is certainly very very quick and very much appreciated.
Thanks.
Good stuff!
One thing: On the start page thread list, new (completely unread) threads are now showing up with a dot beside them, rather than the unread message Bee.
Hows that now?
The number of messages / unread messages should be working properly now but I'm not entirely sure about the unread "to: me" (or you) messages you're seeing. That bit is worked out exactly the same as the thread view selection so either it's a fluke or something is wrong with the database or you do have some unread messages addressed to you which you possibly can't access anymore because the folder has been deleted or hidden or whatever.
<queries database directly>
msg:16937.31
msg:16937.33
msg:16937.75
msg:16937.81
msg:16937.82
msg:29349.5
</qdd>
Those are messages to you that are unread. It looks like some kind of database problem (that has probably since been fixed) as you have read other messages posted after those listed above in both the affected threads.
I've made a change to the unread to me query that means you should be able to see them in the thread list now but I'm not sure if it's going to cause any other problems. If you notice any oddness shout.