diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-30 17:04:08 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-30 17:04:08 +0000 |
commit | fc36545dac2ad60dcc5f628b32f460295f7316ec (patch) | |
tree | abe4a76a6d45974c2a2ebcbf7d227906fe357e8e /protocols/SkypeWeb | |
parent | 0f03399b85a33d6abe5321715df190df3f6a793c (diff) |
SkypeWeb: ClistEvent on incoming call.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13294 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 24 |
3 files changed, 30 insertions, 3 deletions
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 37ca1c6e2f..1967a35a9a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -40,6 +40,8 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CreateProtoService(PS_GETMYAVATART, &CSkypeProto::SvcGetMyAvatar);
CreateProtoService(PS_SETMYAVATART, &CSkypeProto::SvcSetMyAvatar);
+ CreateProtoService("/IncomingCall", &CSkypeProto::OnIncomingCall);
+
m_tszAvatarFolder = std::tstring(VARST(_T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -57,7 +59,9 @@ 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"));
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 52d4477b47..0a942bcf06 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -84,7 +84,7 @@ private: RequestQueue *requestQueue;
bool isTerminated;
std::map<std::string, std::string> cookies;
- HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread, m_TrouterConnection;
+ HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread, m_TrouterConnection, m_hCallHook;
static std::map<std::tstring, std::tstring> languages;
static INT_PTR CALLBACK PasswordEditorProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -290,6 +290,7 @@ private: char *GetServerFromUrl (const char *url);
//services
+ INT_PTR __cdecl OnIncomingCall (WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl BlockContact (WPARAM hContact, LPARAM);
INT_PTR __cdecl UnblockContact (WPARAM hContact, LPARAM);
INT_PTR __cdecl OnRequestAuth (WPARAM hContact, LPARAM lParam);
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 039107e0fd..03f04e7a35 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -97,8 +97,23 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) MCONTACT hContact = FindContact(_T2A(uid));
if (hContact != NULL)
{
- AddCallToDb(hContact, time(NULL), 0);
+ MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ);
SkinPlaySound("skype_inc_call");
+
+ 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"));
+
+ CMStringA service(FORMAT, "%s/IncomingCall", GetContactProto(hContact));
+ cle.pszService = service.GetBuffer();
+
+ CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ cle.ptszTooltip = tooltip.GetBuffer();
+
+ CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
}
@@ -162,4 +177,11 @@ void CSkypeProto::TRouterThread(void*) m_hTrouterThread = NULL;
m_TrouterConnection = NULL;
debugLogA(__FUNCTION__": leaving");
+}
+
+INT_PTR CSkypeProto::OnIncomingCall(WPARAM wParam, LPARAM lParam)
+{
+ CLISTEVENT *cle = (CLISTEVENT*)lParam;
+ NotifyEventHooks(m_hCallHook, (WPARAM)cle->hContact, (LPARAM)0);
+ return 0;
}
\ No newline at end of file |