pidgin: 7b2b39f2: purple_ip_address_is_valid() now checks ...

andrew.victor at mxit.com andrew.victor at mxit.com
Sat Sep 24 18:25:48 EDT 2011


----------------------------------------------------------------------
Revision: 7b2b39f29c663a3b1ad776bae1361dcfe6c4db16
Parent:   85febe603f05a6d725951dba1418fb6ed6648136
Author:   andrew.victor at mxit.com
Date:     09/24/11 18:20:58
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7b2b39f29c663a3b1ad776bae1361dcfe6c4db16

Changelog: 

purple_ip_address_is_valid() now checks for an IPv4 or IPv6 address.


Changes against parent 85febe603f05a6d725951dba1418fb6ed6648136

  patched  libpurple/plugins/perl/common/Util.xs
  patched  libpurple/util.c
  patched  libpurple/util.h

-------------- next part --------------
============================================================
--- libpurple/util.c	b213f27f7020d97ad81f89b4e72950d30d826153
+++ libpurple/util.c	1de2c9c42fa904f18c6a404f954477ca22866ca5
@@ -4454,11 +4454,10 @@ purple_ipv6_address_is_valid(const gchar
 	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 */
============================================================
--- libpurple/util.h	ae5fdd155724a677c08280b296349a11faf273a6
+++ libpurple/util.h	a2bb858b20ba759805dd749a687b7aac5d626a73
@@ -1238,14 +1238,15 @@ gboolean purple_email_is_valid(const cha
 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);
 
============================================================
--- libpurple/plugins/perl/common/Util.xs	ac3d9ea652a79066c672e262d6f99d5949186a1a
+++ libpurple/plugins/perl/common/Util.xs	bf03a99dce8c30c0df2976d608d489717db9db0c
@@ -202,6 +202,14 @@ purple_ip_address_is_valid(ip)
 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


More information about the Commits mailing list