From bdd8a52dfef293e19da260804f6156a66f05c236 Mon Sep 17 00:00:00 2001
From: Howard Stearns <howard.stearns@gmail.com>
Date: Thu, 30 Dec 2021 10:05:52 -0800
Subject: SL-13297 - Record and use build version reported by SLVoice

---
 indra/newview/llappviewer.cpp   | 12 +++++-------
 indra/newview/llvoiceclient.cpp |  1 +
 indra/newview/llvoiceclient.h   |  1 +
 indra/newview/llvoicevivox.cpp  | 22 +++++++++++++++++++++-
 indra/newview/llvoicevivox.h    |  2 ++
 5 files changed, 30 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 58a164f1d0..cebba9158c 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -30,7 +30,6 @@
 
 // Viewer includes
 #include "llversioninfo.h"
-#include "lllicenseinfo.h"
 #include "llfeaturemanager.h"
 #include "lluictrlfactory.h"
 #include "lltexteditor.h"
@@ -3208,18 +3207,17 @@ LLSD LLAppViewer::getViewerInfo() const
 	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : "Undefined";
 	if(LLVoiceClient::getInstance()->voiceEnabled())
 	{
-        auto& licenseInfo(LLLicenseInfo::instance());
-        std::string detailed_version = licenseInfo.getVersion("slvoice");
         LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
+        std::string buildVersion = version.buildVersion;
 		std::ostringstream version_string;
-        if (std::equal(detailed_version.begin(), detailed_version.begin() + version.serverVersion.size(),
+        if (std::equal(buildVersion.begin(), buildVersion.begin() + version.serverVersion.size(),
                        version.serverVersion.begin()))
-        {  // Normal case: Show type and detailed version.
-            version_string << version.serverType << " " << detailed_version << std::endl;
+        {  // Normal case: Show type and build version.
+            version_string << version.serverType << " " << buildVersion << std::endl;
         }
         else
         {  // Mismatch: Show both versions.
-            version_string << version.serverVersion << "/" << detailed_version << std::endl;
+            version_string << version.serverVersion << "/" << buildVersion << std::endl;
         }
 		info["VOICE_VERSION"] = version_string.str();
 	}
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index e2bd1a39c7..dac609140a 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -200,6 +200,7 @@ const LLVoiceVersionInfo LLVoiceClient::getVersion()
 		LLVoiceVersionInfo result;
 		result.serverVersion = std::string();
 		result.serverType = std::string();
+		result.buildVersion = std::string();
 		return result;
 	}
 }
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index cf527a4464..cf6e308fc0 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -95,6 +95,7 @@ struct LLVoiceVersionInfo
 {
 	std::string serverType;
 	std::string serverVersion;
+	std::string buildVersion;
 };
 
 //////////////////////////////////
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index c7a544f8eb..437633da98 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -4548,6 +4548,23 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st
 	}
 }
 
+void LLVivoxVoiceClient::voiceServiceConnectionStateChangedEvent(int statusCode, std::string &statusString, std::string &buildID)
+{
+	// We don't generally need to process this. However, one occurence is when we first connect, and so it is the
+	// earliest opportunity to learn what we're connected to.
+	if (statusCode)
+	{
+		LL_WARNS("Voice") << "VoiceServiceConnectionStateChangedEvent statusCode: " << statusCode <<
+			"statusString: " << statusString << LL_ENDL;
+		return;
+	}
+	if (buildID.empty())
+	{
+		return;
+	}
+	mVoiceVersion.buildVersion = buildID;
+}
+
 void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
 {
 	LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL;
@@ -7528,6 +7545,8 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
 			connectorHandle = string;
 		else if (!stricmp("VersionID", tag))
 			versionID = string;
+		else if (!stricmp("Version", tag))
+			buildID = string;
 		else if (!stricmp("AccountHandle", tag))
 			accountHandle = string;
 		else if (!stricmp("State", tag))
@@ -7830,7 +7849,8 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
 			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
 		}
 		else if (!stricmp(eventTypeCstr, "VoiceServiceConnectionStateChangedEvent"))
-		{	// Yet another ignored event
+		{
+			LLVivoxVoiceClient::getInstance()->voiceServiceConnectionStateChangedEvent(statusCode, statusString, buildID);
 		}
 		else if (!stricmp(eventTypeCstr, "AudioDeviceHotSwapEvent"))
 		{
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index cf30a4e86a..7e9859d347 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -465,6 +465,7 @@ protected:
 	void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
 	void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
 	void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+	void voiceServiceConnectionStateChangedEvent(int statusCode, std::string &statusString, std::string &buildID);
 	void auxAudioPropertiesEvent(F32 energy);
 	void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
 	void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
@@ -969,6 +970,7 @@ protected:
 	std::string		actionString;
 	std::string		connectorHandle;
 	std::string		versionID;
+	std::string		buildID;
 	std::string		accountHandle;
 	std::string		sessionHandle;
 	std::string		sessionGroupHandle;
-- 
cgit v1.2.3