aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs')
-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 8e9e04008..3ad3015d1 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);
}