diff options
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r-- | protocols/twitter/twitter_lib.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index d6f12bc2..ae4a7079 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -366,6 +366,7 @@ static void twitter_http_get_friends_ids(struct http_request *req) txl_free(txl); } +<<<<<<< dab92571b0959a1f1c4805dd6d874421b262aa8c /** * Callback for getting the mutes ids. */ @@ -452,6 +453,95 @@ static void twitter_http_get_noretweets_ids(struct http_request *req) txl_free(txl); } +||||||| merged common ancestors +======= +/** + * Callback for getting the mutes ids. + */ +static void twitter_http_get_mutes_ids(struct http_request *req) +{ + struct im_connection *ic = req->data; + json_value *parsed; + struct twitter_xml_list *txl; + struct twitter_data *td; + + // Check if the connection is stil active + if (!g_slist_find(twitter_connections, ic)) { + return; + } + + td = ic->proto_data; + + // Parse the data. + if (!(parsed = twitter_parse_response(ic, req))) { + return; + } + + txl = g_new0(struct twitter_xml_list, 1); + txl->list = td->mutes_ids; + + /* mute ids API response is similar enough to friends response + to reuse this method */ + twitter_xt_get_friends_id_list(parsed, txl); + json_value_free(parsed); + + td->mutes_ids = txl->list; + if (txl->next_cursor) { + /* Recurse while there are still more pages */ + twitter_get_mutes_ids(ic, txl->next_cursor); + } + + txl->list = NULL; + txl_free(txl); +} + +/** + * Callback for getting the no-retweets ids. + */ +static void twitter_http_get_noretweets_ids(struct http_request *req) +{ + struct im_connection *ic = req->data; + json_value *parsed; + struct twitter_xml_list *txl; + struct twitter_data *td; + + // Check if the connection is stil active + if (!g_slist_find(twitter_connections, ic)) { + return; + } + + td = ic->proto_data; + + // Parse the data. + if (!(parsed = twitter_parse_response(ic, req))) { + return; + } + + txl = g_new0(struct twitter_xml_list, 1); + txl->list = td->noretweets_ids; + + // TODO - process the retweet ids: json result is [1,2,3,...] + txl->type = TXL_ID; + if (parsed->type == json_array) { + unsigned int i; + for (i = 0; i < parsed->u.array.length; i++) { + json_value *c = parsed->u.array.values[i]; + if (c->type != json_integer) { + continue; + } + txl->list = g_slist_prepend(txl->list, + g_strdup_printf("%"PRIu64, c->u.integer)); + } + } + + json_value_free(parsed); + td->noretweets_ids = txl->list; + + txl->list = NULL; + txl_free(txl); +} + +>>>>>>> Honour twitter's mutes and "hide retweets from this user" settings. static gboolean twitter_xt_get_users(json_value *node, struct twitter_xml_list *txl); static void twitter_http_get_users_lookup(struct http_request *req); |