calculate unread messages