From 80c2829a19ce8192dd4db891246fecd5177e09f1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 20 Aug 2018 13:20:14 +0300 Subject: update xmpp status api --- juick-server/src/main/java/com/juick/server/XMPPServer.java | 4 ++++ juick-server/src/main/java/com/juick/server/api/Index.java | 7 +++++-- .../main/java/com/juick/server/xmpp/helpers/XMPPStatus.java | 12 ++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/XMPPServer.java b/juick-server/src/main/java/com/juick/server/XMPPServer.java index 4a5d577d..675d79da 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPServer.java +++ b/juick-server/src/main/java/com/juick/server/XMPPServer.java @@ -434,4 +434,8 @@ public class XMPPServer implements ConnectionListener { service.shutdown(); logger.info("XMPP server destroyed"); } + + public int getServerPort() { + return s2sPort; + } } diff --git a/juick-server/src/main/java/com/juick/server/api/Index.java b/juick-server/src/main/java/com/juick/server/api/Index.java index eafde85b..5ffa6341 100644 --- a/juick-server/src/main/java/com/juick/server/api/Index.java +++ b/juick-server/src/main/java/com/juick/server/api/Index.java @@ -28,10 +28,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import rocks.xmpp.addr.Jid; import springfox.documentation.annotations.ApiIgnore; import javax.inject.Inject; import java.net.URI; +import java.util.stream.Collectors; /** * Created by vitalyster on 25.07.2016. @@ -58,8 +60,9 @@ public class Index { public XMPPStatus xmppStatus() { XMPPStatus status = new XMPPStatus(); if (xmpp != null) { - status.setInbound(xmpp.getInConnections()); - status.setOutbound(xmpp.getOutConnections().keySet()); + status.setInbound(xmpp.getInConnections().stream().map(c -> c.from).flatMap(j -> j.stream().map(Jid::getDomain)).collect(Collectors.toList())); + status.setOutbound(xmpp.getOutConnections().keySet().stream() + .map(c -> c.to).map(Jid::getDomain).collect(Collectors.toList())); } return status; } diff --git a/juick-server/src/main/java/com/juick/server/xmpp/helpers/XMPPStatus.java b/juick-server/src/main/java/com/juick/server/xmpp/helpers/XMPPStatus.java index 7978ceb3..99d89866 100644 --- a/juick-server/src/main/java/com/juick/server/xmpp/helpers/XMPPStatus.java +++ b/juick-server/src/main/java/com/juick/server/xmpp/helpers/XMPPStatus.java @@ -27,22 +27,22 @@ import java.util.Set; * Created by vitalyster on 16.02.2017. */ public class XMPPStatus { - private List inbound; - private Set outbound; + private List inbound; + private List outbound; - public List getInbound() { + public List getInbound() { return inbound; } - public void setInbound(List inbound) { + public void setInbound(List inbound) { this.inbound = inbound; } - public Set getOutbound() { + public List getOutbound() { return outbound; } - public void setOutbound(Set outbound) { + public void setOutbound(List outbound) { this.outbound = outbound; } } -- cgit v1.2.3