diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-02 11:27:20 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-02 11:27:20 +0000 |
commit | b96fa2b498afb19bda93d0cd1e399589d17d3d3e (patch) | |
tree | 7ffdee1b60531babd7ea6269fd50f91eccdd9bb3 /protocols/SkypeWeb | |
parent | 198c817b781f9982f73c411a30fd6e1e79760a3e (diff) |
SkypeWeb: Sound on call cancel. Minor fixes.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13369 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 34 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 7 |
3 files changed, 37 insertions, 8 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 24d77aef8d..0477c27fdb 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -328,8 +328,8 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) {
HXML xmlId = xi.getChildByPath(xmlNode, _T("id"), 0);
HXML xmlRole = xi.getChildByPath(xmlNode, _T("role"), 0);
- xId = xmlNode != NULL ? mir_t2a(xi.getText(xmlId)) : NULL;
- xRole = xmlNode != NULL ? mir_t2a(xi.getText(xmlRole)) : NULL;
+ xId = xmlId != NULL ? mir_t2a(xi.getText(xmlId)) : NULL;
+ xRole = xmlRole != NULL ? mir_t2a(xi.getText(xmlRole)) : NULL;
}
xi.destroyNode(xml);
initiator = ParseUrl(xinitiator, "8:");
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index b11462fdd4..0d3b1f7578 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -60,10 +60,13 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) dbEventType.descr = Translate("Incoming call");
dbEventType.eventIcon = GetIconHandle("inc_call");
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+
//hooks
m_hCallHook = CreateHookableEvent(MODULE"/IncomingCall");
+
//sounds
- SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound"));
+ SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound") );
+ SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound") );
}
CSkypeProto::~CSkypeProto()
@@ -107,7 +110,30 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) return hContact;
}
-MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT) { return 0; }
+MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent)
+{
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
+ return NULL;
+ if ((dbei.pBlob=(PBYTE)alloca(dbei.cbBlob)) == NULL)
+ return NULL;
+ if (db_event_get(hDbEvent, &dbei))
+ return NULL;
+ if (strcmp(dbei.szModule, m_szModuleName))
+ return NULL;
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
+ return NULL;
+
+ char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
+ char *firstName = nick + strlen(nick) + 1;
+ char *lastName = firstName + strlen(firstName) + 1;
+ char *skypename = lastName + strlen(lastName) + 1;
+
+ char *newSkypename = (dbei.flags & DBEF_UTF) ? mir_utf8decodeA(skypename) : skypename;
+ MCONTACT hContact = AddContact(newSkypename);
+ mir_free(newSkypename);
+ return hContact;
+}
int CSkypeProto::Authorize(MEVENT hDbEvent)
{
@@ -256,12 +282,14 @@ int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam int CSkypeProto::OnPreShutdown(WPARAM, LPARAM)
{
debugLogA(__FUNCTION__);
-
+
isTerminated = true;
if (m_pollingConnection)
CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
if (m_TrouterConnection)
CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0);
+ requestQueue->Stop();
+
return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index ff45e744cd..854a4e75d7 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -28,7 +28,7 @@ void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) ptrA instance(mir_t2a(ptrT(json_as_string(json_get(root, "instance")))));
ptrA socketio(mir_t2a(ptrT(json_as_string(json_get(root, "socketio")))));
ptrA url(mir_t2a(ptrT(json_as_string(json_get(root, "url")))));
- setString("Trouter_ccid", ccid);
+ setString("Trouter_ccid", ccid);
setString("Trouter_connId", connId);
setString("Trouter_instance", instance);
setString("Trouter_socketio", socketio);
@@ -130,6 +130,7 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) case 104: //call canceled: callerId=""; conversationId=NULL; callId=call id
{
ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "callId")))));
+ SkinPlaySound("skype_call_canceled");
break;
}
}
@@ -179,8 +180,8 @@ void CSkypeProto::TRouterThread(void*) JSONROOT root(json);
ptrA szBody(mir_t2a(ptrT(json_as_string(json_get(root, "body")))));
JSONNODE *headers = json_get(root, "headers");
- JSONROOT jsonBody(szBody);
- OnTrouterEvent(jsonBody, headers);
+ JSONNODE *body = json_parse(szBody);
+ OnTrouterEvent(body, headers);
}
m_TrouterConnection = response->nlc;
|