From 00bcbff5ee8a499f00325a64dc057fcfc1309a96 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 18 May 2022 21:45:00 +0200 Subject: [PATCH] [core] Add ConnectionConfiguration.getHostString() --- .../jivesoftware/smack/ConnectionConfiguration.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index e8689d24f..9561a158d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -302,6 +302,16 @@ public abstract class ConnectionConfiguration { return new SmackTlsContext(context, daneVerifier); } + public String getHostString() { + if (hostAddress != null) { + return hostAddress.toString(); + } + if (host != null) { + return host.toString(); + } + return xmppServiceDomain.toString(); + } + public DnsName getHost() { return host; }