aboutsummaryrefslogtreecommitdiff
path: root/juick-server-xmpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-xmpp/src')
-rw-r--r--juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
index bf3f54e1..59b33aba 100644
--- a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
+++ b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
@@ -24,6 +24,7 @@ import com.juick.server.component.PingEvent;
import com.juick.server.component.SubscribeEvent;
import com.juick.server.helpers.CommandResult;
import com.juick.server.helpers.UserInfo;
+import com.juick.server.xmpp.iq.MessageQuery;
import com.juick.server.xmpp.s2s.BasicXmppSession;
import com.juick.server.xmpp.s2s.StanzaListener;
import com.juick.service.*;
@@ -146,6 +147,13 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
} catch (IOException e) {
logger.warn("invalid resource", e);
}
+ router.addIQHandler(MessageQuery.class, iq -> {
+ Message warningMessage = new Message(iq.getFrom(), Message.Type.CHAT);
+ warningMessage.setFrom(jid);
+ warningMessage.setBody("Your XMPP client constantly polls us with XMPP query which is unsupported for years, please find http://juick.com/query#messages in your client code and remove that");
+ router.send(warningMessage);
+ return iq.createError(new StanzaError(Condition.BAD_REQUEST, "Please stop this spam"));
+ });
router.addIQHandler(VCard.class, new AbstractIQHandler(IQ.Type.GET) {
@Override
protected IQ processRequest(IQ iq) {