From 0c7bdff5bfdaa44d65972abe90fad4c5cb4631ed Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 26 Nov 2022 03:01:15 +0300
Subject: Switch to patched babbler version
---
pom.xml | 13 ++++++++++++-
src/main/java/com/juick/XMPPManager.java | 30 ++++++++++++++++++++----------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index 21ebdd9d..3a4efe5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,12 @@
com.juick
juick-api
2.0-SNAPSHOT
+
+
+ jitpack.io
+ https://jitpack.io
+
+
17
17
@@ -167,7 +173,7 @@
scribejava-apis
8.3.3
-
+
+
+ com.github.vitalyster
+ babbler
+ 0ecd48781b
org.commonmark
diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java
index 0878c450..dcb76853 100644
--- a/src/main/java/com/juick/XMPPManager.java
+++ b/src/main/java/com/juick/XMPPManager.java
@@ -48,6 +48,7 @@ import rocks.xmpp.core.session.XmppSession;
import rocks.xmpp.core.session.XmppSessionConfiguration;
import rocks.xmpp.core.session.debug.LogbackDebugger;
import rocks.xmpp.core.stanza.AbstractIQHandler;
+import rocks.xmpp.core.stanza.IQHandler;
import rocks.xmpp.core.stanza.model.IQ;
import rocks.xmpp.core.stanza.model.Message;
import rocks.xmpp.core.stanza.model.Presence;
@@ -135,7 +136,7 @@ public class XMPPManager implements NotificationListener {
ServiceDiscoveryManager serviceDiscoveryManager = xmpp.getManager(ServiceDiscoveryManager.class);
serviceDiscoveryManager.addIdentity(Identity.clientBot().withName("Juick"));
EntityCapabilitiesManager entityCapabilitiesManager = xmpp.getManager(EntityCapabilitiesManager.class);
- entityCapabilitiesManager.setNode("https://juick.com/caps");
+ //entityCapabilitiesManager.setNode("https://juick.com/caps");
MessageDeliveryReceiptsManager messageDeliveryReceiptsManager = xmpp.getManager(MessageDeliveryReceiptsManager.class);
messageDeliveryReceiptsManager.setEnabled(true);
PingManager pingManager = xmpp.getManager(PingManager.class);
@@ -154,16 +155,25 @@ public class XMPPManager implements NotificationListener {
} catch (IOException e) {
logger.warn("invalid resource", e);
}
- xmpp.addIQHandler(MessageQuery.class, iq -> {
- Message warningMessage = new Message(iq.getFrom(), Message.Type.CHAT);
- warningMessage.setFrom(jid);
- warningMessage.setBody("Please, stop this shit");
- xmpp.send(warningMessage);
- return iq.createError(new StanzaError(Condition.BAD_REQUEST, "Please stop this spam"));
+ xmpp.addIQHandler(new IQHandler() {
+ public java.lang.Class> getPayloadClass() {
+ return MessageQuery.class;
+ }
+ public IQ handleRequest(IQ iq) {
+ MessageQuery query = iq.getExtension(MessageQuery.class);
+ Message warningMessage = new Message(iq.getFrom(), Message.Type.CHAT);
+ warningMessage.setFrom(jid);
+ warningMessage.setBody("Please, stop this shit");
+ xmpp.send(warningMessage);
+ return iq.createError(new StanzaError(Condition.BAD_REQUEST, "Please stop this spam"));
+ }
});
- xmpp.addIQHandler(VCard.class, new AbstractIQHandler(IQ.Type.GET) {
- @Override
- protected IQ processRequest(IQ iq) {
+ xmpp.addIQHandler(new IQHandler() {
+ public Class> getPayloadClass() {
+ return VCard.class;
+ }
+ @Override
+ public IQ handleRequest(IQ iq) {
if (iq.getTo().equals(jid) || iq.getTo().asBareJid().equals(jid.asBareJid())
|| iq.getTo().asBareJid().toEscapedString().equals(jid.getDomain())) {
return iq.createResult(vCard);
--
cgit v1.2.3