aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r--protocols/twitter/twitter_lib.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index 6ceeae29..92c6415f 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -41,7 +41,7 @@
struct twitter_xml_list {
int type;
- int next_cursor;
+ gint64 next_cursor;
GSList *list;
gpointer data;
};
@@ -154,12 +154,12 @@ static void twitter_http_get_friends_ids(struct http_request *req);
/**
* Get the friends ids.
*/
-void twitter_get_friends_ids(struct im_connection *ic, int next_cursor)
+void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor)
{
// Primitive, but hey! It works...
char* args[2];
args[0] = "cursor";
- args[1] = g_strdup_printf ("%d", next_cursor);
+ args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
twitter_http(ic, TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, args, 2);
g_free(args[1]);
@@ -170,8 +170,12 @@ void twitter_get_friends_ids(struct im_connection *ic, int next_cursor)
*/
static xt_status twitter_xt_next_cursor( struct xt_node *node, struct twitter_xml_list *txl )
{
- // Do something with the cursor.
- txl->next_cursor = node->text != NULL ? atoi(node->text) : -1;
+ char *end = NULL;
+
+ if( node->text )
+ txl->next_cursor = g_ascii_strtoll( node->text, &end, 10 );
+ if( end == NULL )
+ txl->next_cursor = -1;
return XT_HANDLED;
}
@@ -414,13 +418,13 @@ static void twitter_http_get_home_timeline(struct http_request *req);
/**
* Get the timeline.
*/
-void twitter_get_home_timeline(struct im_connection *ic, int next_cursor)
+void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor)
{
struct twitter_data *td = ic->proto_data;
char* args[4];
args[0] = "cursor";
- args[1] = g_strdup_printf ("%d", next_cursor);
+ args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
if (td->home_timeline_id) {
args[2] = "since_id";
args[3] = g_strdup_printf ("%llu", (long long unsigned int) td->home_timeline_id);
@@ -666,11 +670,11 @@ static void twitter_http_get_statuses_friends(struct http_request *req)
/**
* Get the friends.
*/
-void twitter_get_statuses_friends(struct im_connection *ic, int next_cursor)
+void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor)
{
char* args[2];
args[0] = "cursor";
- args[1] = g_strdup_printf ("%d", next_cursor);
+ args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
twitter_http(ic, TWITTER_SHOW_FRIENDS_URL, twitter_http_get_statuses_friends, ic, 0, args, 2);