aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-02-10 23:49:28 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2012-02-10 23:49:28 +0000
commitb5fe39bf8c462cfd19428cc0c099490cef3fcfd3 (patch)
treebaa1eebb5d5aa3a6e6a3bf0d893791ec1e4f6a66
parentfc0640ec4530975b95f3fb14aff1fce86ffff121 (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.
-rw-r--r--doc/user-guide/commands.xml10
-rw-r--r--protocols/twitter/twitter.c2
-rw-r--r--protocols/twitter/twitter_lib.c11
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");