From 8a5a9ca0e668c96c8d048c295f8c6bf4a0935f01 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 8 Feb 2017 17:03:54 +0300 Subject: juick-xmpp: fix StanzaError usage --- juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'juick-xmpp/src/main') diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java index af53af33..c0d5df81 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java @@ -99,8 +99,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { reply.setTo(p.getFrom()); reply.setType(Presence.Type.ERROR); reply.setId(p.getId()); - StanzaError stanzaError = new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND); - reply.addExtension(stanzaError); + reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); xmpp.sendOut(ClientPresence.from(reply)); return true; } @@ -136,7 +135,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { reply.setTo(p.getFrom()); reply.setType(Presence.Type.ERROR); reply.setId(p.getId()); - reply.addExtension(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); + reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); xmpp.sendOut(ClientPresence.from(reply)); return true; } @@ -198,7 +197,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { reply.setTo(msg.getFrom()); reply.setType(Message.Type.ERROR); reply.setId(msg.getId()); - reply.addExtension(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); + reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.ITEM_NOT_FOUND)); xmpp.sendOut(ClientMessage.from(reply)); return true; } @@ -244,7 +243,7 @@ public class JuickBot implements StanzaListener, AutoCloseable { reply.setTo(msg.getFrom()); reply.setType(Message.Type.ERROR); reply.setId(msg.getId()); - reply.addExtension(new StanzaError(StanzaError.Type.CANCEL, Condition.NOT_ALLOWED)); + reply.setError(new StanzaError(StanzaError.Type.CANCEL, Condition.NOT_ALLOWED)); xmpp.sendOut(ClientMessage.from(reply)); } -- cgit v1.2.3