From a892bb6f1685b84b74ba37e5a6a24ee8fb45eee7 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 7 Aug 2017 12:57:57 +0200 Subject: Simplifying introduction of new XEP implementations, implements FS#250 and FS#251 (Privacy and Security settings), refactoring of location of some interfaces --- .../xmpp/disco/ServiceDiscoveryIqPacketHandler.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/de/thedevstack/conversationsplus/xmpp/disco/ServiceDiscoveryIqPacketHandler.java (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/disco/ServiceDiscoveryIqPacketHandler.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/disco/ServiceDiscoveryIqPacketHandler.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/disco/ServiceDiscoveryIqPacketHandler.java new file mode 100644 index 00000000..6f1b0676 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/disco/ServiceDiscoveryIqPacketHandler.java @@ -0,0 +1,21 @@ +package de.thedevstack.conversationsplus.xmpp.disco; + +import de.thedevstack.conversationsplus.entities.Account; +import de.thedevstack.conversationsplus.utils.XmppSendUtil; +import de.thedevstack.conversationsplus.xmpp.IqPacketHandler; +import de.thedevstack.conversationsplus.xmpp.exceptions.IqPacketErrorException; +import de.thedevstack.conversationsplus.xmpp.exceptions.NotAllowedIqException; +import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +/** + */ +public class ServiceDiscoveryIqPacketHandler implements IqPacketHandler { + @Override + public void handleIqPacket(Account account, IqPacket packet) throws IqPacketErrorException { + if (packet.getType() == IqPacket.TYPE.GET) { + XmppSendUtil.sendIqPacket(account, ServiceDiscoveryIqPacketGenerator.generateResponse(packet)); + } else { + throw new NotAllowedIqException(packet, "only type=get allowed for processing an service discovery (XEP-0030)"); + } + } +} -- cgit v1.2.3