aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-10 11:37:31 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-10 11:37:31 +0100
commitc8a6b051639528f4e8e39ff09e4bda36e3191f10 (patch)
tree0e0d7cc7b91ae0b66b3274fcc74cce1e8d4af538 /src
parent89ee999e1b969a935d5b8ae9d7155ca9afe96389 (diff)
made Jid class parse otr session ids
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
index 8e9e0400..3ad3015d 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
@@ -1,5 +1,7 @@
package eu.siacs.conversations.xmpp.jid;
+import net.java.otr4j.session.SessionID;
+
import java.net.IDN;
import gnu.inet.encoding.Stringprep;
@@ -30,6 +32,14 @@ public final class Jid {
return resourcepart;
}
+ public static Jid fromSessionID(SessionID id) throws InvalidJidException{
+ if (id.getUserID().isEmpty()) {
+ return Jid.fromString(id.getAccountID());
+ } else {
+ return Jid.fromString(id.getAccountID()+"/"+id.getUserID());
+ }
+ }
+
public static Jid fromString(final String jid) throws InvalidJidException {
return new Jid(jid);
}