diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-29 18:22:03 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-29 18:22:03 +0000 |
commit | 7632fc0137f2eda2cddb02c07a7ad3f987a38e58 (patch) | |
tree | 681c70f7eaa0749c2b391b53bb3b77926e9b0741 /protocols/Twitter | |
parent | 343e3cb94c2985078f3e2e0510a024ecfa58b87f (diff) |
fix for 64 bit integers
git-svn-id: http://svn.miranda-ng.org/main/trunk@13250 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Twitter')
-rw-r--r-- | protocols/Twitter/src/twitter.cpp | 8 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 5 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.h | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/protocols/Twitter/src/twitter.cpp b/protocols/Twitter/src/twitter.cpp index 06ac5f8792..4a321675e0 100644 --- a/protocols/Twitter/src/twitter.cpp +++ b/protocols/Twitter/src/twitter.cpp @@ -92,7 +92,7 @@ std::vector<twitter_user> twitter::get_friends() JSONNODE *pStatus = json_get(pNode, "status");
if (pStatus != NULL) {
user.status.text = json_as_pstring(json_get(pStatus, "text"));
- user.status.id = json_as_int(json_get(pStatus, "id"));
+ user.status.id = str2int(json_as_pstring(json_get(pStatus, "id")));
std::string timestr = json_as_pstring(json_get(pStatus, "created_at"));
user.status.time = parse_time(timestr);
@@ -172,7 +172,7 @@ twitter_user twitter::add_friend(const std::string &name) JSONNODE *pStatus = json_get(root, "status");
if (pStatus != NULL) {
ret.status.text = json_as_pstring(json_get(pStatus, "text"));
- ret.status.id = json_as_int(json_get(pStatus, "id"));
+ ret.status.id = str2int(json_as_pstring(json_get(pStatus, "id")));
}
return ret;
@@ -263,7 +263,7 @@ std::vector<twitter_user> twitter::get_statuses(int count, twitter_id id) u.status.text = rawText;
}
- u.status.id = json_as_int(json_get(pNode, "id"));
+ u.status.id = str2int(json_as_pstring(json_get(pNode, "id")));
std::string timestr = json_as_pstring(json_get(pNode, "created_at"));
u.status.time = parse_time(timestr);
@@ -300,7 +300,7 @@ std::vector<twitter_user> twitter::get_direct(twitter_id id) u.username = json_as_pstring(json_get(pNode, "sender_screen_name"));
u.status.text = json_as_pstring(json_get(pNode, "text"));
- u.status.id = json_as_int(json_get(pNode, "id"));
+ u.status.id = str2int(json_as_pstring(json_get(pNode, "id")));
std::string timestr = json_as_pstring(json_get(pNode, "created_at"));
u.status.time = parse_time(timestr);
messages.push_back(u);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index dcdda75a9e..4956a6404c 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -40,6 +40,11 @@ std::string int2str(uint64_t iVal) return std::string(buf);
}
+uint64_t str2int(const std::string &str)
+{
+ return atoll(str.c_str());
+}
+
http::response mir_twitter::slurp(const std::string &url, http::method meth, OAuthParameters postParams)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index 3736ca2928..22c9aa33f6 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -25,6 +25,7 @@ std::string b64encode(const std::string &s); std::string int2str(int32_t);
std::string int2str(uint64_t);
+uint64_t str2int(const std::string &str);
class mir_twitter : public twitter
{
|