aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-11-26 03:01:15 +0300
committerGravatar Vitaly Takmazov2022-11-26 03:01:15 +0300
commit0c7bdff5bfdaa44d65972abe90fad4c5cb4631ed (patch)
treeadae18eff9e5107f79d28706d7b53124f58f2714 /src
parent9faf43a6c4b933b5f97be4348d461bf91f5bf2e2 (diff)
Switch to patched babbler version
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/XMPPManager.java30
1 files changed, 20 insertions, 10 deletions
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);