Mercurial > pidgin
changeset 32219:4c64383f05cc
purple_ip_address_is_valid() now checks for an IPv4 or IPv6 address.
author | andrew.victor@mxit.com |
---|---|
date | Sat, 24 Sep 2011 22:20:58 +0000 |
parents | 904686722499 |
children | 9d5b87e1a4d0 |
files | libpurple/plugins/perl/common/Util.xs libpurple/util.c libpurple/util.h |
diffstat | 3 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Util.xs Sat Sep 24 22:09:40 2011 +0000 +++ b/libpurple/plugins/perl/common/Util.xs Sat Sep 24 22:20:58 2011 +0000 @@ -202,6 +202,14 @@ purple_ip_address_is_valid(ip) const char* ip +gboolean +purple_ipv4_address_is_valid(ip) + const char* ip + +gboolean +purple_ipv6_address_is_valid(ip) + const char* ip + const char* purple_normalize_nocase(account, str) Purple::Account account
--- a/libpurple/util.c Sat Sep 24 22:09:40 2011 +0000 +++ b/libpurple/util.c Sat Sep 24 22:20:58 2011 +0000 @@ -4454,11 +4454,10 @@ return (double_colon && chunks < 8) || (!double_colon && chunks == 8); } -/* TODO 3.0.0: Add ipv6 check, too */ gboolean purple_ip_address_is_valid(const char *ip) { - return purple_ipv4_address_is_valid(ip); + return (purple_ipv4_address_is_valid(ip) || purple_ipv6_address_is_valid(ip)); } /* Stolen from gnome_uri_list_extract_uris */
--- a/libpurple/util.h Sat Sep 24 22:09:40 2011 +0000 +++ b/libpurple/util.h Sat Sep 24 22:20:58 2011 +0000 @@ -1238,14 +1238,15 @@ gboolean purple_email_is_valid(const char *address); /** - * Checks if the given IP address is a syntactically valid IPv4 address. + * Checks if the given IP address is a syntactically valid IPv4 or + * IPv6 address. + * If you specifically want to check for an IPv4 address use + * purple_ipv4_address_is_valid(), or for an IPv6 address use + * purple_ipv6_address_is_valid(). * * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @deprecated This function will be replaced with one that validates - * as either IPv4 or IPv6 in 3.0.0. If you don't want this, - * behavior, use one of the more specific functions. */ gboolean purple_ip_address_is_valid(const char *ip);