diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-01 17:30:38 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-01 17:30:38 +0000 |
commit | 835dab85f2585c4c3fda5e4d21384aa19edb8104 (patch) | |
tree | e67cc3c62049b181e4604bb6eecc9fc3d7c86cfe /protocols/SkypeWeb/src/skype_trouter.cpp | |
parent | b9852a65f0facc5c2e7239f4751050f12bc15a4d (diff) |
SkypeWeb: Optimizations.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13338 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_trouter.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index c4a8b62932..c89e184fad 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -93,29 +93,43 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) {
ptrT displayname(json_as_string(json_get(body, "displayName")));
ptrT uid(json_as_string(json_get(body, "conversationId")));
+ ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "callId")))));
+ int evt = json_as_int(json_get(body, "evt"));
- MCONTACT hContact = FindContact(_T2A(uid));
- if (hContact != NULL)
+ switch (evt)
{
- MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ);
- SkinPlaySound("skype_inc_call");
+ case 100: //incoming call
+ {
+ if (uid != NULL)
+ {
+ MCONTACT hContact = AddContact(_T2A(uid), true);
- CLISTEVENT cle = { sizeof(cle) };
- cle.flags |= CLEF_TCHAR;
- cle.hContact = hContact;
- cle.hDbEvent = hEvent;
- cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
- cle.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call"));
+ MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId);
+ SkinPlaySound("skype_inc_call");
- CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact));
- cle.pszService = service.GetBuffer();
+ CLISTEVENT cle = { sizeof(cle) };
+ cle.flags |= CLEF_TCHAR;
+ cle.hContact = hContact;
+ cle.hDbEvent = hEvent;
+ cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
+ cle.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call"));
- CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
- cle.ptszTooltip = tooltip.GetBuffer();
+ CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact));
+ cle.pszService = service.GetBuffer();
- CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
+ CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ cle.ptszTooltip = tooltip.GetBuffer();
- ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), 0, hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL);
+ CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
+
+ ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), 0, hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL);
+ }
+ break;
+ }
+ case 104: //call canceled
+ {
+ break;
+ }
}
}
|