From 68aeed54fb2c7c7d10c192a99c25d0a0c870b017 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 29 Apr 2013 05:05:06 +0000 Subject: - added new db event type - added new icons - fixed few bugs git-svn-id: http://svn.miranda-ng.org/main/trunk@4565 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype_10.vcxproj | 2 ++ protocols/Skype/Skype_10.vcxproj.filters | 6 ++++++ protocols/Skype/res/Resource.rc | 4 +++- protocols/Skype/res/call.ico | Bin 0 -> 15086 bytes protocols/Skype/res/conf_invite.ico | Bin 0 -> 17542 bytes protocols/Skype/res/main.ico | Bin 5430 -> 90243 bytes protocols/Skype/src/resource.h | 5 ++++- protocols/Skype/src/skype.h | 3 ++- protocols/Skype/src/skype_avatars.cpp | 2 +- protocols/Skype/src/skype_events.cpp | 16 +++++++++------- protocols/Skype/src/skype_hooks.cpp | 9 +++++++-- protocols/Skype/src/skype_icons.cpp | 7 +++++-- protocols/Skype/src/skype_menus.cpp | 2 +- protocols/Skype/src/skype_proto.cpp | 13 +++++++++---- protocols/Skype/src/skype_proto.h | 2 +- protocols/Skype/src/skype_utils.cpp | 4 ++-- 16 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 protocols/Skype/res/call.ico create mode 100644 protocols/Skype/res/conf_invite.ico diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj index a213b0e6d3..236aaa0684 100644 --- a/protocols/Skype/Skype_10.vcxproj +++ b/protocols/Skype/Skype_10.vcxproj @@ -239,6 +239,8 @@ + + diff --git a/protocols/Skype/Skype_10.vcxproj.filters b/protocols/Skype/Skype_10.vcxproj.filters index aad1753c47..b66e82527c 100644 --- a/protocols/Skype/Skype_10.vcxproj.filters +++ b/protocols/Skype/Skype_10.vcxproj.filters @@ -189,5 +189,11 @@ Resource Files\Bin + + Resource Files\Icons + + + Resource Files\Icons + \ No newline at end of file diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index c933a67bbb..2883f15109 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -275,10 +275,12 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON ICON "Main.ico" +IDI_ICON ICON "main.ico" IDI_AUTH_GRANT ICON "auth_grant.ico" IDI_AUTH_REQUEST ICON "auth_request.ico" IDI_AUTH_REVOKE ICON "auth_revoke.ico" +IDI_CALL ICON "call.ico" +IDI_CONF_INVITE ICON "conf_invite.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/protocols/Skype/res/call.ico b/protocols/Skype/res/call.ico new file mode 100644 index 0000000000..59dc94bdce Binary files /dev/null and b/protocols/Skype/res/call.ico differ diff --git a/protocols/Skype/res/conf_invite.ico b/protocols/Skype/res/conf_invite.ico new file mode 100644 index 0000000000..7dfe6dc261 Binary files /dev/null and b/protocols/Skype/res/conf_invite.ico differ diff --git a/protocols/Skype/res/main.ico b/protocols/Skype/res/main.ico index 8f824f2e3d..77d85affad 100644 Binary files a/protocols/Skype/res/main.ico and b/protocols/Skype/res/main.ico differ diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index b6c51c5a9d..524a4ff0fa 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -15,6 +15,9 @@ #define IDI_AUTH_REVOKE 105 #define IDD_PASSWORD_REQUEST 106 #define IDR_KEY 107 +#define IDI_CALL 108 +#define IDI_ICON1 109 +#define IDI_CONF_INVITE 109 #define IDC_CCLIST 173 #define IDC_EDITSCR 174 #define IDC_ADDSCR 175 @@ -48,7 +51,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1025 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index b8463cb10a..3faceb3bf8 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -53,7 +53,8 @@ #define SKYPE_SEARCH_BYEMAIL 1002 #define SKYPE_SEARCH_BYNAMES 1003 -#define SKYPE_DB_EVENT_TYPE_CALL 9000 +#define SKYPE_DB_EVENT_TYPE_EMOTE 10001 +#define SKYPE_DB_EVENT_TYPE_CALL 10010 #define CMI_AUTH_REVOKE 0 #define CMI_AUTH_REQUEST 1 diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index c95d4e3d2a..adf956edeb 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -210,7 +210,7 @@ INT_PTR __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam) return iRet; } - uint newTS = this->account->GetUintProp(/* *::P_AVATAR_TIMESTAMP */ 182); + uint newTS = this->account->GetUintProp(Account::P_AVATAR_IMAGE); ::db_set_dw(NULL, this->m_szModuleName, "AvatarTS", newTS); iRet = 0; diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index ac5bebdab2..bbe7aaf9fe 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -98,6 +98,9 @@ void CSkypeProto::OnMessageReceived(CConversation::Ref &conversation, CMessage:: { SEString data; + CMessage::TYPE messageType; + message->GetPropType(messageType); + uint timestamp; message->GetPropTimestamp(timestamp); @@ -150,6 +153,9 @@ void CSkypeProto::OnMessageSended(CConversation::Ref &conversation, CMessage::Re { SEString data; + CMessage::TYPE messageType; + message->GetPropType(messageType); + uint timestamp; message->GetPropTimestamp(timestamp); @@ -366,9 +372,6 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa switch (messageType) { case CMessage::POSTED_EMOTE: - //int i = 0; - break; - case CMessage::POSTED_TEXT: { SEString author; @@ -485,7 +488,7 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa break; case CMessage::STARTED_LIVESESSION: - //conversation->LeaveLiveSession(); + conversation->LeaveLiveSession(); uint timestamp; message->GetPropTimestamp(timestamp); @@ -498,15 +501,14 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa HANDLE hContact = this->AddContact(author); - wchar_t *message = new wchar_t[14]; - ::wcscpy(message, L"Incoming call"); + char *message = ::mir_utf8encode(Translate("Incoming call")); this->AddDBEvent( hContact, SKYPE_DB_EVENT_TYPE_CALL, timestamp, DBEF_UTF, - (DWORD)::wcslen(message) + 1, + (DWORD)::strlen(message) + 1, (PBYTE)message); break; diff --git a/protocols/Skype/src/skype_hooks.cpp b/protocols/Skype/src/skype_hooks.cpp index 9fb927f1a2..6a2e9073d7 100644 --- a/protocols/Skype/src/skype_hooks.cpp +++ b/protocols/Skype/src/skype_hooks.cpp @@ -18,8 +18,13 @@ void CSkypeProto::UninitHookList() void CSkypeProto::InitInstanceHookList() { - this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); - this->HookEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit); + this->instanceHookList.insert( + this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit)); + this->instanceHookList.insert( + this->HookEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit)); + + this->instanceHookList.insert( + this->HookEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnMessagePreCreate)); } void CSkypeProto::UninitInstanceHookList() diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp index 9a739f57ae..87294370ec 100644 --- a/protocols/Skype/src/skype_icons.cpp +++ b/protocols/Skype/src/skype_icons.cpp @@ -2,7 +2,10 @@ _tag_iconList CSkypeProto::IconList[] = { - { LPGENT("Protocol icon"), "main", IDI_ICON }, + { LPGENT("Protocol icon"), "main", IDI_ICON }, + + { LPGENT("Call"), "call", IDI_CALL }, + { LPGENT("Invite to conference"), "confInvite", IDI_CONF_INVITE }, { LPGENT("Revoke authorization"), "authRevoke", IDI_AUTH_REVOKE }, { LPGENT("Request authorization"), "authRequest", IDI_AUTH_REQUEST }, { LPGENT("Grant authorization"), "authGrant", IDI_AUTH_GRANT }, @@ -38,7 +41,7 @@ HANDLE CSkypeProto::GetIconHandle(const char* name) { for (size_t i = 0; i < SIZEOF(CSkypeProto::IconList); i++) { - if (::strcmp(CSkypeProto::IconList[i].Name, name) == 0) + if (::stricmp(CSkypeProto::IconList[i].Name, name) == 0) return CSkypeProto::IconList[i].Handle; } return 0; diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index 48efbfe558..565d97198f 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -188,7 +188,7 @@ void CSkypeProto::OnInitStatusMenu() mi.position = -1999901006; mi.hParentMenu = HGENMENU_ROOT; mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - mi.icolibItem = CSkypeProto::GetIconHandle("Skype_main"); + mi.icolibItem = CSkypeProto::GetIconHandle("main"); hJabberRoot = m_hMenuRoot = ::Menu_AddProtoMenuItem(&mi); } else { diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 9b5dd72dd3..ba2caabe44 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -11,12 +11,17 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : this->SetAllContactStatus(ID_STATUS_OFFLINE); DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) }; - dbEventType.module = m_szModuleName; - dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL; - dbEventType.descr = "Skype call"; + dbEventType.module = this->m_szModuleName; + dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW; + + dbEventType.eventType = SKYPE_DB_EVENT_TYPE_EMOTE; + dbEventType.descr = "Skype emote"; ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); - this->HookEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnMessagePreCreate); + dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL; + dbEventType.descr = "Skype call"; + dbEventType.eventIcon = CSkypeProto::GetIconHandle("call"); + ::CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); this->InitInstanceServiceList(); } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index bb8388c669..ed9f407c0d 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -369,7 +369,7 @@ protected: void CreateServiceObjParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam); HANDLE CreateEvent(const char* szService); - void HookEvent(const char*, SkypeEventFunc); + HANDLE HookEvent(const char*, SkypeEventFunc); int SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam); int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam); diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 2bd14e00a5..4ad81024b3 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -278,9 +278,9 @@ HANDLE CSkypeProto::CreateEvent(const char* szService) return ::CreateHookableEvent(moduleName); } -void CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler) +HANDLE CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler) { - ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this); + return ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this); } void CSkypeProto::FakeAsync(void *param) -- cgit v1.2.3