diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-02 22:53:01 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-02 23:09:05 +0200 |
commit | 621217973065960e3347262f507d7c3b39326464 (patch) | |
tree | eba1fdd5ca5da1e7e5a41c8a4466749e04332f98 /src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java | |
parent | 95521e80c1c029b02eddf5799cd23d0268ae4a1c (diff) |
migrate to xmpp-addr
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java b/src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java new file mode 100644 index 000000000..4710b9532 --- /dev/null +++ b/src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java @@ -0,0 +1,16 @@ +package de.pixart.messenger.xmpp.jid; + +import net.java.otr4j.session.SessionID; + +import rocks.xmpp.addr.Jid; + +public final class OtrJidHelper { + + public static Jid fromSessionID(final SessionID id) throws IllegalArgumentException { + if (id.getUserID().isEmpty()) { + return Jid.of(id.getAccountID()); + } else { + return Jid.of(id.getAccountID() + "/" + id.getUserID()); + } + } +} |