Improve trim/history behavior

trim on number of messages, not number of messages + notifications (fix #1121), throttle multiple history loads