summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/VoiceService/src/hooks.cpp4
-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
-rw-r--r--src/mir_app/src/clistmod.cpp10
7 files changed, 41 insertions, 37 deletions
diff --git a/plugins/VoiceService/src/hooks.cpp b/plugins/VoiceService/src/hooks.cpp
index 007208b8fa..fb03ef57cc 100644
--- a/plugins/VoiceService/src/hooks.cpp
+++ b/plugins/VoiceService/src/hooks.cpp
@@ -259,8 +259,8 @@ static int PreBuildContactMenu(WPARAM wParam, LPARAM)
Menu_ShowItem(hCMAnswer, false);
Menu_ShowItem(hCMHold, false);
Menu_ShowItem(hCMDrop, false);
- for (unsigned int i = 0; i < hCMCalls.size(); ++i)
- Menu_ShowItem(hCMCalls[i], false);
+ for (auto &it : hCMCalls)
+ Menu_ShowItem(it, false);
MCONTACT hContact = (MCONTACT)wParam;
if (hContact == NULL)
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>
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index 19b9a8a860..df3e6f8641 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -158,8 +158,17 @@ static void AddProtoIconIndex(PROTOACCOUNT *pa)
}
}
+static int ContactListModulesLoaded2(WPARAM, LPARAM)
+{
+ InitStaticAccounts();
+ return 0;
+}
+
static int ContactListModulesLoaded(WPARAM, LPARAM)
{
+ // delay accounts initialization after all plugins initialization
+ HookEvent(ME_SYSTEM_MODULESLOADED, ContactListModulesLoaded2);
+
ScheduleMenuUpdate();
RebuildMenuOrder();
@@ -171,7 +180,6 @@ static int ContactListModulesLoaded(WPARAM, LPARAM)
LoadCLUIModule();
InitClistHotKeys();
- InitStaticAccounts();
InitMoveToGroup();
CMenuItem mi(&g_plugin);