diff options
author | dequis <dx@dxzone.com.ar> | 2015-05-30 23:31:24 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-05-30 23:31:24 -0300 |
commit | 73f0a012a1f6b3e5fa3c7905e4f216b5ac29a30c (patch) | |
tree | 432ebfd4e2f953de24be099fc6e796b788242267 /protocols/twitter/twitter.c | |
parent | 6e21525c241d5f70767463577392aac481d3b051 (diff) |
Move twitter_parse_id() to parse_int64() in misc.c
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r-- | protocols/twitter/twitter.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 4debc08a..7f5e0368 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -858,23 +858,6 @@ static void twitter_buddy_data_free(struct bee_user *bu) g_free(bu->data); } -/* Parses a decimal or hex tweet ID, returns TRUE on success */ -static gboolean twitter_parse_id(char *string, int base, guint64 *id) -{ - guint64 parsed; - char *endptr; - - errno = 0; - parsed = g_ascii_strtoull(string, &endptr, base); - if (errno || endptr == string || *endptr != '\0') { - return FALSE; - } - *id = parsed; - return TRUE; -} - -bee_user_t twitter_log_local_user; - /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID * into a twitter tweet ID. * @@ -902,10 +885,10 @@ static guint64 twitter_message_id_from_command_arg(struct im_connection *ic, cha if (arg[0] == '#') { arg++; } - if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { + if (parse_int64(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { bu = td->log[id].bu; id = td->log[id].id; - } else if (twitter_parse_id(arg, 10, &id)) { + } else if (parse_int64(arg, 10, &id)) { /* Allow normal tweet IDs as well; not a very useful feature but it's always been there. Just ignore very low IDs to avoid accidents. */ |