diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-05-24 00:38:25 +0200 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-05-24 01:17:24 +0200 |
commit | efa649ad7769f96df60c6e1bfbd354f1404aed50 (patch) | |
tree | 1c4b79856c1eef7b0f5b18f35d1d504c235e241d /src/net/java/sip/communicator/service | |
parent | d09a39f8f453829f78dcea29d44b5abf604c14ee (diff) | |
download | jitsi-efa649ad7769f96df60c6e1bfbd354f1404aed50.zip jitsi-efa649ad7769f96df60c6e1bfbd354f1404aed50.tar.gz jitsi-efa649ad7769f96df60c6e1bfbd354f1404aed50.tar.bz2 |
Define ContactResource equality based on resourceName. (fixes OTR issue)
New ContactResource instances will be created after recovering from network
connectivity loss. (Initiated by suspending the system.) UI behaviour
fails because ContactResource instances themselves do not have the same
reference address and no custom equality was defined.
Diffstat (limited to 'src/net/java/sip/communicator/service')
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/ContactResource.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/ContactResource.java b/src/net/java/sip/communicator/service/protocol/ContactResource.java index 3a766b6..0969917 100644 --- a/src/net/java/sip/communicator/service/protocol/ContactResource.java +++ b/src/net/java/sip/communicator/service/protocol/ContactResource.java @@ -125,4 +125,35 @@ public class ContactResource { return mobile; } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = + prime * result + + ((resourceName == null) ? 0 : resourceName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ContactResource other = (ContactResource) obj; + if (resourceName == null) + { + if (other.resourceName != null) + return false; + } + else if (!resourceName.equals(other.resourceName)) + return false; + return true; + } } |