From c2cea793e21b20cf4a51f58e2e0352f77228db63 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 27 Apr 2015 19:24:06 +0000 Subject: SkypeWeb: Contacts blocking support part 2. git-svn-id: http://svn.miranda-ng.org/main/trunk@13204 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_contacts.cpp | 25 ++++++++++++++++++++++--- protocols/SkypeWeb/src/skype_proto.h | 3 +++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 9ac93acb10..c84357c850 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -222,11 +222,11 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) node = json_get(item, "blocked"); bool isBlocked = json_as_bool(node); - setByte(hContact, "IsBlocked", isBlocked); if (isBlocked) { db_set_dw(hContact, "Ignore", "Mask1", 127); db_set_b(hContact, "CList", "Hidden", 1); + setByte(hContact, "IsBlocked", 1); } skypenames.insert(mir_strdup(skypename)); @@ -278,12 +278,31 @@ int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM) INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) { if (IDYES == MessageBox(NULL, TranslateT("Are you sure?"), TranslateT("Warning"), MB_YESNOCANCEL | MB_ICONQUESTION)) - SendRequest(new BlockContactRequest(TokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)))); + SendRequest(new BlockContactRequest(TokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnBlockContact, (void *)hContact); return 0; } +void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p) +{ + MCONTACT hContact = (MCONTACT)p; + if (response == NULL) + return; + db_set_dw(hContact, "Ignore", "Mask1", 127); + db_set_b(hContact, "CList", "Hidden", 1); +} + INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM) { - SendRequest(new UnblockContactRequest(TokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)))); + SendRequest(new UnblockContactRequest(TokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnUnblockContact, (void *)hContact); return 0; +} + +void CSkypeProto::OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p) +{ + MCONTACT hContact = (MCONTACT)p; + if (response == NULL) + return; + db_set_dw(hContact, "Ignore", "Mask1", 0); + db_set_b(hContact, "CList", "Hidden", 0); + db_set_b(hContact, m_szModuleName, "IsBlocked", 0); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 63c2bf592b..53e8a2b876 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -190,6 +190,9 @@ private: int __cdecl OnContactDeleted(MCONTACT, LPARAM); + void OnBlockContact (const NETLIBHTTPREQUEST *response, void *p); + void OnUnblockContact (const NETLIBHTTPREQUEST *response, void *p); + // messages mir_cs messageSyncLock; -- cgit v1.2.3