# Path: pyfire/util.py
# def is_valid_ipv4(address):
# def is_valid_ipv6(address):


import re
from pyfire import util
        return self.local == other.local and \
               self.domain == other.domain and \
               self.resource == other.resource

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        if self.local is not None and \
           self.resource is not None:
            return "%s@%s/%s" % (self.local, self.domain, self.resource)
        elif self.local is not None:
            return "%s@%s" % (self.local, self.domain)
        elif self.resource is not None:
            return "%s/%s" % (self.domain, self.resource)
        else:
            return self.domain

    def validate(self, raise_error=False):
        """Validate JID, either return a bool or raise :py:exc:`ValueErrors`"""

        if self.domain is None or len(self.domain) < 1:
            if raise_error:
                raise ValueError("A domain is required")
            else:
                return False

        if self.domain.find(".") >= 0 or self.domain.find(":") >= 0:
            if not ((len(self.domain) < 256 and \
                     RE_DOMAIN.match(self.domain) is not None) or \

# Path: pyfire/util.py
# def is_valid_ipv4(address):
# def is_valid_ipv6(address):


# Path: pyfire/jid.py
import re
from pyfire import util

        return self.local == other.local and \
               self.domain == other.domain and \
               self.resource == other.resource

    def __ne__(self, other):
        return not self.__eq__(other)

    def __str__(self):
        if self.local is not None and \
           self.resource is not None:
            return "%s@%s/%s" % (self.local, self.domain, self.resource)
        elif self.local is not None:
            return "%s@%s" % (self.local, self.domain)
        elif self.resource is not None:
            return "%s/%s" % (self.domain, self.resource)
        else:
            return self.domain

    def validate(self, raise_error=False):
        """Validate JID, either return a bool or raise :py:exc:`ValueErrors`"""

        if self.domain is None or len(self.domain) < 1:
            if raise_error:
                raise ValueError("A domain is required")
            else:
                return False

        if self.domain.find(".") >= 0 or self.domain.find(":") >= 0:
            if not ((len(self.domain) < 256 and \
                     RE_DOMAIN.match(self.domain) is not None) or \

                    util.is_valid_ipv4(self.domain) or \