Changeset 89db90e for protocols/twitter/twitter.c
- Timestamp:
- 2015-03-12T09:10:16Z (10 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r0e4c3dd r89db90e 852 852 } 853 853 854 /* Parses a decimal or hex tweet ID, returns TRUE on success */ 855 static 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 854 869 /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID 855 870 * into a twitter tweet ID. … … 879 894 arg++; 880 895 } 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) { 883 897 bu = td->log[id].bu; 884 898 id = td->log[id].id; … … 887 901 bu = NULL; 888 902 } 889 } else if ( sscanf(arg, "%" G_GINT64_MODIFIER "d", &id) == 1) {903 } else if (twitter_parse_id(arg, 10, &id)) { 890 904 /* Allow normal tweet IDs as well; not a very useful 891 905 feature but it's always been there. Just ignore
Note: See TracChangeset
for help on using the changeset viewer.