Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

relaxed jid validation in debug mode even more

  • Loading branch information...
commit 3c42445737cd69caf6db2e9084d381f90af5d759 1 parent 78affaf
tong authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 jabber/JIDUtil.hx
23 jabber/JIDUtil.hx
View
@@ -22,7 +22,7 @@
package jabber;
/**
- Static methods for JabberID validation/manipulation.
+ Static methods for jabber-id validation and manipulation.
*/
class JIDUtil {
@@ -33,27 +33,32 @@ class JIDUtil {
/**
Regular expression matching a valid JID
*/
- #if macro //TODO temp,macro bug
public static var EREG =
#if JABBER_DEBUG
- ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+(\.[A-Z][A-Z][A-Z]?)?)(\/([A-Z0-9._%-]+))?/;
+ ~/([A-Z0-9._%-]+)@([A-Z0-9\.-]+)/i;
#else
- ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z][A-Z][A-Z]?)(\/([A-Z0-9._%-]+))?/;
+ ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z][A-Z][A-Z]?)(\/([A-Z0-9._%-]+))?/i;
#end
- #else
+ /*
+ #if macro //TODO temp,macro bug
public static var EREG =
#if JABBER_DEBUG
- ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+(\.[A-Z][A-Z][A-Z]?)?)(\/([A-Z0-9._%-]+))?/i;
+ ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+(\.[A-Z][A-Z][A-Z]?)?)(\/([A-Z0-9._%-]+))?/;
#else
- ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z][A-Z][A-Z]?)(\/([A-Z0-9._%-]+))?/i;
+ ~/([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z][A-Z][A-Z]?)(\/([A-Z0-9._%-]+))?/;
#end
- #end
+ #else
+ //#end
+ */
/**
@returns True if the given JID is valid formed.
*/
public static function isValid( t : String ) : Bool {
- if( t == null || t.length < MIN_LENGTH || t.length > MAX_SIZE )
+ if( t == null
+ #if !JABBER_DEBUG
+ || t.length < MIN_LENGTH || t.length > MAX_SIZE
+ #end )
return false;
if( !EREG.match( t ) )
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.