aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r--protocols/twitter/twitter.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 9017d3b3..b8e31035 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -552,6 +552,15 @@ static char *set_eval_mode(set_t * set, char *value)
}
}
+static char *set_eval_long_ids(set_t * set, char *value)
+{
+ int len = atoi(value);
+ if (len >= 1 || len <= 4)
+ return value;
+
+ return SET_INVALID;
+}
+
static void twitter_init(account_t * acc)
{
set_t *s;
@@ -596,7 +605,7 @@ static void twitter_init(account_t * acc)
s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc);
- s = set_add(&acc->set, "long_ids", "false", set_eval_bool, acc);
+ s = set_add(&acc->set, "long_ids", "2", set_eval_long_ids, acc);
s->flags |= ACC_SET_OFFLINE_ONLY;
s = set_add(&acc->set, "channel_name", NULL, set_eval_channel_name, acc);
@@ -622,6 +631,7 @@ static void twitter_login(account_t * acc)
char name[strlen(acc->user) + 9];
url_t url;
char *s;
+ size_t i;
if (!url_set(&url, set_getstr(&ic->acc->set, "base_url")) ||
(url.proto != PROTO_HTTP && url.proto != PROTO_HTTPS)) {
@@ -679,8 +689,12 @@ static void twitter_login(account_t * acc)
imcb_add_buddy(ic, name, NULL);
imcb_buddy_status(ic, name, OPT_LOGGED_IN, NULL, NULL);
- td->long_ids = set_getbool(&ic->acc->set, "long_ids");
- td->log_length = (td->long_ids) ? TWITTER_LONG_LOG_LENGTH : TWITTER_SHORT_LOG_LENGTH;
+ td->id_length = set_getint(&ic->acc->set, "long_ids");
+ td->log_length = 0;
+ for (i = 0; i < td->id_length; i++) {
+ td->log_length = (td->log_length << 4) + 0x0F;
+ }
+ td->log_length += 1;
td->log = g_new0(struct twitter_log_data, td->log_length);
td->filter_log = g_new0(struct twitter_log_data, td->log_length);