aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp/jid/OtrJidHelper.java
blob: 4710b953259ba70e4fee4f63444dc73382efe73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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());
        }
    }
}