use of org.jivesoftware.smackx.jid_prep.element.JidPrepIq in project Smack by igniterealtime.
the class JidPrepManager method requestJidPrep.
public String requestJidPrep(Jid jidPrepService, String jidToBePrepped) throws NoResponseException, NotConnectedException, InterruptedException, XMPPErrorException {
JidPrepIq jidPrepRequest = new JidPrepIq(jidToBePrepped);
jidPrepRequest.setTo(jidPrepService);
JidPrepIq jidPrepResponse;
try {
jidPrepResponse = connection().sendIqRequestAndWaitForResponse(jidPrepRequest);
} catch (XMPPErrorException e) {
StanzaError stanzaError = e.getStanzaError();
if (stanzaError.getCondition() == StanzaError.Condition.jid_malformed) {
// or if the JID to prep was malformed. Assume the later is the case and return 'null'.
return null;
}
throw e;
}
return jidPrepResponse.getJid();
}
Aggregations