From c971b7e7f0cb5d72dffc208421a187d49c4e6895 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Feb 2023 12:39:01 +0300 Subject: =?UTF-8?q?fixes=20#3353=20(Jabber:=20=D0=BF=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=82=20=D0=BC=D0=B5=D0=BD=D1=8E=20"=D0=9F=D0=BE=D0=B7=D0=B2?= =?UTF-8?q?=D0=BE=D0=BD=D0=B8=D1=82=D1=8C"=20=D0=BD=D0=B5=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/JabberG/src/jabber_opt.cpp | 14 +------------- protocols/JabberG/src/jabber_proto.cpp | 26 ++++++-------------------- protocols/JabberG/src/jabber_proto.h | 1 + protocols/JabberG/src/jabber_voip.cpp | 22 ++++++++++++++++++++++ protocols/JabberG/src/stdafx.h | 1 - 5 files changed, 30 insertions(+), 34 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 5af98f33b2..786d83599b 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -766,19 +766,7 @@ public: else m_proto->m_omemo.deinit(); - // Voip - VOICE_MODULE vsr = {}; - vsr.cbSize = sizeof(VOICE_MODULE); - vsr.description = L"XMPP/DTLS-SRTP"; - vsr.name = m_proto->m_szModuleName; - vsr.icon = g_plugin.getIconHandle(IDI_NOTES); - vsr.flags = 3; - if (m_proto->hasJingle()) - CallService(MS_VOICESERVICE_REGISTER, (WPARAM)&vsr, 0); - else { - m_proto->VOIPTerminateSession(); - CallService(MS_VOICESERVICE_UNREGISTER, (WPARAM)&vsr, 0); - } + m_proto->InitVoip(m_proto->hasJingle()); m_proto->UpdateFeatHash(); m_proto->SendPresence(m_proto->m_iStatus, true); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index dd3a311c90..c1c50ff6da 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -249,17 +249,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_tszSelectedLang = mir_strdup("en"); g_plugin.addPopupOption(CMStringW(FORMAT, TranslateT("%s error notifications"), m_tszUserName), m_bUsePopups); - - // Voip - if (hasJingle()) { - VOICE_MODULE vsr = {}; - vsr.cbSize = sizeof(VOICE_MODULE); - vsr.description = L"XMPP/DTLS-SRTP"; - vsr.name = m_szModuleName; - vsr.icon = g_plugin.getIconHandle(IDI_NOTES); - vsr.flags = 3; - CallService(MS_VOICESERVICE_REGISTER, (WPARAM)&vsr, 0); - } } CJabberProto::~CJabberProto() @@ -277,15 +266,8 @@ CJabberProto::~CJabberProto() DestroyHookableEvent(m_hVoiceEvent); // Voice - VOIPTerminateSession(); - - VOICE_MODULE vsr = {}; - vsr.cbSize = sizeof(VOICE_MODULE); - vsr.description = L"XMPP/DTLS-SRTP"; - vsr.name = m_szModuleName; - vsr.icon = g_plugin.getIconHandle(IDI_NOTES); - vsr.flags = 3; - CallService(MS_VOICESERVICE_UNREGISTER, (WPARAM)&vsr, 0); + if (hasJingle()) + InitVoip(false); // Lists & strings ListWipe(); @@ -347,6 +329,10 @@ void CJabberProto::OnModulesLoaded() CheckAllContactsAreTransported(); + // Voip + if (hasJingle()) + InitVoip(true); + // Set all contacts to offline for (auto &hContact : AccContacts()) { SetContactOfflineStatus(hContact); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index aa952d4bb0..f10a4866ba 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -897,6 +897,7 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_voip.c ----------------------------------------------------------------- + void InitVoip(bool bEnable); bool OnICECandidate(const TiXmlElement *Node); bool OnRTPDescription(const TiXmlElement *Node); bool VOIPCreatePipeline(); diff --git a/protocols/JabberG/src/jabber_voip.cpp b/protocols/JabberG/src/jabber_voip.cpp index 7d7f770b45..ecd20612b5 100644 --- a/protocols/JabberG/src/jabber_voip.cpp +++ b/protocols/JabberG/src/jabber_voip.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" +#include + #include #include #include @@ -557,3 +559,23 @@ INT_PTR CJabberProto::JabberVOIP_dropcall(WPARAM id, LPARAM) VOIPTerminateSession(); return 0; } + +///////////////////////////////////////////////////////////////////////////////////////// +// module entry point + +void CJabberProto::InitVoip(bool bEnable) +{ + // Voip + VOICE_MODULE vsr = {}; + vsr.cbSize = sizeof(VOICE_MODULE); + vsr.description = L"XMPP/DTLS-SRTP"; + vsr.name = m_szModuleName; + vsr.icon = g_plugin.getIconHandle(IDI_NOTES); + vsr.flags = 3; + if (bEnable) + CallService(MS_VOICESERVICE_REGISTER, (WPARAM)&vsr, 0); + else { + VOIPTerminateSession(); + CallService(MS_VOICESERVICE_UNREGISTER, (WPARAM)&vsr, 0); + } +} diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index a2d0d99205..23e3b9b5c7 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -99,7 +99,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include #include #include -- cgit v1.2.3