# HG changeset patch # User Paul Aurich # Date 1247277434 0 # Node ID da3d0159333deb689739927f7a2cf5be7c4588f5 # Parent 167d7c3a4f7bc2dc42c7c29b966c2bde1478b5d6 XMPP domains can also be IPv4 or IPv6 addresses We don't have an IPv6 validation function and I didn't feel like writing one, so I left those checks commented out and added a note to jabber_nameprep_validate (which is increasingly misnamed). diff -r 167d7c3a4f7b -r da3d0159333d libpurple/protocols/jabber/jutil.c --- a/libpurple/protocols/jabber/jutil.c Sat Jul 11 00:49:25 2009 +0000 +++ b/libpurple/protocols/jabber/jutil.c Sat Jul 11 01:57:14 2009 +0000 @@ -65,9 +65,8 @@ return FALSE; /* - * This should be more similar to purple_email_is_valid(). Maybe - * that function should even be split up and we should call the part - * that validates the domain name. + * TODO: An IPv6 address of the form [2001:470:1f05:d58::2] is also + * a valid XMPP domain portion. */ c = str; while(c && *c) { diff -r 167d7c3a4f7b -r da3d0159333d libpurple/protocols/jabber/jutil.h --- a/libpurple/protocols/jabber/jutil.h Sat Jul 11 00:49:25 2009 +0000 +++ b/libpurple/protocols/jabber/jutil.h Sat Jul 11 01:57:14 2009 +0000 @@ -45,6 +45,7 @@ gboolean jabber_is_own_account(JabberStream *js, const char *jid); gboolean jabber_nodeprep_validate(const char *); +/* TODO: This needs to be named jabber_domain_validate and handle IPv6/IDNA. */ gboolean jabber_nameprep_validate(const char *); gboolean jabber_resourceprep_validate(const char *); diff -r 167d7c3a4f7b -r da3d0159333d libpurple/tests/test_jabber_jutil.c --- a/libpurple/tests/test_jabber_jutil.c Sat Jul 11 00:49:25 2009 +0000 +++ b/libpurple/tests/test_jabber_jutil.c Sat Jul 11 01:57:14 2009 +0000 @@ -99,6 +99,12 @@ assert_valid_jid("stuart@nödåtXäYZ.se/まりるーむ"); assert_valid_jid("mark.doliner@わいど.org"); assert_valid_jid("nick@まつ.おおかみ.net"); + assert_valid_jid("paul@10.0.42.230/s"); +#if 0 +/* Uncomment these when jabber_domain_validate supports IPv6 addresses */ + assert_valid_jid("paul@[::1]"); /* IPv6 */ + assert_valid_jid("paul@[2001:470:1f05:d58::2]"); +#endif assert_invalid_jid("@gmail.com"); assert_invalid_jid("@@gmail.com");