Ignore:
Timestamp:
2015-03-12T09:10:16Z (10 years ago)
Author:
dequis <dx@…>
Children:
fc650a8
Parents:
0e4c3dd (diff), 3bb333c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop' into feat/hip-cat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r0e4c3dd r89db90e  
    852852}
    853853
     854/* Parses a decimal or hex tweet ID, returns TRUE on success */
     855static gboolean twitter_parse_id(char *string, int base, guint64 *id)
     856{
     857        guint64 parsed;
     858        char *endptr;
     859
     860        errno = 0;
     861        parsed = g_ascii_strtoull(string, &endptr, base);
     862        if (errno || endptr == string || *endptr != '\0') {
     863                return FALSE;
     864        }
     865        *id = parsed;
     866        return TRUE;
     867}
     868
    854869/** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID
    855870 *  into a twitter tweet ID.
     
    879894                        arg++;
    880895                }
    881                 if (sscanf(arg, "%" G_GINT64_MODIFIER "x", &id) == 1 &&
    882                     id < TWITTER_LOG_LENGTH) {
     896                if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {
    883897                        bu = td->log[id].bu;
    884898                        id = td->log[id].id;
     
    887901                                bu = NULL;
    888902                        }
    889                 } else if (sscanf(arg, "%" G_GINT64_MODIFIER "d", &id) == 1) {
     903                } else if (twitter_parse_id(arg, 10, &id)) {
    890904                        /* Allow normal tweet IDs as well; not a very useful
    891905                           feature but it's always been there. Just ignore
Note: See TracChangeset for help on using the changeset viewer.