diff options
-rw-r--r-- | doc/user-guide/commands.xml | 10 | ||||
-rw-r--r-- | protocols/twitter/twitter.c | 2 | ||||
-rw-r--r-- | protocols/twitter/twitter_lib.c | 11 |
3 files changed, 18 insertions, 5 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 95a127cf..bcc8f09e 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1454,6 +1454,16 @@ </description> </bitlbee-setting> + <bitlbee-setting name="show_old_mentions" type="integer" scope="account"> + <default>20</default> + + <description> + <para> + This setting specifies the number of old mentions to fetch on connection. Must be less or equal to 200. Setting it to 0 disables this feature. + </para> + </description> + </bitlbee-setting> + <bitlbee-setting name="switchboard_keepalives" type="boolean" scope="account"> <default>false</default> diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index c389677f..1e404a02 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -278,7 +278,7 @@ static void twitter_init(account_t * acc) s = set_add(&acc->set, "show_ids", "false", set_eval_bool, acc); s->flags |= ACC_SET_OFFLINE_ONLY; - s = set_add(&acc->set, "show_old_mentions", "true", set_eval_bool, acc); + s = set_add(&acc->set, "show_old_mentions", "20", set_eval_int, acc); s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc); } 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"); |