add filter function to messages_controller #304