Changeset 7549d00


Ignore:
Timestamp:
2015-01-16T19:50:24Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
25c4c78
Parents:
885d294
git-author:
roger <roger@…> (16-01-15 19:50:24)
git-committer:
dequis <dx@…> (16-01-15 19:50:24)
Message:

twitter: start stream from last tweet on connect/reconnect

This works by setting the last_tweet hidden account setting to the ID of
the last shown tweet.

Location:
protocols/twitter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r885d294 r7549d00  
    5151        struct twitter_data *td = ic->proto_data;
    5252
     53        char *last_tweet = set_getstr(&ic->acc->set, "last_tweet");
     54        if (last_tweet)
     55                td->timeline_id = g_ascii_strtoull(last_tweet, NULL, 0);
     56
    5357        /* Create the room now that we "logged in". */
    5458        if (td->flags & TWITTER_MODE_CHAT)
     
    327331        s = set_add(&acc->set, "strip_newlines", "false", set_eval_bool, acc);
    328332       
     333        s = set_add(&acc->set, "last_tweet", "0", NULL, acc);
     334        s->flags |= SET_HIDDEN;
     335
    329336        if (strcmp(acc->prpl->name, "twitter") == 0) {
    330337                s = set_add(&acc->set, "stream", "true", set_eval_bool, acc);
  • protocols/twitter/twitter_lib.c

    r885d294 r7549d00  
    721721{
    722722        struct twitter_data *td = ic->proto_data;
     723        char *last_id_str;
    723724       
    724725        if (status->user == NULL || status->text == NULL)
     
    738739        // we won't pick up the updates already in the list.
    739740        td->timeline_id = MAX(td->timeline_id, status->rt_id);
     741
     742        last_id_str = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id);
     743        set_setstr(&ic->acc->set, "last_tweet", last_id_str);
     744        g_free(last_id_str);
    740745}
    741746
     
    10021007        if (td->timeline_id) {
    10031008                args[4] = "since_id";
    1004                 args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id);
     1009                args[5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id);
    10051010        }
    10061011
Note: See TracChangeset for help on using the changeset viewer.