comparison libpurple/util.c @ 27473:1d30e9d6de9b

Added the function in util.h, forgot it here.
author Paul Aurich <paul@darkrain42.org>
date Sat, 11 Jul 2009 08:11:14 +0000
parents 8c41a23e6b44
children b7ce89597a89
comparison
equal deleted inserted replaced
27472:f1f901b3d6f2 27473:1d30e9d6de9b
4444 if (*(c - 1) == '-') return FALSE; 4444 if (*(c - 1) == '-') return FALSE;
4445 4445
4446 return ((c - domain) > 3 ? TRUE : FALSE); 4446 return ((c - domain) > 3 ? TRUE : FALSE);
4447 } 4447 }
4448 4448
4449 /* TODO 3.0.0: Rename this to purple_ipv4_address_is_valid */
4450 gboolean 4449 gboolean
4451 purple_ip_address_is_valid(const char *ip) 4450 purple_ipv4_address_is_valid(const char *ip)
4452 { 4451 {
4453 int c, o1, o2, o3, o4; 4452 int c, o1, o2, o3, o4;
4454 char end; 4453 char end;
4455 4454
4456 g_return_val_if_fail(ip != NULL, FALSE); 4455 g_return_val_if_fail(ip != NULL, FALSE);
4502 /* 4501 /*
4503 * Either we saw a '::' and there were fewer than 8 chunks -or- 4502 * Either we saw a '::' and there were fewer than 8 chunks -or-
4504 * we didn't see a '::' and saw exactly 8 chunks. 4503 * we didn't see a '::' and saw exactly 8 chunks.
4505 */ 4504 */
4506 return (double_colon && chunks < 8) || (!double_colon && chunks == 8); 4505 return (double_colon && chunks < 8) || (!double_colon && chunks == 8);
4506 }
4507
4508 /* TODO 3.0.0: Add ipv6 check, too */
4509 gboolean
4510 purple_ip_address_is_valid(const char *ip)
4511 {
4512 return purple_ipv4_address_is_valid(ip);
4507 } 4513 }
4508 4514
4509 /* Stolen from gnome_uri_list_extract_uris */ 4515 /* Stolen from gnome_uri_list_extract_uris */
4510 GList * 4516 GList *
4511 purple_uri_list_extract_uris(const gchar *uri_list) 4517 purple_uri_list_extract_uris(const gchar *uri_list)