diff options
author | Robert Adam <dev@robert-adam.de> | 2020-04-09 13:08:32 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2020-04-09 20:38:29 +0300 |
commit | dcd5842008ff3123484edffc84d619a559824334 (patch) | |
tree | 92e3d998123f3afa39e78fab39a5a13a08a78732 /src/murmur/Server.cpp | |
parent | 14e6e6ac99ac14dc617f4165972e9b0d8c968e5c (diff) |
src: Use enum values instead of magic numbers for speech flags
Diffstat (limited to 'src/murmur/Server.cpp')
-rw-r--r-- | src/murmur/Server.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 055ad96d9..4f6e89a28 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -18,6 +18,8 @@ #include "Version.h" #include "HTMLFilter.h" #include "HostAddress.h" +#include "ChannelListener.h" +#include "SpeechFlags.h" #ifdef USE_BONJOUR # include "BonjourServer.h" @@ -1072,13 +1074,15 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { len = pds.size() + 1; if (target == 0x1f) { // Server loopback - buffer[0] = static_cast<char>(type | 0); + buffer[0] = static_cast<char>(type | SpeechFlags::Normal); sendMessage(u, buffer, len, qba); return; } else if (target == 0) { // Normal speech Channel *c = u->cChannel; - buffer[0] = static_cast<char>(type | 0); + buffer[0] = static_cast<char>(type | SpeechFlags::Normal); + + // Send audio to all users in the same channel foreach(User *p, c->qlUsers) { ServerUser *pDst = static_cast<ServerUser *>(p); SENDTO; @@ -1099,7 +1103,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { } } } - } else if (u->qmTargets.contains(target)) { // Whisper + } else if (u->qmTargets.contains(target)) { // Whisper/Shout QSet<ServerUser *> channel; QSet<ServerUser *> direct; @@ -1172,7 +1176,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { return; } if (! channel.isEmpty()) { - buffer[0] = static_cast<char>(type | 1); + buffer[0] = static_cast<char>(type | SpeechFlags::Shout); foreach(ServerUser *pDst, channel) { SENDTO; } @@ -1182,7 +1186,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { } } if (! direct.isEmpty()) { - buffer[0] = static_cast<char>(type | 2); + buffer[0] = static_cast<char>(type | SpeechFlags::Whisper); foreach(ServerUser *pDst, direct) { SENDTO; } |