From 45bef0474cd2f5767f74478db076c0ad8420e0ff Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 14 Jun 2013 22:05:02 +0000 Subject: Skype: fix invite button in chat rooms git-svn-id: http://svn.miranda-ng.org/main/trunk@4950 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_chat.cpp | 30 ++++++++++++++++++++++++++++-- protocols/Skype/src/skype_profile.cpp | 4 ++-- protocols/Skype/src/skype_runtime.cpp | 28 ++++++++++++++-------------- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 600de624b2..3e54c57399 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -218,7 +218,7 @@ void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { - ptrW joinBlob = ::db_get_wsa(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID); + ptrW joinBlob = ::db_get_wsa(gci.hContact, ppro->m_szModuleName, "JoinBlob"); if ( joinBlob == NULL) { this->conversation->GetPropIdentity(data); @@ -1172,6 +1172,32 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) } break; + case CHAT_LIST_MENU::ICM_CONF_INVITE: + { + GC_INFO gci = {0}; + gci.Flags = BYID | USERS; + gci.pszModule = this->m_szModuleName; + gci.pszID = gch->pDest->ptszID; + if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci) && gci.pszUsers != NULL) + { + StringList invitedContacts(_A2T(gci.pszUsers)); + InviteChatParam *param = new InviteChatParam(NULL, invitedContacts, this); + + if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::InviteToChatProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0) + { + SEStringList needToAdd; + for (size_t i = 0; i < param->invitedContacts.size(); i++) + { + if (!invitedContacts.contains(param->invitedContacts[i])) + needToAdd.append((char *)_T2A(param->invitedContacts[i])); + } + room->conversation->AddConsumers(needToAdd); + } + delete param; + } + } + break; + case CHAT_LIST_MENU::ICM_AUTH_REQUEST: { CContact::Ref contact; @@ -1376,7 +1402,7 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) joinBlob = ::mir_utf8decodeW(data); ::db_set_ws(hContact, this->m_szModuleName, "JoinBlob", joinBlob); - ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); + ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); ChatRoom *room = new ChatRoom(cid, name, this); room->Start(conversation, true); } diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index 4ab12980c9..cc7583dda6 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -8,7 +8,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "AvatarTS", 0); - mir_ptr path( this->GetContactAvatarFilePath(hContact)); + ptrW path( this->GetContactAvatarFilePath(hContact)); bool isAvatarFileExists = CSkypeProto::FileExists(path); if (newTS > oldTS || !isAvatarFileExists) { @@ -53,7 +53,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact) { - mir_ptr aboutText(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_ABOUT)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_ABOUT))); + ptrW aboutText(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_ABOUT)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_ABOUT))); if ( !::wcslen(aboutText)) ::db_unset(hContact, this->m_szModuleName, "About"); else diff --git a/protocols/Skype/src/skype_runtime.cpp b/protocols/Skype/src/skype_runtime.cpp index a5c41d58c2..9b605d3488 100644 --- a/protocols/Skype/src/skype_runtime.cpp +++ b/protocols/Skype/src/skype_runtime.cpp @@ -18,29 +18,29 @@ char *CSkypeProto::LoadKeyPair() if (pLockedResource == NULL) return NULL; - aes_context ctx; - char *key = (char*)mir_base64_decode(MY_KEY, NULL); - - ::aes_set_key(&ctx, (unsigned char *)key, 128); - ::mir_free(key); - int length = ::SizeofResource(g_hInstance, hResource); if (length == 0) return NULL; - char *pData = (char *)alloca(length+1); - memcpy(pData, pLockedResource, length); - pData[length] = 0; + char* pData = new char[length + 1]; + ::memcpy(pData, pLockedResource, length); + pData[length] = 0; - unsigned char *bufD = (unsigned char *)::mir_alloc(length * 2); - unsigned char *tmpD = (unsigned char *)mir_base64_decode(pData, NULL); + unsigned char *tmpD = (unsigned char *)::mir_base64_decode(pData, NULL); + unsigned char *result = (unsigned char *)::mir_alloc(length*2); + delete [] pData; + + aes_context ctx; + char *key = (char*)::mir_base64_decode(MY_KEY, NULL); + ::aes_set_key(&ctx, (unsigned char *)key, 128); + ::mir_free(key); for (int i = 0; i < length; i += 16) - aes_decrypt(&ctx, tmpD + i, bufD + i); + aes_decrypt(&ctx, tmpD + i, result + i); ::mir_free(tmpD); - //bufD[length] = 0; //cert should be null terminated - return (char *)bufD; + result[length] = 0; + return (char *)result; } int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName) -- cgit v1.2.3