MDL-45347 messages: Created new API function message_get_messages