diff options
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/XMPPServer.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java index 29d57d53a..de9476a88 100644 --- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java +++ b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java @@ -18,6 +18,7 @@ package com.juick.components; import com.juick.components.s2s.*; +import com.juick.service.UserService; import com.juick.xmpp.extensions.JuickMessage; import com.juick.xmpp.extensions.StreamError; import org.slf4j.Logger; @@ -37,9 +38,7 @@ import javax.xml.bind.Unmarshaller; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.*; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketException; +import java.net.*; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.SecureRandom; @@ -100,6 +99,8 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { @Inject private BasicXmppSession session; + @Inject + private UserService userService; @PostConstruct public void init() throws KeyStoreException { @@ -252,6 +253,12 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { addConnectionOut(socket, streamServerDialback); streamServerDialback.addChildParser(new JuickMessage()); streamServerDialback.connect(); + } catch (UnknownHostException | ConnectException e) { + userService.getActiveJIDs().stream().filter(j -> Jid.of(j).getDomain().equals(to)) + .forEach(j -> { + userService.setActiveStatusForJID(j, UserService.ActiveStatus.Inactive); + logger.info("{} is inactive now", j); + }); } catch (Exception e) { logger.error("s2s out error", e); } |