File linphoneqt-0005-enforce-media-encryption.patch of Package linphoneqt

diff -U 3 -H -b -B -d -r -N -- a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp
--- a/linphone-app/src/components/settings/SettingsModel.cpp	
+++ b/linphone-app/src/components/settings/SettingsModel.cpp	
@@ -1069,28 +1069,33 @@
 								  static_cast<linphone::MediaEncryption>(encryption)
 								  );
 	if (mandatoryMediaEncryptionEnabled() && encryption == SettingsModel::MediaEncryptionNone) {
-		//Disable mandatory encryption if none is selected
-		enableMandatoryMediaEncryption(false);
+		//Enforce mandatory encryption if none is selected
+		enableMandatoryMediaEncryption(true);
+		setMediaEncryption(SettingsModel::MediaEncryptionZrtp);
 	}
-
 	emit mediaEncryptionChanged(encryption);
 }
 
-bool SettingsModel::mandatoryMediaEncryptionEnabled () const {
+bool SettingsModel::mandatoryMediaEncryptionEnabled () {
+	//Enforce mandatory media encryption
+	enableMandatoryMediaEncryption(true);
+	CoreManager::getInstance()->getCore()->setMediaEncryptionMandatory(true);
+	if (getMediaEncryption() == SettingsModel::MediaEncryptionNone) {
+		//Force	to Post Quantum ZRTP if mandatory but 'None' encryption method selected
+		setMediaEncryption(SettingsModel::MediaEncryptionZrtp);
+		emit mediaEncryptionChanged(getMediaEncryption());
+	} 
 	return CoreManager::getInstance()->getCore()->isMediaEncryptionMandatory();
 }
 
 void SettingsModel::enableMandatoryMediaEncryption(bool mandatory) {
-	if (mandatoryMediaEncryptionEnabled() == mandatory) {
-		return;
-	}
+	//Enforce mandatory media encryption
 	CoreManager::getInstance()->getCore()->setMediaEncryptionMandatory(mandatory);
 	if (mandatory && getMediaEncryption() == SettingsModel::MediaEncryptionNone) {
-		//Force	to SRTP if mandatory but 'none' was selected
-		setMediaEncryption(SettingsModel::MediaEncryptionSrtp);
-	} else {
-		emit mediaEncryptionChanged(getMediaEncryption());
+		//Force	to Post Quantum ZRTP if mandatory but 'none' was selected
+		setMediaEncryption(SettingsModel::MediaEncryptionZrtp);
 	}
+	emit mediaEncryptionChanged(getMediaEncryption());
 }
 
 bool SettingsModel::getPostQuantumAvailable() const{
diff -U 3 -H -b -B -d -r -N -- a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp
--- a/linphone-app/src/components/settings/SettingsModel.hpp	
+++ b/linphone-app/src/components/settings/SettingsModel.hpp	
@@ -485,7 +485,7 @@
 	MediaEncryption getMediaEncryption () const;
 	void setMediaEncryption (MediaEncryption encryption);
 	
-	bool mandatoryMediaEncryptionEnabled () const;
+	bool mandatoryMediaEncryptionEnabled ();
 	void enableMandatoryMediaEncryption(bool mandatory);
 	
 	bool getPostQuantumAvailable() const;
openSUSE Build Service is sponsored by