From 303d55bea87c9a33267f5d1b351f883b0da78ddd Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 20 Apr 2013 21:37:28 +0000 Subject: Added notification about incoming skype call git-svn-id: http://svn.miranda-ng.org/main/trunk@4493 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.h | 2 ++ protocols/Skype/src/skype_database.cpp | 13 ++++++------- protocols/Skype/src/skype_events.cpp | 28 +++++++++++++++++++++++++++- protocols/Skype/src/skype_proto.cpp | 6 ++++++ protocols/Skype/src/skype_proto.h | 2 +- protocols/Skype/src/skype_runtime.cpp | 4 +++- protocols/Skype/src/skype_subclassing.h | 6 +++--- 7 files changed, 48 insertions(+), 13 deletions(-) (limited to 'protocols/Skype/src') diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index 963235e755..f489a78803 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -69,6 +69,8 @@ #define SKYPE_SEARCH_BYEMAIL 1002 #define SKYPE_SEARCH_BYNAMES 1003 +#define SKYPE_DB_EVENT_TYPE_CALL 9000 + #define CMI_AUTH_REVOKE 0 #define CMI_AUTH_REQUEST 1 #define CMI_AUTH_GRANT 2 diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 8b3088b484..6ce36fbaa8 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -1,18 +1,17 @@ #include "skype_proto.h" -HANDLE CSkypeProto::AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags, DWORD cbBlob, PBYTE pBlob) +HANDLE CSkypeProto::AddDataBaseEvent(HANDLE hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) { - DBEVENTINFO dbei = {0}; - + DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); dbei.szModule = this->m_szModuleName; - dbei.timestamp = time; - dbei.flags = flags; - dbei.eventType = type; + dbei.timestamp = timestamp; + dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = cbBlob; dbei.pBlob = pBlob; + dbei.flags = flags; - return (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei); + return ::db_event_add(hContact, &dbei); } void CSkypeProto::RaiseAuthRequestEvent( diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 34f46f8fd6..3b2d781ccc 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -469,6 +469,32 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa } break; + case CMessage::STARTED_LIVESESSION: + //conversation->LeaveLiveSession(); + + uint timestamp; + message->GetPropTimestamp(timestamp); + + SEString identity; + message->GetPropAuthor(identity); + + CContact::Ref author; + this->skype->GetContact(identity, author); + + HANDLE hContact = this->AddContact(author); + + wchar_t *message = new wchar_t[14]; + ::wcscpy(message, L"Incoming call"); + + this->AddDataBaseEvent( + hContact, + SKYPE_DB_EVENT_TYPE_CALL, + timestamp, + DBEF_UTF, + ::wcslen(message) + 1, + (PBYTE)message); + break; + //case CMessage::REQUESTED_AUTH: // break; @@ -478,4 +504,4 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa //case CMessage::BLOCKED: // break; } -} +} \ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 95fbf1d96a..13a51a0d74 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -13,6 +13,12 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : fileTra this->signin_lock = CreateMutex(0, false, 0); this->SetAllContactStatus(ID_STATUS_OFFLINE); + DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) }; + dbEventType.module = m_szModuleName; + dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL; + dbEventType.descr = "Call"; + ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); + this->HookEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnMessagePreCreate); this->CreateServiceObj(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit); diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 5cf18527b5..333ba1f89e 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -471,7 +471,7 @@ protected: // database bool IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* guid, int flag = 0); - HANDLE AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags, DWORD cbBlob, PBYTE pBlob); + HANDLE AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags = 0, DWORD cbBlob = 0, PBYTE pBlob = 0); void RaiseMessageReceivedEvent( HANDLE hContact, DWORD timestamp, diff --git a/protocols/Skype/src/skype_runtime.cpp b/protocols/Skype/src/skype_runtime.cpp index eb0bf0ccfd..45c1def4a2 100644 --- a/protocols/Skype/src/skype_runtime.cpp +++ b/protocols/Skype/src/skype_runtime.cpp @@ -6,7 +6,9 @@ void CSkypeProto::InitSkype() wchar_t *dbPath = ::Utils_ReplaceVarsT(L"%miranda_userdata%\\SkypeKit\\"); this->skype = CSkype::GetInstance(g_hInstance, profileName, dbPath); - this->skype->SetOnMessageCallback((CSkype::OnMessaged)&CSkypeProto::OnMessage, this); + this->skype->SetOnMessageCallback( + (CSkype::OnMessaged)&CSkypeProto::OnMessage, + this); } void CSkypeProto::UninitSkype() diff --git a/protocols/Skype/src/skype_subclassing.h b/protocols/Skype/src/skype_subclassing.h index 95f8cac9a7..13fa95e7c3 100644 --- a/protocols/Skype/src/skype_subclassing.h +++ b/protocols/Skype/src/skype_subclassing.h @@ -195,7 +195,7 @@ private: const MessageRef & supersedesHistoryMessage, const ConversationRef & conversation); - static BOOL IsRunAsAdmin(); - static char *LoadKeyPair(HINSTANCE hInstance); - static int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port, const wchar_t *dbPath); + static BOOL IsRunAsAdmin(); + static char *LoadKeyPair(HINSTANCE hInstance); + static int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port, const wchar_t *dbPath); }; \ No newline at end of file -- cgit v1.2.3