diff options
author | Marius Halden <marius.h@lden.org> | 2015-11-08 16:46:16 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-05-07 14:26:16 +0200 |
commit | f0ff36f558329d096526004d4d912973bafd3904 (patch) | |
tree | 688a2b634a688c2b698774e72868b58882d724c1 /protocols/twitter/twitter_lib.c | |
parent | e5f97d0aa477be05c2d9b1a6514d51e52ac394dc (diff) |
Add support for long tweet ids
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r-- | protocols/twitter/twitter_lib.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 77f487ae..d6f12bc2 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -790,7 +790,7 @@ static char *twitter_msg_add_id(struct im_connection *ic, if (txs->reply_to) { int i; - for (i = 0; i < TWITTER_LOG_LENGTH; i++) { + for (i = 0; i < td->log_length; i++) { if (td->log[i].id == txs->reply_to) { reply_to = i; break; @@ -808,7 +808,7 @@ static char *twitter_msg_add_id(struct im_connection *ic, } } - td->log_id = (td->log_id + 1) % TWITTER_LOG_LENGTH; + td->log_id = (td->log_id + 1) % td->log_length; td->log[td->log_id].id = txs->id; td->log[td->log_id].bu = bee_user_by_handle(ic->bee, ic, txs->user->screen_name); @@ -823,11 +823,21 @@ static char *twitter_msg_add_id(struct im_connection *ic, if (set_getbool(&ic->acc->set, "show_ids")) { if (reply_to != -1) { - return g_strdup_printf("\002[\002%02x->%02x\002]\002 %s%s", + if (td->long_ids) { + return g_strdup_printf("\002[\002%04x->%04x\002]\002 %s%s", + td->log_id, reply_to, prefix, txs->text); + } else { + return g_strdup_printf("\002[\002%02x->%02x\002]\002 %s%s", td->log_id, reply_to, prefix, txs->text); + } } else { - return g_strdup_printf("\002[\002%02x\002]\002 %s%s", + if (td->long_ids) { + return g_strdup_printf("\002[\002%04x\002]\002 %s%s", + td->log_id, prefix, txs->text); + } else { + return g_strdup_printf("\002[\002%02x\002]\002 %s%s", td->log_id, prefix, txs->text); + } } } else { if (*prefix) { @@ -1092,7 +1102,7 @@ static gboolean twitter_stream_handle_status(struct im_connection *ic, struct tw struct twitter_data *td = ic->proto_data; int i; - for (i = 0; i < TWITTER_LOG_LENGTH; i++) { + for (i = 0; i < td->log_length; i++) { if (td->log[i].id == txs->id) { /* Got a duplicate (RT, probably). Drop it. */ return TRUE; |