diff options
-rw-r--r-- | plugins/VoiceService/src/hooks.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 18 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 13 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_voip.cpp | 18 | ||||
-rw-r--r-- | protocols/JabberG/src/stdafx.h | 3 |
6 files changed, 57 insertions, 4 deletions
diff --git a/plugins/VoiceService/src/hooks.cpp b/plugins/VoiceService/src/hooks.cpp index a0e9e85999..bdf8cf1e21 100644 --- a/plugins/VoiceService/src/hooks.cpp +++ b/plugins/VoiceService/src/hooks.cpp @@ -403,7 +403,7 @@ static bool IsCall(VoiceCall *call, const char *szModule, const char *id) && call->id != NULL && strcmp(call->id, id) == 0; } -VoiceCall *FindVoiceCall(const char *szModule, const char *id, bool add) +VoiceCall* FindVoiceCall(const char *szModule, const char *id, bool add) { for (int i = 0; i < calls.getCount(); i++) { if (IsCall(&calls[i], szModule, id)) { @@ -487,7 +487,7 @@ bool IsFinalState(int state) return state == VOICE_STATE_ENDED || state == VOICE_STATE_BUSY; } -VoiceCall *GetTalkingCall() +VoiceCall* GetTalkingCall() { for (int i = 0; i < calls.getCount(); ++i) { VoiceCall *call = &calls[i]; 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>
|