From b39fed5ae59f261d614fc0a69ebec0c590fcbba2 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Tue, 5 May 2015 17:30:30 +0000 Subject: SkypeWeb: Writing calls to db rework. Attempt change the icon events (it not work). git-svn-id: http://svn.miranda-ng.org/main/trunk@13446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/SkypeWeb.vcxproj.filters | 3 --- protocols/SkypeWeb/src/main.cpp | 3 ++- protocols/SkypeWeb/src/skype_messages.cpp | 7 +++---- protocols/SkypeWeb/src/skype_proto.cpp | 13 +------------ protocols/SkypeWeb/src/skype_proto.h | 7 ++++++- protocols/SkypeWeb/src/skype_trouter.cpp | 3 ++- 6 files changed, 14 insertions(+), 22 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters index e53b25d4b7..cb9ede3ade 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters @@ -37,9 +37,6 @@ Header Files\requests - - Header Files\requests - Header Files\requests diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index f82fb49fc3..af56804714 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -72,7 +72,8 @@ extern "C" int __declspec(dllexport) Load(void) CSkypeProto::InitIcons(); CSkypeProto::InitMenus(); CSkypeProto::InitLanguages(); - + CreateServiceFunction(MODULE"/GetEventIcon", &CSkypeProto::EventGetIcon); + CreateServiceFunction(MODULE"/GetCallText", &CSkypeProto::GetCallEventText); HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded); return 0; diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 2082370811..985e0f2f4d 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -66,14 +66,13 @@ MEVENT CSkypeProto::AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD fla return AddEventToDb(hContact, emoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION, timestamp, flags, (DWORD)cbBlob, pBlob); } -MEVENT CSkypeProto::AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId) +MEVENT CSkypeProto::AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId, const char *gp) { - const char *message = Translate("Incoming call"); size_t callIdLength = mir_strlen(callId); - size_t messageLength = mir_strlen(message) + 1; + size_t messageLength = mir_strlen(gp) + 1; size_t cbBlob = messageLength + callIdLength; PBYTE pBlob = (PBYTE)mir_alloc(cbBlob); - memcpy(pBlob, message, messageLength); + memcpy(pBlob, gp, messageLength); memcpy(pBlob + messageLength, callId, callIdLength); return AddEventToDb(hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL, timestamp, flags, (DWORD)cbBlob, pBlob); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index df6a7daf09..ec56bc71f7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -61,18 +61,7 @@ PROTO(protoName, userName), password(NULL) db_set_resident(m_szModuleName, "Trouter_sig"); db_set_resident(m_szModuleName, "Trouter_SessId"); - // custom event - DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) }; - dbEventType.module = m_szModuleName; - dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW; - dbEventType.eventType = SKYPE_DB_EVENT_TYPE_ACTION; - dbEventType.descr = Translate("Action"); - CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); - - dbEventType.eventType = SKYPE_DB_EVENT_TYPE_INCOMING_CALL; - dbEventType.descr = Translate("Incoming call"); - dbEventType.eventIcon = GetIconHandle("inc_call"); - CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); + InitDBEvents(); //hooks m_hCallHook = CreateHookableEvent(MODULE"/IncomingCall"); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index d7f6fe5aba..9847fdcc5a 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -88,6 +88,8 @@ public: UINT_PTR m_timer; static int CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2); void CSkypeProto::ProcessTimer(); + static INT_PTR EventGetIcon (WPARAM wParam, LPARAM lParam); + static INT_PTR GetCallEventText(WPARAM, LPARAM lParam); private: char *password; @@ -223,7 +225,7 @@ private: MEVENT GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp = 0); MEVENT AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *messageId, char *content, int emoteOffset = 0); - MEVENT AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId); + MEVENT AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId, const char *gp); int OnReceiveMessage(const char *messageId, const char *url, time_t timestamp, char *content, int emoteOffset = 0, bool isRead = false); int SaveMessageToDb(MCONTACT hContact, PROTORECVEVENT *pre); @@ -313,6 +315,9 @@ private: void CALLBACK SkypeUnsetTimer(void*); void CALLBACK SkypeSetTimer(void*); + //events + void CSkypeProto::InitDBEvents(); + //services INT_PTR __cdecl OnIncomingCallCLE (WPARAM wParam, LPARAM lParam); INT_PTR __cdecl OnIncomingCallPP (WPARAM wParam, LPARAM lParam); diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index a93188e2b3..adb9ec3df1 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -131,6 +131,7 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) ptrT displayname(json_as_string(json_get(body, "displayName"))); ptrT cuid(json_as_string(json_get(body, "callerId"))); ptrT uid(json_as_string(json_get(body, "conversationId"))); + ptrT gp(json_as_string(json_get(body, "gp"))); int evt = json_as_int(json_get(body, "evt")); switch (evt) @@ -142,7 +143,7 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *headers) { MCONTACT hContact = AddContact(_T2A(uid), true); - MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId); + MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId, _T2A(gp)); SkinPlaySound("skype_inc_call"); CLISTEVENT cle = { sizeof(cle) }; -- cgit v1.2.3