made Jid class parse otr session ids
This commit is contained in:
parent
89ee999e1b
commit
c8a6b05163
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue