Ejemplo n.º 1
0
static void twitter_get_users_lookup(struct im_connection *ic)
{
    struct twitter_data *td = ic->proto_data;
    char *args[2] = {
        "user_id",
        NULL,
    };
    GString *ids = g_string_new("");
    int i;

    /* We can request up to 100 users at a time. */
    for (i = 0; i < 100 && td->follow_ids; i ++) {
        g_string_append_printf(ids, ",%s", (char*) td->follow_ids->data);
        g_free(td->follow_ids->data);
        td->follow_ids = g_slist_remove(td->follow_ids, td->follow_ids->data);
    }
    if (ids->len > 0) {
        args[1] = ids->str + 1;
        /* POST, because I think ids can be up to 1KB long. */
        twitter_http(ic, TWITTER_USERS_LOOKUP_URL, twitter_http_get_users_lookup, ic, 1, args, 2);
    } else {
        /* We have all users. Continue with login. (Get statuses.) */
        td->flags |= TWITTER_HAVE_FRIENDS;
        twitter_login_finish(ic);
    }
    g_string_free(ids, TRUE);
}
Ejemplo n.º 2
0
/**
 * Get the friends ids.
 */
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("%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]);
}
Ejemplo n.º 3
0
struct http_request *twitter_http_f(struct im_connection *ic, char *url_string, http_input_function func,
                                    gpointer data, int is_post, char **arguments, int arguments_len,
                                    twitter_http_flags_t flags)
{
	struct http_request *ret = twitter_http(ic, url_string, func, data, is_post, arguments, arguments_len);

	if (ret) {
		ret->flags |= flags;
	}
	return ret;
}