aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick/ws
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java1
-rw-r--r--juick-ws/src/main/java/com/juick/ws/XMPPConnection.java11
2 files changed, 7 insertions, 5 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
index 5860426a..2ab3a94c 100644
--- a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
+++ b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
@@ -9,7 +9,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
index 8dffd388..9e793a44 100644
--- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
+++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
@@ -2,6 +2,7 @@ package com.juick.ws;
import com.juick.User;
import com.juick.json.MessageSerializer;
+import com.juick.server.MessagesQueries;
import com.juick.server.SubscriptionsQueries;
import com.juick.xmpp.JID;
import com.juick.xmpp.Message;
@@ -32,7 +33,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class);
@Inject
- JdbcTemplate sql;
+ JdbcTemplate jdbc;
ExecutorService service;
Stream xmpp;
String xmppPassword;
@@ -85,7 +86,9 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
} else if (jmsg.getRID() == 0) {
onJuickMessagePost(jmsg);
} else {
- onJuickMessageReply(jmsg);
+ // to get quote
+ com.juick.Message reply = MessagesQueries.getReply(jdbc, jmsg.getMID(), jmsg.getRID());
+ onJuickMessageReply(reply);
}
}
}
@@ -108,7 +111,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
private void onJuickMessagePost(com.juick.Message jmsg) {
String json = messageSerializer.serialize(jmsg).toString();
- List<Integer> uids = SubscriptionsQueries.getSubscribedUsers(sql, jmsg.getUser().getUID(), jmsg.getMID())
+ List<Integer> uids = SubscriptionsQueries.getSubscribedUsers(jdbc, jmsg.getUser().getUID(), jmsg.getMID())
.stream().map(User::getUID).collect(Collectors.toList());
synchronized (wsHandler.clients) {
wsHandler.clients.stream().filter(c ->
@@ -138,7 +141,7 @@ public class XMPPConnection implements Stream.StreamListener, Message.MessageLis
private void onJuickMessageReply(com.juick.Message jmsg) {
String json = messageSerializer.serialize(jmsg).toString();
List<Integer> threadUsers =
- SubscriptionsQueries.getUsersSubscribedToComments(sql, jmsg.getMID(), jmsg.getUser().getUID())
+ SubscriptionsQueries.getUsersSubscribedToComments(jdbc, jmsg.getMID(), jmsg.getUser().getUID())
.stream().map(User::getUID).collect(Collectors.toList());
synchronized (wsHandler.clients) {
wsHandler.clients.stream().filter(c ->