summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-07 18:11:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-07 18:11:51 +0300
commit7ef04dbd77d561031c318f6066783e1b279d541c (patch)
tree3c62771e3f2609f8bf7d98c81aa33fa868ec2593 /protocols/JabberG
parent8b8313f8ddf570c5e79fef25e3dbba76698d28ea (diff)
Jabber: fix for VoiceService calling
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp18
-rw-r--r--protocols/JabberG/src/jabber_proto.h5
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp13
-rw-r--r--protocols/JabberG/src/jabber_voip.cpp18
-rw-r--r--protocols/JabberG/src/stdafx.h3
5 files changed, 55 insertions, 2 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index ce1dcca454..db9d903b56 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -180,6 +180,12 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
CreateProtoService(JS_GETJABBERAPI, &CJabberProto::JabberGetApi);
+ // Voice
+ m_hVoiceEvent = CreateProtoEvent(PE_VOICE_CALL_STATE);
+ CreateProtoService(PS_VOICE_CALL, &CJabberProto::JabberVOIP_call);
+ CreateProtoService(PS_VOICE_ANSWERCALL, &CJabberProto::JabberVOIP_answercall);
+ CreateProtoService(PS_VOICE_DROPCALL, &CJabberProto::JabberVOIP_dropcall);
+
// XEP-0224 support (Attention/Nudge)
CreateProtoService(PS_SEND_NUDGE, &CJabberProto::JabberSendNudge);
@@ -242,6 +248,17 @@ 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 (m_bEnableVOIP) {
+ 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()
@@ -255,6 +272,7 @@ CJabberProto::~CJabberProto()
DestroyHookableEvent(m_hEventNudge);
DestroyHookableEvent(m_hEventXStatusIconChanged);
DestroyHookableEvent(m_hEventXStatusChanged);
+ DestroyHookableEvent(m_hVoiceEvent);
ListWipe();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index c7b736a13f..8475e110f6 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -156,6 +156,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl GetMyAwayMsg(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl JabberVOIP_call(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl JabberVOIP_answercall(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl JabberVOIP_dropcall(WPARAM hContact, LPARAM);
+
//====| Events |======================================================================
void __cdecl OnAddContactForever(MCONTACT hContact);
int __cdecl OnDbMarkedRead(WPARAM, LPARAM);
@@ -900,6 +904,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
CMStringA m_voipSession, m_voipPeerJid;
CMStringA m_voipICEPwd, m_voipICEUfrag, m_medianame;
bool m_isOutgoing;
+ HANDLE m_hVoiceEvent;
struct _GstElement *m_pipe1 = NULL;
struct _GstElement *m_webrtc1 = NULL;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 6f2fb75278..689e7b00a6 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1786,11 +1786,20 @@ bool CJabberProto::OnProcessJingle(const TiXmlElement *node)
const TiXmlElement *descr = XmlGetChildByTag(content, "description", "xmlns", JABBER_FEAT_JINGLE_RTP);
if (m_bEnableVOIP && m_voipSession == "" && descr) {
- if (VOIPCallAccept(child, from)) {
+ /* if (VOIPCallAccept(child, from)) {
m_voipSession = szSid;
m_voipPeerJid = from;
return true;
- }
+ }*/
+ VOICE_CALL vc = {};
+ vc.cbSize = sizeof(VOICE_CALL);
+ vc.moduleName = m_szModuleName;
+ vc.id = "jvhvjvjbj"; // Protocol especific ID for this call
+ vc.flags = 0;
+ vc.hContact = HContactFromJID(from); // Contact associated with the call (can be NULL)
+ vc.state = VOICE_STATE_RINGING;
+ NotifyEventHooks(m_hVoiceEvent, WPARAM(&vc), 0);
+ return true;
}
XmlNodeIq iq("set", SerialNext(), from);
diff --git a/protocols/JabberG/src/jabber_voip.cpp b/protocols/JabberG/src/jabber_voip.cpp
index 146fcfb5c4..c4f89786af 100644
--- a/protocols/JabberG/src/jabber_voip.cpp
+++ b/protocols/JabberG/src/jabber_voip.cpp
@@ -522,3 +522,21 @@ bool CJabberProto::VOIPCallAccept(const TiXmlElement *jingleNode, const char *fr
m_ThreadInfo->send(iq);
return true;
}
+
+INT_PTR CJabberProto::JabberVOIP_call(WPARAM hContact, LPARAM)
+{
+ MessageBoxA(0,"CALL called", NULL,0);
+ return 0;
+}
+
+INT_PTR CJabberProto::JabberVOIP_answercall(WPARAM hContact, LPARAM)
+{
+ MessageBoxA(0,"ANSWER called", NULL,0);
+ return 0;
+}
+
+INT_PTR CJabberProto::JabberVOIP_dropcall(WPARAM hContact, LPARAM)
+{
+ MessageBoxA(0,"DROP called", NULL,0);
+ return 0;
+}
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index bef8ca3332..6147577fa3 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -99,6 +99,9 @@ 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>
#include <openssl/hmac.h>
#include <openssl/rand.h>