aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/XMPPConnection.java20
1 files changed, 12 insertions, 8 deletions
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 d30f8f03..be7f3899 100644
--- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
+++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
@@ -65,6 +65,8 @@ public class XMPPConnection implements AutoCloseable {
private int xmppPort;
@Value("${ws_jid:ws.juick.local}")
private String wsJid;
+ @Value("${service_user:juick}")
+ private String serviceUser;
private XmppSession xmpp;
@@ -140,14 +142,16 @@ public class XMPPConnection implements AutoCloseable {
private void onJuickPM(final int uid_to, final com.juick.Message jmsg) throws JsonProcessingException {
String json = jsonMapper.writeValueAsString(jmsg);
synchronized (wsHandler.getClients()) {
- wsHandler.getClients().stream().filter(c -> !c.legacy && c.visitor.getUid() == uid_to).forEach(c -> {
- try {
- logger.info("sending pm to {}", c.visitor.getUid());
- c.session.sendMessage(new TextMessage(json));
- } catch (IOException e) {
- logger.warn("ws error", e);
- }
- });
+ wsHandler.getClients().stream().filter(c ->
+ (!c.legacy && c.visitor.getUid() == uid_to) || c.visitor.getName().equals(serviceUser))
+ .forEach(c -> {
+ try {
+ logger.info("sending pm to {}", c.visitor.getUid());
+ c.session.sendMessage(new TextMessage(json));
+ } catch (IOException e) {
+ logger.warn("ws error", e);
+ }
+ });
}
}