diff --git a/frontends/src/tools/jid.py b/frontends/src/tools/jid.py index 40facee7..c7b4cd86 100644 --- a/frontends/src/tools/jid.py +++ b/frontends/src/tools/jid.py @@ -58,12 +58,14 @@ except (TypeError, AttributeError): # Error raised is not the same depending on return getattr(self.__internal_str, name) def __eq__(self, other): + if not isinstance(other, JID): + return False return (self.node == other.node and self.domain == other.domain and self.resource == other.resource) def __hash__(self): - return hash(self.__internal_str) + return hash('JID<{}>'.format(self.__internal_str)) def find(self, *args): return self.__internal_str.find(*args) @@ -75,7 +77,7 @@ except (TypeError, AttributeError): # Error raised is not the same depending on node_end = 0 domain_end = self.__internal_str.find('/') if domain_end == 0: - raise ValueError("a jid can't start with '/'") + raise ValueError("a jid can't start with '/'") if domain_end == -1: domain_end = len(self.__internal_str) self.node = self.__internal_str[:node_end] or None