~singpolyma/cheogram-android

5f311288ecb1468f7a0d3d66bf86af3cf33791c5 — Stephen Paul Weber 1 year, 5 months ago 2a013c7
We can still proceed with no form, just don't send a form
1 files changed, 11 insertions(+), 7 deletions(-)

M src/main/java/eu/siacs/conversations/entities/Conversation.java
M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +11 -7
@@ 2088,16 2088,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl

            public boolean execute(String action) {
                if (!action.equals("cancel") && !validate()) return false;
                if (response == null || responseElement == null) return true;
                if (response == null) return true;
                Element command = response.findChild("command", "http://jabber.org/protocol/commands");
                if (command == null) return true;
                String status = command.getAttribute("status");
                if (status == null || !status.equals("executing")) return true;
                if (!responseElement.getName().equals("x") || !responseElement.getNamespace().equals("jabber:x:data")) return true;
                String formType = responseElement.getAttribute("type");
                if (formType == null || !formType.equals("form")) return true;

                responseElement.setAttribute("type", "submit");

                final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
                packet.setTo(response.getFrom());


@@ 2105,7 2100,16 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                c.setAttribute("node", command.getAttribute("node"));
                c.setAttribute("sessionid", command.getAttribute("sessionid"));
                c.setAttribute("action", action);
                c.addChild(responseElement);

                String formType = responseElement == null ? null : responseElement.getAttribute("type");
                if (responseElement != null &&
                    responseElement.getName().equals("x") &&
                    responseElement.getNamespace().equals("jabber:x:data") &&
                    formType != null && formType.equals("form")) {

                    responseElement.setAttribute("type", "submit");
                    c.addChild(responseElement);
                }

                xmppConnectionService.sendIqPacket(getAccount(), packet, (a, iq) -> {
                    getView().post(() -> {