summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-28 12:39:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-28 12:39:01 +0300
commitc971b7e7f0cb5d72dffc208421a187d49c4e6895 (patch)
tree78ec08d79a46bcfcd00a4fff0980612667732d86 /protocols/JabberG/src
parente831ce4dfe7a6cb5f87f7eb862d5bbf21f4b4159 (diff)
fixes #3353 (Jabber: пункт меню "Позвонить" не отображается после перезапуска)
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp14
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp26
-rw-r--r--protocols/JabberG/src/jabber_proto.h1
-rw-r--r--protocols/JabberG/src/jabber_voip.cpp22
-rw-r--r--protocols/JabberG/src/stdafx.h1
5 files changed, 30 insertions, 34 deletions
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<CJabberProto>, 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 <m_voiceservice.h>
+
#include <gst/gst.h>
#include <gst/sdp/sdp.h>
#include <gst/rtp/rtp.h>
@@ -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 <m_skin_eng.h>
#include <m_gui.h>
-#include <m_voiceservice.h>
#include <m_voice.h>
#include <openssl/evp.h>