Changes in protocols/twitter/twitter.c [61e7e02:33528bd]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r61e7e02 r33528bd 469 469 g_regex_match(regex, msg, 0, &match_info); 470 470 while (g_match_info_matches(match_info)) { 471 gchar *s, *url; 472 473 url = g_match_info_fetch(match_info, 2); 471 gchar *url = g_match_info_fetch(match_info, 2); 474 472 url_len_diff += target_len - g_utf8_strlen(url, -1); 475 476 473 /* Add another character for https://t.co/... URLs */ 477 if ( (s = g_match_info_fetch(match_info, 3))) {474 if (g_match_info_fetch(match_info, 3) != NULL) { 478 475 url_len_diff += 1; 479 g_free(s);480 476 } 481 477 g_free(url); … … 863 859 } 864 860 861 /* Parses a decimal or hex tweet ID, returns TRUE on success */ 862 static gboolean twitter_parse_id(char *string, int base, guint64 *id) 863 { 864 guint64 parsed; 865 char *endptr; 866 867 errno = 0; 868 parsed = g_ascii_strtoull(string, &endptr, base); 869 if (errno || endptr == string || *endptr != '\0') { 870 return FALSE; 871 } 872 *id = parsed; 873 return TRUE; 874 } 875 865 876 bee_user_t twitter_log_local_user; 866 877 … … 892 903 arg++; 893 904 } 894 if ( parse_int64(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {905 if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { 895 906 bu = td->log[id].bu; 896 907 id = td->log[id].id; 897 } else if ( parse_int64(arg, 10, &id)) {908 } else if (twitter_parse_id(arg, 10, &id)) { 898 909 /* Allow normal tweet IDs as well; not a very useful 899 910 feature but it's always been there. Just ignore
Note: See TracChangeset
for help on using the changeset viewer.