aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java24
1 files changed, 7 insertions, 17 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java
index a6d0549c..25f28ef6 100644
--- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java
+++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java
@@ -26,11 +26,9 @@ public class ConnectionIn extends Connection implements Runnable {
final public List<String> from = new ArrayList<>();
public long tsRemoteData = 0;
public long packetsRemote = 0;
- JuickBot bot;
- public ConnectionIn(XMPPServer xmpp, JuickBot bot, Socket socket) throws Exception {
+ public ConnectionIn(XMPPServer xmpp, Socket socket) throws Exception {
super(xmpp);
- this.bot = bot;
this.socket = socket;
streamID = UUID.randomUUID().toString();
restartParser();
@@ -101,17 +99,13 @@ public class ConnectionIn extends Connection implements Runnable {
}
} else if (tag.equals("presence") && checkFromTo(parser)) {
Presence p = Presence.parse(parser, null);
- if (p != null && (p.type == null || !p.type.equals(Presence.Type.error))) {
- bot.incomingPresence(p);
- }
+ xmpp.onStanzaReceived("presence", p);
} else if (tag.equals("message") && checkFromTo(parser)) {
updateTsRemoteData();
Message msg = Message.parse(parser, xmpp.childParsers);
if (msg != null && (msg.type == null || !msg.type.equals(Message.Type.error))) {
logger.info("stream {}: {}", streamID, msg);
- if (!bot.incomingMessage(msg)) {
- xmpp.getRouter().sendStanza(msg.toString());
- }
+ xmpp.onStanzaReceived("message", msg);
}
} else if (tag.equals("iq") && checkFromTo(parser)) {
updateTsRemoteData();
@@ -180,14 +174,10 @@ public class ConnectionIn extends Connection implements Runnable {
}
public void sendDialbackResult(String sfrom, String type) {
- try {
- sendStanza("<db:result from='" + xmpp.HOSTNAME + "' to='" + sfrom + "' type='" + type + "'/>");
- if (type.equals("valid")) {
- from.add(sfrom);
- logger.info("stream from {} {} ready", sfrom, streamID);
- }
- } catch (IOException e) {
- logger.warn("stream from {} {} error: {}", sfrom, streamID, e);
+ sendStanza("<db:result from='" + xmpp.HOSTNAME + "' to='" + sfrom + "' type='" + type + "'/>");
+ if (type.equals("valid")) {
+ from.add(sfrom);
+ logger.info("stream from {} {} ready", sfrom, streamID);
}
}