summaryrefslogtreecommitdiff
path: root/src/config.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-02 15:40:17 +0000
committerSadie Powell <sadie@witchery.services>2025-03-02 15:42:25 +0000
commit4526fbed960085e3996fcd70195887f462c430d8 (patch)
tree6016748659945b240e216675dbe70ff80aa961af /src/config.cpp
parentf9911dde529adf3dc03f4f14bbd70756ac2f665c (diff)
Add a helper method for getting a description of an uplink.
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 33d7a8de8..e9096599c 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -23,6 +23,7 @@
using Configuration::File;
using Configuration::Conf;
using Configuration::Internal::Block;
+using Configuration::Uplink;
File ServicesConf("anope.conf", false); // Configuration file name
Conf *Config = NULL;
@@ -619,6 +620,23 @@ void Conf::Post(Conf *old)
}
}
+Anope::string Uplink::str() const
+{
+ switch (protocol)
+ {
+ case AF_INET:
+ return Anope::printf("%s:%u", this->host.c_str(), this->port);
+ case AF_INET6:
+ return Anope::printf("[%s]:%u", this->host.c_str(), this->port);
+ case AF_UNIX:
+ return this->host;
+ }
+
+ // Should never be reached.
+ return "";
+}
+
+
Block &Conf::GetModule(const Module *m)
{
if (!m)