From 0a5bd1c2f123bc03b5014e6332689a5fcd3c9a1a Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 25 Oct 2012 18:11:20 +0000 Subject: - fixed some issues with contact adding and authorization git-svn-id: http://svn.miranda-ng.org/main/trunk@2075 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_contacts.cpp | 21 +++++++++++++++++++-- protocols/Skype/src/skype_menus.cpp | 8 +++++--- protocols/Skype/src/skype_proto.cpp | 7 ++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 60d062f9cd..23a47699f3 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -787,9 +787,26 @@ HANDLE CSkypeProto::AddContactBySid(const wchar_t* sid, const wchar_t* nick, DWO ::CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName); this->SetSettingString(hContact, "sid", sid); - this->SetSettingString(hContact, "Nick", nick); - //::DBWriteContactSettingWString(hContact, "CList", "MyHandle", displayName); + this->SetSettingByte(hContact, "Auth", 1); + + CContact::Ref contact; + if (g_skype->GetContact(::mir_u2a(sid), contact)) + { + contact.fetch(); + bool result; + if (contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_KNOWN_CONTACTS, result) && result) + { + CContactGroup::Ref group; + if (g_skype->GetHardwiredContactGroup(CContactGroup::ALL_KNOWN_CONTACTS, group)) + { + group.fetch(); + group->AddContact(contact); + } + } + } + + this->UpdateContactProfile(hContact, contact); if (flags & PALF_TEMPORARY) { diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index 3ef76141ca..0b47f6882d 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -35,8 +35,8 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; - bool authNeed = this->GetSettingByte(hContact, "Auth"); - bool grantNeed = this->GetSettingByte(hContact, "Grant"); + bool authNeed = this->GetSettingByte(hContact, "Auth") > 0; + bool grantNeed = this->GetSettingByte(hContact, "Grant") > 0; sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed); sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed); @@ -80,7 +80,10 @@ int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) if (g_skype->GetContact(sid, contact)) { if (contact->SetBuddyStatus(true)) + { + this->DeleteSetting(hContact, "Auth"); this->DeleteSetting(hContact, "Grant"); + } } return 0; @@ -95,7 +98,6 @@ int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam) { if (contact->SetBuddyStatus(false)) { - //this->DeleteSetting(hContact, "Auth"); this->SetSettingByte(hContact, "Grant", 1); } this->contactList.remove_val(contact); diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 9f1c6c8e27..87a1e758cf 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -38,10 +38,7 @@ CSkypeProto::~CSkypeProto() HANDLE __cdecl CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - //if (psr->cbSize != sizeof(PROTOSEARCHRESULT)) - return 0; - - return this->AddContactBySid(psr->id, psr->nick, flags); + return this->AddContactBySid(psr->id, psr->nick, 0); } HANDLE __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) @@ -370,7 +367,7 @@ void __cdecl CSkypeProto::SignInAsync(void*) fetch(g_skype->inbox); g_skype->SetOnConversationAddedCallback( (CSkype::OnConversationAdded)&CSkypeProto::OnConversationAdded, this); - for (int i = 0 ; i < g_skype->inbox.size(); i++) + for (uint i = 0 ; i < g_skype->inbox.size(); i++) { g_skype->inbox[i]->SetOnMessageReceivedCallback( (CConversation::OnMessageReceived)&CSkypeProto::OnOnMessageReceived, this); -- cgit v1.2.3