@@ 145,6 145,7 @@ import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnBindListener;
import eu.siacs.conversations.xmpp.OnContactStatusChanged;
+import eu.siacs.conversations.xmpp.OnGatewayPromptResult;
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnMessageAcknowledged;
@@ 4655,6 4656,23 @@ public class XmppConnectionService extends Service {
}
}
+ public void fetchGatewayPrompt(Account account, final Jid jid, final OnGatewayPromptResult callback) {
+ IqPacket request = new IqPacket(IqPacket.TYPE.GET);
+ request.setTo(jid);
+ request.query("jabber:iq:gateway");
+ sendIqPacket(account, request, new OnIqPacketReceived() {
+ @Override
+ public void onIqPacketReceived(Account account, IqPacket packet) {
+ if (packet.getType() == IqPacket.TYPE.RESULT) {
+ callback.onGatewayPromptResult(packet.query().findChildContent("prompt"), null);
+ } else {
+ Element error = packet.findChild("error");
+ callback.onGatewayPromptResult(null, error == null ? null : error.findChildContent("text"));
+ }
+ }
+ });
+ }
+
public void fetchCaps(Account account, final Jid jid, final Presence presence) {
final Pair<String, String> key = new Pair<>(presence.getHash(), presence.getVer());
final ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key);
@@ 0,0 1,7 @@
+package eu.siacs.conversations.xmpp;
+
+public interface OnGatewayPromptResult {
+ // if prompt is null, there was an error
+ // errorText may or may not be set
+ public void onGatewayPromptResult(String prompt, String errorText);
+}