made Jid class parse otr session ids

This commit is contained in:
iNPUTmice 2014-11-10 11:37:31 +01:00
parent 89ee999e1b
commit c8a6b05163
1 changed files with 10 additions and 0 deletions

View File

@ -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);
}