diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-02-10 23:49:28 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-02-10 23:49:28 +0000 |
commit | b5fe39bf8c462cfd19428cc0c099490cef3fcfd3 (patch) | |
tree | baa1eebb5d5aa3a6e6a3bf0d893791ec1e4f6a66 /protocols/twitter/twitter_lib.c | |
parent | fc0640ec4530975b95f3fb14aff1fce86ffff121 (diff) |
Applied patch from #895, making show_old_mentions an integer setting instead
of boolean so you can change the number of mentions being fetched.
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r-- | protocols/twitter/twitter_lib.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index bd957333..38964e66 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -751,7 +751,7 @@ void twitter_flush_timeline(struct im_connection *ic) { struct twitter_data *td = ic->proto_data; gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); - gboolean show_old_mentions = set_getbool(&ic->acc->set, "show_old_mentions"); + int show_old_mentions = set_getint(&ic->acc->set, "show_old_mentions"); struct twitter_xml_list *home_timeline = td->home_timeline_obj; struct twitter_xml_list *mentions = td->mentions_obj; GSList *output = NULL; @@ -773,7 +773,7 @@ void twitter_flush_timeline(struct im_connection *ic) if (include_mentions && mentions && mentions->list) { for (l = mentions->list; l; l = g_slist_next(l)) { - if (!show_old_mentions && output && twitter_compare_elements(l->data, output->data) < 0) { + if (show_old_mentions < 1 && output && twitter_compare_elements(l->data, output->data) < 0) { continue; } @@ -851,10 +851,13 @@ void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) if (td->timeline_id) { args[4] = "since_id"; args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); + } else { + args[4] = "count"; + args[5] = g_strdup_printf("%d", set_getint(&ic->acc->set, "show_old_mentions")); } - if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, - td->timeline_id ? 6 : 4) == NULL) { + if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, + ic, 0, args, 6) == NULL) { if (++td->http_fails >= 5) imcb_error(ic, "Could not retrieve %s: %s", TWITTER_MENTIONS_URL, "connection failed"); |