From 8a9bb6dc6923a3a9a77bb8a0f397edeac8407a8a Mon Sep 17 00:00:00 2001 From: Salanto Date: Tue, 4 May 2021 05:39:50 +0200 Subject: [PATCH] Add Asset Packet This packet is used to send the client the URL of an online content repository, if available. --- include/aoapplication.h | 10 ++++++++++ src/packet_distribution.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/aoapplication.h b/include/aoapplication.h index 7f7f3e1..835c7fd 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -501,6 +501,16 @@ public: // The file name of the log file in base/logs. QString log_filename; + /** + * @brief A QString of an URL that defines the content repository + * send by the server. + * + * @details Introduced in Version 2.9.2. + * Addresses the issue of contenturl devlivery for WebAO + * without relying on someone adding the link manually. + */ + QString asset_url; + void initBASS(); static void load_bass_opus_plugin(); static void CALLBACK BASSreset(HSTREAM handle, DWORD channel, DWORD data, diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index dc76ec1..2860720 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -703,6 +703,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_courtroom->on_authentication_state_received(authenticated); } + //AssetURL Packet + else if (header == "ASS") { + if (f_contents.size() > 1) { // This can never be more than one link. + goto end; + } + QUrl t_asset_url = QUrl::fromPercentEncoding(f_contents.at(0).toUtf8()); + if (t_asset_url.isValid()) + asset_url = t_asset_url.toString(); + } + end: delete p_packet;