event handler for messages added