diff options
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 21 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 24 |
4 files changed, 47 insertions, 8 deletions
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 1967a35a9a..ee70a947c8 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -40,7 +40,8 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CreateProtoService(PS_GETMYAVATART, &CSkypeProto::SvcGetMyAvatar);
CreateProtoService(PS_SETMYAVATART, &CSkypeProto::SvcSetMyAvatar);
- CreateProtoService("/IncomingCall", &CSkypeProto::OnIncomingCall);
+ CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE);
+ CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP);
m_tszAvatarFolder = std::tstring(VARST(_T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 0a942bcf06..bc5ac7bafc 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -279,9 +279,11 @@ private: char *MirandaToSkypeStatus(int status);
static void ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
- static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
+ static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL, int type = 0);
static bool IsFileExists(std::tstring path);
+ static LRESULT CALLBACK PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
char *ParseUrl(const char *url, const char *token);
char *ChatUrlToName (const char *url);
@@ -290,7 +292,8 @@ private: char *GetServerFromUrl (const char *url);
//services
- INT_PTR __cdecl OnIncomingCall (WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnIncomingCallCLE (WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnIncomingCallPP (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 03f04e7a35..169b2962f4 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -107,13 +107,15 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
cle.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call"));
- CMStringA service(FORMAT, "%s/IncomingCall", GetContactProto(hContact));
+ CMStringA service(FORMAT, "%s/IncomingCallCLE", 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);
+
+ ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), 0, hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL);
}
}
@@ -179,9 +181,24 @@ void CSkypeProto::TRouterThread(void*) debugLogA(__FUNCTION__": leaving");
}
-INT_PTR CSkypeProto::OnIncomingCall(WPARAM wParam, LPARAM lParam)
+INT_PTR CSkypeProto::OnIncomingCallCLE(WPARAM wParam, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
NotifyEventHooks(m_hCallHook, (WPARAM)cle->hContact, (LPARAM)0);
return 0;
+}
+
+INT_PTR CSkypeProto::OnIncomingCallPP(WPARAM wParam, LPARAM hContact)
+{
+ CLISTEVENT *cle = NULL;
+ while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, hContact, 0)))
+ {
+ if (cle->lParam == SKYPE_DB_EVENT_TYPE_INCOMING_CALL)
+ {
+ CallService(MS_CLIST_REMOVEEVENT, hContact, cle->hDbEvent);
+ break;
+ }
+ }
+ NotifyEventHooks(m_hCallHook, (WPARAM)cle->hContact, (LPARAM)0);
+ return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 85c803cef9..d029be8cc3 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -453,7 +453,7 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) return ID_STATUS_OFFLINE;
}
-void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int flags, MCONTACT hContact)
+void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int flags, MCONTACT hContact, int type)
{
if (Miranda_Terminated())
return;
@@ -462,9 +462,11 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, i {
POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact;
- mir_tstrcpy(ppd.lpwzContactName, caption);
- mir_tstrcpy(ppd.lpwzText, message);
+ _tcsncpy(ppd.lptzContactName, caption, MAX_CONTACTNAME);
+ _tcsncpy(ppd.lptzText, message, MAX_SECONDLINE);
ppd.lchIcon = Skin_GetIcon("Skype_main");
+ if (type == SKYPE_DB_EVENT_TYPE_INCOMING_CALL)
+ ppd.PluginWindowProc = PopupDlgProcCall;
if (!PUAddPopupT(&ppd))
return;
@@ -473,6 +475,22 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, i MessageBox(NULL, message, caption, MB_OK | flags);
}
+LRESULT CSkypeProto::PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
+ PUDeletePopup(hPopup);
+ break;
+ case WM_COMMAND:
+ PUDeletePopup(hPopup);
+ CallService(MODULE"/IncomingCallPP", 0, PUGetContact(hPopup));
+
+ break;
+ }
+
+ return DefWindowProc(hPopup, uMsg, wParam, lParam);
+}
+
void CSkypeProto::ShowNotification(const TCHAR *message, int flags, MCONTACT hContact)
{
ShowNotification(_T(MODULE), message, flags, hContact);
|