aboutsummaryrefslogtreecommitdiff
path: root/juick-server-xmpp
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-12 17:47:45 +0300
committerGravatar Vitaly Takmazov2018-04-12 17:47:45 +0300
commitcf0137083ce96f8d26e7670332c766a6c7d75faf (patch)
tree9cb285eb7ec3a0a3e00937fbf8fe903d5078658b /juick-server-xmpp
parentc5649915e6259e921cfd087042525b69533d53b0 (diff)
xmpp: warning message for outdated query
Diffstat (limited to 'juick-server-xmpp')
-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) {