diff options
author | Davide Beatrici <git@davidebeatrici.dev> | 2020-09-21 04:30:05 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2020-09-22 08:35:52 +0300 |
commit | 6a59ae2443b25942e8460980290e7cdfaf13c87e (patch) | |
tree | 43d2775cf7fb6864b31147765bdf2dc7e79a06e0 /src/murmur/Server.cpp | |
parent | 42e3752be3be96b1376a8f0169cc81c58914cb45 (diff) |
REFAC(client, server): replace "Bonjour" with "Zeroconf", except for 3rdparty
This should make it more clear that we don't include Bonjour-related stuff in our project. We use external libraries depending on the OS.
For compatibility, the server option is still called "bonjour". We should probably add a new option called "zeroconf" and then handle the old one if present in the configuration file.
Diffstat (limited to 'src/murmur/Server.cpp')
-rw-r--r-- | src/murmur/Server.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 7d48b7267..d002a0ed7 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -22,8 +22,8 @@ #include "User.h" #include "Version.h" -#ifdef USE_BONJOUR -# include "BonjourServer.h" +#ifdef USE_ZEROCONF +# include "Zeroconf.h" # include "BonjourServiceRegister.h" #endif @@ -116,8 +116,8 @@ QSslSocket *SslServer::nextPendingSSLConnection() { Server::Server(int snum, QObject *p) : QThread(p) { bValid = true; iServerNum = snum; -#ifdef USE_BONJOUR - bsRegistration = nullptr; +#ifdef USE_ZEROCONF + zeroconf = nullptr; #endif bUsingMetaCert = false; @@ -273,9 +273,9 @@ Server::Server(int snum, QObject *p) : QThread(p) { uiVersionBlob = qToBigEndian(static_cast< quint32 >((major << 16) | (minor << 8) | patch)); if (bValid) { -#ifdef USE_BONJOUR +#ifdef USE_ZEROCONF if (bBonjour) - initBonjour(); + initZeroconf(); #endif initRegister(); } @@ -327,8 +327,8 @@ void Server::stopThread() { } Server::~Server() { -#ifdef USE_BONJOUR - removeBonjour(); +#ifdef USE_ZEROCONF + removeZeroconf(); #endif stopThread(); @@ -626,11 +626,12 @@ void Server::setLiveConf(const QString &key, const QString &value) { bForceExternalAuth = !v.isNull() ? QVariant(v).toBool() : Meta::mp.bForceExternalAuth; else if (key == "bonjour") { bBonjour = !v.isNull() ? QVariant(v).toBool() : Meta::mp.bBonjour; -#ifdef USE_BONJOUR - if (bBonjour && !bsRegistration) - initBonjour(); - else if (!bBonjour && bsRegistration) - removeBonjour(); +#ifdef USE_ZEROCONF + if (bBonjour && !zeroconf) { + initZeroconf(); + } else if (!bBonjour && zeroconf) { + removeZeroconf(); + } #endif } else if (key == "allowping") bAllowPing = !v.isNull() ? QVariant(v).toBool() : Meta::mp.bAllowPing; @@ -664,19 +665,19 @@ void Server::setLiveConf(const QString &key, const QString &value) { } } -#ifdef USE_BONJOUR -void Server::initBonjour() { - bsRegistration = new BonjourServer(); - if (bsRegistration->bsrRegister) { - log("Announcing server via bonjour"); - bsRegistration->bsrRegister->registerService(BonjourRecord(qsRegName, "_mumble._tcp", ""), usPort); +#ifdef USE_ZEROCONF +void Server::initZeroconf() { + zeroconf = new Zeroconf(); + if (zeroconf->bsrRegister) { + log("Announcing server via zeroconf"); + zeroconf->bsrRegister->registerService(BonjourRecord(qsRegName, "_mumble._tcp", ""), usPort); } } -void Server::removeBonjour() { - delete bsRegistration; - bsRegistration = nullptr; - log("Stopped announcing server via bonjour"); +void Server::removeZeroconf() { + delete zeroconf; + zeroconf = nullptr; + log("Stopped announcing server via zeroconf"); } #endif |