diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-02 12:19:12 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-02 12:19:12 +0000 |
commit | cb9f90e85032559d2da6e3b40a05352365e6d90f (patch) | |
tree | 6c0ddd2ae33a3a9e92324d406cf696e2b4202bc0 /protocols/SkypeWeb/src/requests | |
parent | 28284465a2ff445c029849b73fb589429698b525 (diff) |
SkypeWeb: Manual json formatting removed. Fix avatar cache for "facebook" contacts. Other fixes.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13971 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r-- | protocols/SkypeWeb/src/requests/chatrooms.h | 25 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/search.h | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/status.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/subscriptions.h | 18 |
5 files changed, 41 insertions, 18 deletions
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 905f6afd47..b78053f7f1 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -93,13 +93,21 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data = "{\"members\":[";
+ JSONNode node(JSON_NODE);
+ JSONNode members(JSON_ARRAY);
+
+ members.set_name("members");
+
for (int i = 0; i < skypenames.getCount(); i++)
- data.AppendFormat("{\"id\":\"8:%s\",\"role\":\"%s\"},", skypenames[i], !mir_strcmpi(skypenames[i], selfname) ? "Admin" : "User");
- data.Truncate(data.GetLength() - 1);
- data.Append("]}");
+ {
+ JSONNode member(JSON_NODE);
+ member.push_back(JSONNode("id", CMStringA(::FORMAT, "8:%s", skypenames[i]).GetBuffer()));
+ member.push_back(JSONNode("role", !mir_strcmpi(skypenames[i], selfname) ? "Admin" : "User"));
+ members.push_back(member);
+ }
+ node.push_back(members);
- Body << VALUE(data);
+ Body << VALUE(node.write().c_str());
}
};
@@ -129,8 +137,11 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data(::FORMAT, "{\"role\":\"%s\"}", role);
- Body << VALUE(data);
+ JSONNode node(JSON_NODE);
+
+ node.push_back(JSONNode("role", role));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index b55d759a22..198930fd65 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -99,8 +99,11 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
//"lastReadMessageTimestamp;modificationTime;lastReadMessageId"
- CMStringA data(::FORMAT, "{\"consumptionhorizon\":\"%lld000;%lld000;%lld000\"}", msgTimestamp, time(NULL), msgTimestamp);
- Body << VALUE(data);
+
+ JSONNode node(JSON_NODE);
+ node.push_back(JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp).GetBuffer()));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h index 2b78cdac35..6a6f87d9e4 100644 --- a/protocols/SkypeWeb/src/requests/search.h +++ b/protocols/SkypeWeb/src/requests/search.h @@ -25,8 +25,7 @@ public: HttpRequest(REQUEST_GET, "api.skype.com/search/users/any")
{
Url
- << CHAR_VALUE("keyWord", string)
- << CHAR_VALUE("contactTypes[]", "skype");
+ << CHAR_VALUE("keyWord", string);
Headers
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Connection", "keep-alive")
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index a980e431d1..aac7742ef0 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -29,8 +29,10 @@ public: << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
- CMStringA data(::FORMAT, "{\"status\":\"%s\"}", status);
- Body << VALUE(data);
+ JSONNode node(JSON_NODE);
+ node.push_back(JSONNode("status", status));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index 7c46df3f35..b29eddc639 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -56,13 +56,21 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data = "{\"contacts\":[";
+
+ JSONNode node(JSON_NODE);
+ JSONNode contacts(JSON_ARRAY);
+
+ contacts.set_name("contacts");
+
for (int i = 0; i < skypenames.getCount(); i++)
- data.AppendFormat("{\"id\":\"8:%s\"},", skypenames[i]);
- data.Truncate(data.GetLength() - 1);
- data.Append("]}");
+ {
+ JSONNode contact(JSON_NODE);
+ contact.push_back(JSONNode("id", CMStringA(::FORMAT, "8:%s", skypenames[i]).GetBuffer()));
+ contacts.push_back(contact);
+ }
+ node.push_back(contacts);
- Body << VALUE(data);
+ Body << VALUE(node.write().c_str());
}
};
|