summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-27 19:24:06 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-27 19:24:06 +0000
commitc2cea793e21b20cf4a51f58e2e0352f77228db63 (patch)
treeeab059f7b4002a79d15329579d894ec85e8c6b4e
parent87ecd5e5088390936cf3928578967eef82b0f185 (diff)
SkypeWeb: Contacts blocking support part 2.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13204 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp25
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h3
2 files changed, 25 insertions, 3 deletions
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;