diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/generator/IqGenerator.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/generator/IqGenerator.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/IqGenerator.java b/src/main/java/de/pixart/messenger/generator/IqGenerator.java index feb1473db..ad977c7b4 100644 --- a/src/main/java/de/pixart/messenger/generator/IqGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/IqGenerator.java @@ -433,14 +433,21 @@ public class IqGenerator extends AbstractGenerator { } public IqPacket pushTokenToAppServer(Jid appServer, String token, String deviceId) { - IqPacket packet = new IqPacket(IqPacket.TYPE.SET); + return pushTokenToAppServer(appServer, token, deviceId, null); + } + + public IqPacket pushTokenToAppServer(Jid appServer, String token, String deviceId, Jid muc) { + final IqPacket packet = new IqPacket(IqPacket.TYPE.SET); packet.setTo(appServer); - Element command = packet.addChild("command", "http://jabber.org/protocol/commands"); + final Element command = packet.addChild("command", Namespace.COMMANDS); command.setAttribute("node", "register-push-fcm"); command.setAttribute("action", "execute"); - Data data = new Data(); + final Data data = new Data(); data.put("token", token); data.put("android-id", deviceId); + if (muc != null) { + data.put("muc", muc.toEscapedString()); + } data.submit(); command.addChild(data); return packet; @@ -464,7 +471,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket disablePush(final Jid jid, final String node) { IqPacket packet = new IqPacket(IqPacket.TYPE.SET); Element disable = packet.addChild("disable", Namespace.PUSH); - disable.setAttribute("jid", jid.toString()); + disable.setAttribute("jid", jid.toEscapedString()); disable.setAttribute("node", node); return packet; } |