Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2012-04-01 16:31:10 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2012-08-04 16:31:59 +0400
commit3adbbc6f16ebc2d98b18bee797adb890f0120a46 (patch)
treeb5003c3ee918802086208befca1446b74961f8a3
parent54384d78bcac82f745e7aa9333bf62ae18e066f9 (diff)
Start refactoring of Message handling code.
Client: Prepared refactoring of message handling by moving the responsibility of handling ServerHandlerEvents from MainWindow to MessageHandler. For now everything is forwarded via g.mw to the old handlers in the MainWindow. The old handlers were moved from Messages.cpp to MainWindowMessages.cpp. Package type enumerations now have their own MessageTypes.h header. Inline conversion functions were extracted to ConversionHelpers.h. Server: Only small adaptations to new structure.
-rw-r--r--src/Connection.cpp2
-rw-r--r--src/ConversionHelpers.h38
-rw-r--r--src/Message.h111
-rw-r--r--src/MessageTypes.h53
-rw-r--r--src/mumble.pri2
-rw-r--r--src/mumble/ACLEditor.cpp1
-rw-r--r--src/mumble/Audio.cpp6
-rw-r--r--src/mumble/AudioInput.cpp22
-rw-r--r--src/mumble/AudioInput.h4
-rw-r--r--src/mumble/AudioOutput.cpp4
-rw-r--r--src/mumble/AudioOutput.h4
-rw-r--r--src/mumble/AudioOutputSpeech.cpp22
-rw-r--r--src/mumble/AudioOutputSpeech.h6
-rw-r--r--src/mumble/BanEditor.cpp1
-rw-r--r--src/mumble/Database.cpp2
-rw-r--r--src/mumble/LCD.cpp2
-rw-r--r--src/mumble/MainWindow.cpp30
-rw-r--r--src/mumble/MainWindow.h32
-rw-r--r--src/mumble/MainWindowMessages.cpp (renamed from src/mumble/Messages.cpp)19
-rw-r--r--src/mumble/MessageHandler.cpp176
-rw-r--r--src/mumble/MessageHandler.h71
-rw-r--r--src/mumble/Overlay.cpp3
-rw-r--r--src/mumble/OverlayClient.cpp2
-rw-r--r--src/mumble/OverlayConfig.cpp2
-rw-r--r--src/mumble/OverlayEditor.cpp2
-rw-r--r--src/mumble/OverlayEditorScene.cpp2
-rw-r--r--src/mumble/OverlayUser.cpp2
-rw-r--r--src/mumble/OverlayUserGroup.cpp2
-rw-r--r--src/mumble/Plugins.cpp3
-rw-r--r--src/mumble/ServerHandler.cpp44
-rw-r--r--src/mumble/ServerHandler.h9
-rw-r--r--src/mumble/Tokens.cpp1
-rw-r--r--src/mumble/UserEdit.cpp1
-rw-r--r--src/mumble/UserEdit.h2
-rw-r--r--src/mumble/UserInformation.cpp1
-rw-r--r--src/mumble/UserInformation.h2
-rw-r--r--src/mumble/UserModel.cpp3
-rw-r--r--src/mumble/mumble.pro4
-rw-r--r--src/murmur/DBus.cpp2
-rw-r--r--src/murmur/Messages.cpp2
-rw-r--r--src/murmur/MurmurIce.cpp1
-rw-r--r--src/murmur/RPC.cpp1
-rw-r--r--src/murmur/Server.cpp36
-rw-r--r--src/murmur/Server.h8
-rw-r--r--src/murmur/ServerDB.cpp1
45 files changed, 482 insertions, 262 deletions
diff --git a/src/Connection.cpp b/src/Connection.cpp
index 2b291c21f..b9f83f48c 100644
--- a/src/Connection.cpp
+++ b/src/Connection.cpp
@@ -51,7 +51,7 @@
#endif
#include "Connection.h"
-#include "Message.h"
+#include "MessageTypes.h"
#include "Mumble.pb.h"
diff --git a/src/ConversionHelpers.h b/src/ConversionHelpers.h
new file mode 100644
index 000000000..f776352b1
--- /dev/null
+++ b/src/ConversionHelpers.h
@@ -0,0 +1,38 @@
+#include <QString>
+#include <QByteArray>
+#include <QCryptographicHash>
+#include <string>
+
+#ifndef CONVERSION_HELPER_H
+#define CONVERSION_HELPER_H
+
+inline QString u8(const ::std::string &str) {
+ return QString::fromUtf8(str.data(), static_cast<int>(str.length()));
+}
+
+inline QString u8(const ::std::wstring &str) {
+ return QString::fromStdWString(str);
+}
+
+inline ::std::string u8(const QString &str) {
+ const QByteArray &qba = str.toUtf8();
+ return ::std::string(qba.constData(), qba.length());
+}
+
+inline QByteArray blob(const ::std::string &str) {
+ return QByteArray(str.data(), static_cast<int>(str.length()));
+}
+
+inline ::std::string blob(const QByteArray &str) {
+ return ::std::string(str.constData(), str.length());
+}
+
+inline QByteArray sha1(const QByteArray &blob) {
+ return QCryptographicHash::hash(blob, QCryptographicHash::Sha1);
+}
+
+inline QByteArray sha1(const QString &str) {
+ return QCryptographicHash::hash(str.toUtf8(), QCryptographicHash::Sha1);
+}
+
+#endif
diff --git a/src/Message.h b/src/Message.h
deleted file mode 100644
index 473075efa..000000000
--- a/src/Message.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- - Neither the name of the Mumble Developers nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef MESSAGE_H_
-#define MESSAGE_H_
-
-#include <string>
-#include <QtCore/QCryptographicHash>
-#include <QtCore/QString>
-
-/**
- Protobuf packet type enumeration for message handler generation.
-
- Warning: Only append to the end.
- */
-#define MUMBLE_MH_ALL \
- MUMBLE_MH_MSG(Version) \
- MUMBLE_MH_MSG(UDPTunnel) \
- MUMBLE_MH_MSG(Authenticate) \
- MUMBLE_MH_MSG(Ping) \
- MUMBLE_MH_MSG(Reject) \
- MUMBLE_MH_MSG(ServerSync) \
- MUMBLE_MH_MSG(ChannelRemove) \
- MUMBLE_MH_MSG(ChannelState) \
- MUMBLE_MH_MSG(UserRemove) \
- MUMBLE_MH_MSG(UserState) \
- MUMBLE_MH_MSG(BanList) \
- MUMBLE_MH_MSG(TextMessage) \
- MUMBLE_MH_MSG(PermissionDenied) \
- MUMBLE_MH_MSG(ACL) \
- MUMBLE_MH_MSG(QueryUsers) \
- MUMBLE_MH_MSG(CryptSetup) \
- MUMBLE_MH_MSG(ContextActionModify) \
- MUMBLE_MH_MSG(ContextAction) \
- MUMBLE_MH_MSG(UserList) \
- MUMBLE_MH_MSG(VoiceTarget) \
- MUMBLE_MH_MSG(PermissionQuery) \
- MUMBLE_MH_MSG(CodecVersion) \
- MUMBLE_MH_MSG(UserStats) \
- MUMBLE_MH_MSG(RequestBlob) \
- MUMBLE_MH_MSG(ServerConfig) \
- MUMBLE_MH_MSG(SuggestConfig)
-
-class MessageHandler {
- public:
- enum UDPMessageType { UDPVoiceCELTAlpha, UDPPing, UDPVoiceSpeex, UDPVoiceCELTBeta, UDPVoiceOpus };
-
-#define MUMBLE_MH_MSG(x) x,
- enum MessageType {
- MUMBLE_MH_ALL
- };
-#undef MUMBLE_MH_MSG
-};
-
-inline QString u8(const ::std::string &str) {
- return QString::fromUtf8(str.data(), static_cast<int>(str.length()));
-}
-
-inline QString u8(const ::std::wstring &str) {
- return QString::fromStdWString(str);
-}
-
-inline ::std::string u8(const QString &str) {
- const QByteArray &qba = str.toUtf8();
- return ::std::string(qba.constData(), qba.length());
-}
-
-inline QByteArray blob(const ::std::string &str) {
- return QByteArray(str.data(), static_cast<int>(str.length()));
-}
-
-inline ::std::string blob(const QByteArray &str) {
- return ::std::string(str.constData(), str.length());
-}
-
-inline QByteArray sha1(const QByteArray &blob) {
- return QCryptographicHash::hash(blob, QCryptographicHash::Sha1);
-}
-
-inline QByteArray sha1(const QString &str) {
- return QCryptographicHash::hash(str.toUtf8(), QCryptographicHash::Sha1);
-}
-
-#endif
diff --git a/src/MessageTypes.h b/src/MessageTypes.h
new file mode 100644
index 000000000..eda82a7d1
--- /dev/null
+++ b/src/MessageTypes.h
@@ -0,0 +1,53 @@
+#ifndef MESSAGE_H
+#define MESSAGE_H
+
+/**
+ Protobuf packet type enumeration for message handler generation.
+
+ Warning: Only append to the end.
+ */
+#define MUMBLE_MH_ALL \
+ MUMBLE_MH_MSG(Version) \
+ MUMBLE_MH_MSG(UDPTunnel) \
+ MUMBLE_MH_MSG(Authenticate) \
+ MUMBLE_MH_MSG(Ping) \
+ MUMBLE_MH_MSG(Reject) \
+ MUMBLE_MH_MSG(ServerSync) \
+ MUMBLE_MH_MSG(ChannelRemove) \
+ MUMBLE_MH_MSG(ChannelState) \
+ MUMBLE_MH_MSG(UserRemove) \
+ MUMBLE_MH_MSG(UserState) \
+ MUMBLE_MH_MSG(BanList) \
+ MUMBLE_MH_MSG(TextMessage) \
+ MUMBLE_MH_MSG(PermissionDenied) \
+ MUMBLE_MH_MSG(ACL) \
+ MUMBLE_MH_MSG(QueryUsers) \
+ MUMBLE_MH_MSG(CryptSetup) \
+ MUMBLE_MH_MSG(ContextActionModify) \
+ MUMBLE_MH_MSG(ContextAction) \
+ MUMBLE_MH_MSG(UserList) \
+ MUMBLE_MH_MSG(VoiceTarget) \
+ MUMBLE_MH_MSG(PermissionQuery) \
+ MUMBLE_MH_MSG(CodecVersion) \
+ MUMBLE_MH_MSG(UserStats) \
+ MUMBLE_MH_MSG(RequestBlob) \
+ MUMBLE_MH_MSG(ServerConfig) \
+ MUMBLE_MH_MSG(SuggestConfig)
+
+struct MessageTypes {
+ enum UDPMessageType {
+ UDPVoiceCELTAlpha,
+ UDPPing,
+ UDPVoiceSpeex,
+ UDPVoiceCELTBeta,
+ UDPVoiceOpus
+ };
+
+#define MUMBLE_MH_MSG(x) x,
+ enum MessageType {
+ MUMBLE_MH_ALL
+ };
+#undef MUMBLE_MH_MSG
+};
+
+#endif
diff --git a/src/mumble.pri b/src/mumble.pri
index c4d076f2b..0c8a46422 100644
--- a/src/mumble.pri
+++ b/src/mumble.pri
@@ -1,7 +1,7 @@
include(../compiler.pri)
VERSION = 1.2.4
-DIST = mumble.pri Message.h PacketDataStream.h CryptState.h Timer.h Version.h OSInfo.h SSL.h Mumble.proto
+DIST = mumble.pri MessageTypes.h PacketDataStream.h CryptState.h Timer.h Version.h OSInfo.h SSL.h Mumble.proto
CONFIG += qt thread debug_and_release warn_on
DEFINES *= MUMBLE_VERSION_STRING=$$VERSION
INCLUDEPATH += $$PWD .
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp
index c938ffc15..c25a9a527 100644
--- a/src/mumble/ACLEditor.cpp
+++ b/src/mumble/ACLEditor.cpp
@@ -41,6 +41,7 @@
#include "Log.h"
#include "ServerHandler.h"
#include "User.h"
+#include "ConversionHelpers.h"
ACLGroup::ACLGroup(const QString &name) : Group(NULL, name) {
bInherited = false;
diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp
index 6ecac3bef..52fef460e 100644
--- a/src/mumble/Audio.cpp
+++ b/src/mumble/Audio.cpp
@@ -130,7 +130,7 @@ void LoopUser::addFrame(const QByteArray &packet) {
if (qtLastFetch.elapsed() > 100) {
AudioOutputPtr ao = g.ao;
if (ao) {
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((packet.at(0) >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((packet.at(0) >> 5) & 0x7);
ao->addFrameToBuffer(this, QByteArray(), 0, msgType);
}
}
@@ -166,7 +166,7 @@ void LoopUser::fetchFrames() {
qba.append(static_cast<char>(msgFlags));
qba.append(pds.dataBlock(pds.left()));
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((msgFlags >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((msgFlags >> 5) & 0x7);
ao->addFrameToBuffer(this, qba, iSeq, msgType);
i = qmPackets.erase(i);
@@ -202,7 +202,7 @@ void RecordUser::addFrame(const QByteArray &packet) {
qba.append(static_cast<char>(msgFlags));
qba.append(pds.dataBlock(pds.left()));
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((msgFlags >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((msgFlags >> 5) & 0x7);
ao->addFrameToBuffer(this, qba, iSeq, msgType);
}
diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp
index eb6bb59be..a07ccc0b4 100644
--- a/src/mumble/AudioInput.cpp
+++ b/src/mumble/AudioInput.cpp
@@ -39,7 +39,7 @@
#include "User.h"
#include "PacketDataStream.h"
#include "Plugins.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Global.h"
#include "NetworkConfig.h"
#include "VoiceRecorder.h"
@@ -101,7 +101,7 @@ AudioInput::AudioInput() : opusBuffer(g.s.iFramesPerPacket * (SAMPLE_RATE / 100)
g.iAudioBandwidth = getNetworkBandwidth(iAudioQuality, iAudioFrames);
- umtType = MessageHandler::UDPVoiceCELTAlpha;
+ umtType = MessageTypes::UDPVoiceCELTAlpha;
cCodec = NULL;
ceEncoder = NULL;
@@ -602,7 +602,7 @@ bool AudioInput::selectCodec() {
// Currently talking, use previous Opus status.
if (bPreviousVoice) {
- useOpus = (umtType == MessageHandler::UDPVoiceOpus);
+ useOpus = (umtType == MessageTypes::UDPVoiceOpus);
} else {
#ifdef USE_OPUS
if (g.bOpus || (g.s.lmLoopMode == Settings::Local)) {
@@ -645,18 +645,18 @@ bool AudioInput::selectCodec() {
return false;
}
- MessageHandler::UDPMessageType previousType = umtType;
+ MessageTypes::UDPMessageType previousType = umtType;
if (useOpus) {
- umtType = MessageHandler::UDPVoiceOpus;
+ umtType = MessageTypes::UDPVoiceOpus;
} else {
if (!g.uiSession) {
- umtType = MessageHandler::UDPVoiceCELTAlpha;
+ umtType = MessageTypes::UDPVoiceCELTAlpha;
} else {
int v = cCodec->bitstreamVersion();
if (v == g.iCodecAlpha)
- umtType = MessageHandler::UDPVoiceCELTAlpha;
+ umtType = MessageTypes::UDPVoiceCELTAlpha;
else if (v == g.iCodecBeta)
- umtType = MessageHandler::UDPVoiceCELTBeta;
+ umtType = MessageTypes::UDPVoiceCELTBeta;
else {
qWarning() << "Couldn't find message type for codec version" << v;
}
@@ -850,12 +850,12 @@ void AudioInput::encodeAudioFrame() {
if (!selectCodec())
return;
- if (umtType == MessageHandler::UDPVoiceCELTAlpha || umtType == MessageHandler::UDPVoiceCELTBeta) {
+ if (umtType == MessageTypes::UDPVoiceCELTAlpha || umtType == MessageTypes::UDPVoiceCELTBeta) {
len = encodeCELTFrame(psSource, buffer);
if (len == 0)
return;
++iBufferedFrames;
- } else if (umtType == MessageHandler::UDPVoiceOpus) {
+ } else if (umtType == MessageTypes::UDPVoiceOpus) {
encoded = false;
opusBuffer.insert(opusBuffer.end(), psSource, psSource + iFrameSize);
++iBufferedFrames;
@@ -927,7 +927,7 @@ void AudioInput::flushCheck(const QByteArray &frame, bool terminator) {
// Sequence number
pds << iFrameCounter - frames;
- if (umtType == MessageHandler::UDPVoiceOpus) {
+ if (umtType == MessageTypes::UDPVoiceOpus) {
const QByteArray &qba = qlFrames.takeFirst();
int size = qba.size();
if (terminator)
diff --git a/src/mumble/AudioInput.h b/src/mumble/AudioInput.h
index b6cce4169..ea58e6f9d 100644
--- a/src/mumble/AudioInput.h
+++ b/src/mumble/AudioInput.h
@@ -43,7 +43,7 @@
#include "Audio.h"
#include "Settings.h"
#include "Timer.h"
-#include "Message.h"
+#include "MessageHandler.h"
class AudioInput;
class CELTCodec;
@@ -102,7 +102,7 @@ class AudioInput : public QThread {
int encodeSpeexFrame(short *pSource, unsigned char *buffer);
int encodeCELTFrame(short *pSource, unsigned char *buffer);
protected:
- MessageHandler::UDPMessageType umtType;
+ MessageTypes::UDPMessageType umtType;
SampleFormat eMicFormat, eEchoFormat;
unsigned int iSampleRate;
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp
index 06954884e..b9c6eaea3 100644
--- a/src/mumble/AudioOutput.cpp
+++ b/src/mumble/AudioOutput.cpp
@@ -38,7 +38,7 @@
#include "AudioOutputSpeech.h"
#include "User.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Plugins.h"
#include "PacketDataStream.h"
#include "ServerHandler.h"
@@ -173,7 +173,7 @@ const float *AudioOutput::getSpeakerPos(unsigned int &speakers) {
return NULL;
}
-void AudioOutput::addFrameToBuffer(ClientUser *user, const QByteArray &qbaPacket, unsigned int iSeq, MessageHandler::UDPMessageType type) {
+void AudioOutput::addFrameToBuffer(ClientUser *user, const QByteArray &qbaPacket, unsigned int iSeq, MessageTypes::UDPMessageType type) {
if (iChannels == 0)
return;
qrwlOutputs.lockForRead();
diff --git a/src/mumble/AudioOutput.h b/src/mumble/AudioOutput.h
index a4d9fbdac..494926d99 100644
--- a/src/mumble/AudioOutput.h
+++ b/src/mumble/AudioOutput.h
@@ -64,7 +64,7 @@
#endif
#include "Audio.h"
-#include "Message.h"
+#include "MessageHandler.h"
class AudioOutput;
class ClientUser;
@@ -121,7 +121,7 @@ class AudioOutput : public QThread {
AudioOutput();
~AudioOutput();
- void addFrameToBuffer(ClientUser *, const QByteArray &, unsigned int iSeq, MessageHandler::UDPMessageType type);
+ void addFrameToBuffer(ClientUser *, const QByteArray &, unsigned int iSeq, MessageTypes::UDPMessageType type);
void removeBuffer(const ClientUser *);
AudioOutputSample *playSample(const QString &filename, bool loop = false);
void run() = 0;
diff --git a/src/mumble/AudioOutputSpeech.cpp b/src/mumble/AudioOutputSpeech.cpp
index bd9ec443b..968fefe30 100644
--- a/src/mumble/AudioOutputSpeech.cpp
+++ b/src/mumble/AudioOutputSpeech.cpp
@@ -43,7 +43,7 @@
#include "opus.h"
#endif
-AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, MessageHandler::UDPMessageType type) : AudioOutputUser(user->qsName) {
+AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, MessageTypes::UDPMessageType type) : AudioOutputUser(user->qsName) {
int err;
p = user;
umtType = type;
@@ -60,12 +60,12 @@ AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, Messag
iFrameSize = iSampleRate / 100;
iAudioBufferSize = iFrameSize;
- if (umtType == MessageHandler::UDPVoiceOpus) {
+ if (umtType == MessageTypes::UDPVoiceOpus) {
#ifdef USE_OPUS
iAudioBufferSize *= 12;
opusState = opus_decoder_create(iSampleRate, bStereo ? 2 : 1, NULL);
#endif
- } else if (umtType == MessageHandler::UDPVoiceSpeex) {
+ } else if (umtType == MessageTypes::UDPVoiceSpeex) {
speex_bits_init(&sbBits);
dsSpeex = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB));
@@ -143,7 +143,7 @@ void AudioOutputSpeech::addFrameToBuffer(const QByteArray &qbaPacket, unsigned i
pds.next();
int samples = 0;
- if (umtType == MessageHandler::UDPVoiceOpus) {
+ if (umtType == MessageTypes::UDPVoiceOpus) {
int size;
pds >> size;
size &= 0x1fff;
@@ -178,7 +178,7 @@ void AudioOutputSpeech::addFrameToBuffer(const QByteArray &qbaPacket, unsigned i
jbp.timestamp = iFrameSize * iSeq;
#ifdef REPORT_JITTER
- if (g.s.bUsage && (umtType != MessageHandler::UDPVoiceSpeex) && p && ! p->qsHash.isEmpty() && (p->qlTiming.count() < 3000)) {
+ if (g.s.bUsage && (umtType != MessageTypes::UDPVoiceSpeex) && p && ! p->qsHash.isEmpty() && (p->qlTiming.count() < 3000)) {
QMutexLocker qml(& p->qmTiming);
ClientUser::JitterRecord jr;
@@ -259,7 +259,7 @@ bool AudioOutputSpeech::needSamples(unsigned int snum) {
ucFlags = static_cast<unsigned char>(pds.next());
bHasTerminator = false;
- if (umtType == MessageHandler::UDPVoiceOpus) {
+ if (umtType == MessageTypes::UDPVoiceOpus) {
int size;
pds >> size;
@@ -303,8 +303,8 @@ bool AudioOutputSpeech::needSamples(unsigned int snum) {
if (! qlFrames.isEmpty()) {
QByteArray qba = qlFrames.takeFirst();
- if (umtType == MessageHandler::UDPVoiceCELTAlpha || umtType == MessageHandler::UDPVoiceCELTBeta) {
- int wantversion = (umtType == MessageHandler::UDPVoiceCELTAlpha) ? g.iCodecAlpha : g.iCodecBeta;
+ if (umtType == MessageTypes::UDPVoiceCELTAlpha || umtType == MessageTypes::UDPVoiceCELTBeta) {
+ int wantversion = (umtType == MessageTypes::UDPVoiceCELTAlpha) ? g.iCodecAlpha : g.iCodecBeta;
if ((p == &LoopUser::lpLoopy) && (! g.qmCodecs.isEmpty())) {
QMap<int, CELTCodec *>::const_iterator i = g.qmCodecs.constEnd();
--i;
@@ -324,7 +324,7 @@ bool AudioOutputSpeech::needSamples(unsigned int snum) {
cCodec->decode_float(cdDecoder, qba.isEmpty() ? NULL : reinterpret_cast<const unsigned char *>(qba.constData()), qba.size(), pOut);
else
memset(pOut, 0, sizeof(float) * iFrameSize);
- } else if (umtType == MessageHandler::UDPVoiceOpus) {
+ } else if (umtType == MessageTypes::UDPVoiceOpus) {
#ifdef USE_OPUS
decodedSamples = opus_decode_float(opusState,
qba.isEmpty() ?
@@ -375,12 +375,12 @@ bool AudioOutputSpeech::needSamples(unsigned int snum) {
if (qlFrames.isEmpty() && bHasTerminator)
nextalive = false;
} else {
- if (umtType == MessageHandler::UDPVoiceCELTAlpha || umtType == MessageHandler::UDPVoiceCELTBeta) {
+ if (umtType == MessageTypes::UDPVoiceCELTAlpha || umtType == MessageTypes::UDPVoiceCELTBeta) {
if (cdDecoder)
cCodec->decode_float(cdDecoder, NULL, 0, pOut);
else
memset(pOut, 0, sizeof(float) * iFrameSize);
- } else if (umtType == MessageHandler::UDPVoiceOpus) {
+ } else if (umtType == MessageTypes::UDPVoiceOpus) {
#ifdef USE_OPUS
decodedSamples = opus_decode_float(opusState, NULL, 0, pOut, iFrameSize, 0);
#endif
diff --git a/src/mumble/AudioOutputSpeech.h b/src/mumble/AudioOutputSpeech.h
index d123c8a01..3a6636af8 100644
--- a/src/mumble/AudioOutputSpeech.h
+++ b/src/mumble/AudioOutputSpeech.h
@@ -41,7 +41,7 @@
#include <QtCore/QMutex>
#include "AudioOutputUser.h"
-#include "Message.h"
+#include "MessageHandler.h"
class CELTCodec;
class ClientUser;
@@ -86,14 +86,14 @@ class AudioOutputSpeech : public AudioOutputUser {
unsigned char ucFlags;
public:
- MessageHandler::UDPMessageType umtType;
+ MessageTypes::UDPMessageType umtType;
int iMissedFrames;
ClientUser *p;
virtual bool needSamples(unsigned int snum);
void addFrameToBuffer(const QByteArray &, unsigned int iBaseSeq);
- AudioOutputSpeech(ClientUser *, unsigned int freq, MessageHandler::UDPMessageType type);
+ AudioOutputSpeech(ClientUser *, unsigned int freq, MessageTypes::UDPMessageType type);
~AudioOutputSpeech();
};
diff --git a/src/mumble/BanEditor.cpp b/src/mumble/BanEditor.cpp
index 36dad74ad..50402204b 100644
--- a/src/mumble/BanEditor.cpp
+++ b/src/mumble/BanEditor.cpp
@@ -36,6 +36,7 @@
#include "Global.h"
#include "Net.h"
#include "ServerHandler.h"
+#include "ConversionHelpers.h"
BanEditor::BanEditor(const MumbleProto::BanList &msg, QWidget *p) : QDialog(p) {
setupUi(this);
diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp
index c8acec80d..fea2f3f58 100644
--- a/src/mumble/Database.cpp
+++ b/src/mumble/Database.cpp
@@ -33,7 +33,7 @@
#include "Database.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Net.h"
#include "Version.h"
diff --git a/src/mumble/LCD.cpp b/src/mumble/LCD.cpp
index e7d8c5e28..6d3600188 100644
--- a/src/mumble/LCD.cpp
+++ b/src/mumble/LCD.cpp
@@ -36,7 +36,7 @@
#include "ClientUser.h"
#include "Channel.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "ServerHandler.h"
QList<LCDEngineNew> *LCDEngineRegistrar::qlInitializers;
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index 31a7f64df..1f9f6151f 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -65,6 +65,7 @@
#include "ViewCert.h"
#include "VoiceRecorderDialog.h"
#include "../SignalCurry.h"
+#include "ConversionHelpers.h"
#ifdef Q_OS_WIN
#include "TaskList.h"
@@ -2621,36 +2622,7 @@ void MainWindow::customEvent(QEvent *evt) {
OpenURLEvent *oue=static_cast<OpenURLEvent *>(evt);
openUrl(oue->url);
return;
- } else if (evt->type() != SERVERSEND_EVENT) {
- return;
- }
-
- ServerHandlerMessageEvent *shme=static_cast<ServerHandlerMessageEvent *>(evt);
-
-#ifdef QT_NO_DEBUG
-#define MUMBLE_MH_MSG(x) case MessageHandler:: x : { \
- MumbleProto:: x msg; \
- if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) \
- msg##x(msg); \
- break; \
- }
-#else
-#define MUMBLE_MH_MSG(x) case MessageHandler:: x : { \
- MumbleProto:: x msg; \
- if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) { \
- printf("%s:\n", #x); \
- msg.PrintDebugString(); \
- msg##x(msg); \
- } \
- break; \
- }
-#endif
- switch (shme->uiType) {
- MUMBLE_MH_ALL
}
-
-
-#undef MUMBLE_MH_MSG
}
diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h
index b3b10108f..6a85e369f 100644
--- a/src/mumble/MainWindow.h
+++ b/src/mumble/MainWindow.h
@@ -37,7 +37,7 @@
#include <QtNetwork/QAbstractSocket>
#include "CustomElements.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Mumble.pb.h"
#include "Usage.h"
@@ -73,7 +73,7 @@ class OpenURLEvent : public QEvent {
OpenURLEvent(QUrl url);
};
-class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWindow {
+class MainWindow : public QMainWindow, public Ui::MainWindow {
friend class UserModel;
private:
Q_OBJECT
@@ -248,10 +248,30 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
MainWindow(QWidget *parent);
~MainWindow();
- // From msgHandler. Implementation in Messages.cpp
-#define MUMBLE_MH_MSG(x) void msg##x(const MumbleProto:: x &);
- MUMBLE_MH_ALL
-#undef MUMBLE_MH_MSG
+ //FIXME: Deprecated. For now MainWindow still implements most of the
+ // handlers but the goal is to remove them from here.
+ // Receives events by forward from MessageHandler class.
+ void msgBanList(const MumbleProto::BanList &msg);
+ void msgReject(const MumbleProto::Reject &msg);
+ void msgServerSync(const MumbleProto::ServerSync &msg);
+ void msgServerConfig(const MumbleProto::ServerConfig &msg);
+ void msgPermissionDenied(const MumbleProto::PermissionDenied &msg);
+ void msgUserState(const MumbleProto::UserState &msg);
+ void msgUserRemove(const MumbleProto::UserRemove &msg);
+ void msgChannelState(const MumbleProto::ChannelState &msg);
+ void msgChannelRemove(const MumbleProto::ChannelRemove &msg);
+ void msgTextMessage(const MumbleProto::TextMessage &msg);
+ void msgACL(const MumbleProto::ACL &msg);
+ void msgQueryUsers(const MumbleProto::QueryUsers &msg);
+ void msgCryptSetup(const MumbleProto::CryptSetup &msg);
+ void msgContextActionModify(const MumbleProto::ContextActionModify &msg);
+ void msgVersion(const MumbleProto::Version &msg);
+ void msgUserList(const MumbleProto::UserList &msg);
+ void msgPermissionQuery(const MumbleProto::PermissionQuery &msg);
+ void msgCodecVersion(const MumbleProto::CodecVersion &msg);
+ void msgUserStats(const MumbleProto::UserStats &msg);
+ void msgSuggestConfig(const MumbleProto::SuggestConfig &msg);
+
void removeContextAction(const MumbleProto::ContextActionModify &msg);
};
diff --git a/src/mumble/Messages.cpp b/src/mumble/MainWindowMessages.cpp
index 54cd8dfca..810026730 100644
--- a/src/mumble/Messages.cpp
+++ b/src/mumble/MainWindowMessages.cpp
@@ -54,6 +54,7 @@
#include "UserModel.h"
#include "VersionCheck.h"
#include "ViewCert.h"
+#include "ConversionHelpers.h"
#define ACTOR_INIT \
ClientUser *pSrc=NULL; \
@@ -72,9 +73,6 @@
ClientUser *pSelf = ClientUser::get(g.uiSession);
-void MainWindow::msgAuthenticate(const MumbleProto::Authenticate &) {
-}
-
void MainWindow::msgBanList(const MumbleProto::BanList &msg) {
if (banEdit) {
banEdit->reject();
@@ -238,9 +236,6 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
}
}
-void MainWindow::msgUDPTunnel(const MumbleProto::UDPTunnel &) {
-}
-
void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
ACTOR_INIT;
SELF_INIT;
@@ -614,9 +609,6 @@ void MainWindow::msgQueryUsers(const MumbleProto::QueryUsers &msg) {
aclEdit->returnQuery(msg);
}
-void MainWindow::msgPing(const MumbleProto::Ping &) {
-}
-
void MainWindow::msgCryptSetup(const MumbleProto::CryptSetup &msg) {
ConnectionPtr c= g.sh->cConnection;
if (! c)
@@ -640,9 +632,6 @@ void MainWindow::msgCryptSetup(const MumbleProto::CryptSetup &msg) {
}
}
-void MainWindow::msgContextAction(const MumbleProto::ContextAction &) {
-}
-
void MainWindow::msgContextActionModify(const MumbleProto::ContextActionModify &msg) {
if (msg.has_operation() && msg.operation() == MumbleProto::ContextActionModify_Operation_Remove) {
removeContextAction(msg);
@@ -704,9 +693,6 @@ void MainWindow::msgUserList(const MumbleProto::UserList &msg) {
userEdit->show();
}
-void MainWindow::msgVoiceTarget(const MumbleProto::VoiceTarget &) {
-}
-
void MainWindow::msgPermissionQuery(const MumbleProto::PermissionQuery &msg) {
Channel *current = pmModel->getChannel(qtvUsers->currentIndex());
@@ -789,9 +775,6 @@ void MainWindow::msgUserStats(const MumbleProto::UserStats &msg) {
}
}
-void MainWindow::msgRequestBlob(const MumbleProto::RequestBlob &) {
-}
-
void MainWindow::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) {
if (msg.has_version() && (msg.version() > MumbleVersion::getRaw())) {
g.l->log(Log::Warning, tr("The server requests minimum client version %1").arg(MumbleVersion::toString(msg.version())));
diff --git a/src/mumble/MessageHandler.cpp b/src/mumble/MessageHandler.cpp
new file mode 100644
index 000000000..0882f9a33
--- /dev/null
+++ b/src/mumble/MessageHandler.cpp
@@ -0,0 +1,176 @@
+/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
+ Copyright (C) 2009-2011, Stefan Hacker <dd0t@users.sourceforge.net>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "mumble_pch.hpp"
+
+#include "MessageHandler.h"
+#include "ServerHandler.h"
+#include "Global.h"
+
+MessageHandler::MessageHandler(QObject *parent) : QObject(parent) {}
+
+void MessageHandler::customEvent(QEvent *evt) {
+ if (evt->type() != SERVERSEND_EVENT) {
+ return;
+ }
+
+ ServerHandlerMessageEvent *shme=static_cast<ServerHandlerMessageEvent *>(evt);
+
+#ifdef QT_NO_DEBUG
+#define MUMBLE_MH_MSG(x) case MessageHandler:: x : { \
+ MumbleProto:: x msg; \
+ if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) \
+ msg##x(msg); \
+ break; \
+ }
+#else
+#define MUMBLE_MH_MSG(x) case MessageTypes:: x : { \
+ MumbleProto:: x msg; \
+ if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) { \
+ printf("%s:\n", #x); \
+ msg.PrintDebugString(); \
+ msg##x(msg); \
+ } \
+ break; \
+ }
+#endif
+ switch (shme->uiType) {
+ MUMBLE_MH_ALL
+ }
+
+
+#undef MUMBLE_MH_MSG
+}
+
+void MessageHandler::msgAuthenticate(const MumbleProto::Authenticate &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgBanList(const MumbleProto::BanList &msg) {
+ g.mw->msgBanList(msg);
+}
+
+void MessageHandler::msgReject(const MumbleProto::Reject &msg) {
+ g.mw->msgReject(msg);
+}
+
+void MessageHandler::msgServerSync(const MumbleProto::ServerSync &msg) {
+ g.mw->msgServerSync(msg);
+}
+
+
+void MessageHandler::msgServerConfig(const MumbleProto::ServerConfig &msg) {
+ g.mw->msgServerConfig(msg);
+}
+
+void MessageHandler::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
+ g.mw->msgPermissionDenied(msg);
+}
+
+void MessageHandler::msgUDPTunnel(const MumbleProto::UDPTunnel &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgUserState(const MumbleProto::UserState &msg) {
+ g.mw->msgUserState(msg);
+}
+
+void MessageHandler::msgUserRemove(const MumbleProto::UserRemove &msg) {
+ g.mw->msgUserRemove(msg);
+}
+
+void MessageHandler::msgChannelState(const MumbleProto::ChannelState &msg) {
+ g.mw->msgChannelState(msg);
+}
+
+void MessageHandler::msgChannelRemove(const MumbleProto::ChannelRemove &msg) {
+ g.mw->msgChannelRemove(msg);
+}
+
+void MessageHandler::msgTextMessage(const MumbleProto::TextMessage &msg) {
+ g.mw->msgTextMessage(msg);
+}
+
+void MessageHandler::msgACL(const MumbleProto::ACL &msg) {
+ g.mw->msgACL(msg);
+}
+
+void MessageHandler::msgQueryUsers(const MumbleProto::QueryUsers &msg) {
+ g.mw->msgQueryUsers(msg);
+}
+
+void MessageHandler::msgPing(const MumbleProto::Ping &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgCryptSetup(const MumbleProto::CryptSetup &msg) {
+ g.mw->msgCryptSetup(msg);
+}
+
+void MessageHandler::msgContextAction(const MumbleProto::ContextAction &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgContextActionModify(const MumbleProto::ContextActionModify &msg) {
+ g.mw->msgContextActionModify(msg);
+}
+
+void MessageHandler::msgVersion(const MumbleProto::Version &msg) {
+ g.mw->msgVersion(msg);
+}
+
+void MessageHandler::msgUserList(const MumbleProto::UserList &msg) {
+ g.mw->msgUserList(msg);
+}
+
+void MessageHandler::msgVoiceTarget(const MumbleProto::VoiceTarget &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgPermissionQuery(const MumbleProto::PermissionQuery &msg) {
+ g.mw->msgPermissionQuery(msg);
+}
+
+void MessageHandler::msgCodecVersion(const MumbleProto::CodecVersion &msg) {
+ g.mw->msgCodecVersion(msg);
+}
+
+void MessageHandler::msgUserStats(const MumbleProto::UserStats &msg) {
+ g.mw->msgUserStats(msg);
+}
+
+void MessageHandler::msgRequestBlob(const MumbleProto::RequestBlob &) {
+ // Not handled on client
+}
+
+void MessageHandler::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) {
+ g.mw->msgSuggestConfig(msg);
+}
diff --git a/src/mumble/MessageHandler.h b/src/mumble/MessageHandler.h
new file mode 100644
index 000000000..6d9520172
--- /dev/null
+++ b/src/mumble/MessageHandler.h
@@ -0,0 +1,71 @@
+/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MESSAGES_HANDLER_H_
+#define MESSAGES_HANDLER_H_
+
+#include <string>
+#include <QtCore/QCryptographicHash>
+#include <QtCore/QString>
+#include <QtCore/QObject>
+#include "Mumble.pb.h"
+#include "MainWindow.h"
+#include "MessageTypes.h"
+
+/**
+ * Handles message dispatching to callback functions defined
+ * in this message handler.
+ *
+ * @warning While this class definition is shared between client
+ * and server the implementation isn't. Make sure to not
+ * confuse the corresponding implementations in the
+ * mumble/ or murmur/ folders.
+ */
+class MessageHandler : public QObject {
+ private:
+ Q_OBJECT
+ Q_DISABLE_COPY(MessageHandler)
+
+ public:
+ MessageHandler(QObject *parent = 0);
+
+ private:
+ /**
+ * Dispatches incoming ServerHandlerMessageEvent's to the
+ * corresponding handler function defined in this class.
+ */
+ void customEvent(QEvent *);
+
+#define MUMBLE_MH_MSG(x) void msg##x(const MumbleProto:: x &);
+ MUMBLE_MH_ALL
+#undef MUMBLE_MH_MSG
+};
+
+#endif
diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp
index be6d37d86..5502a2a71 100644
--- a/src/mumble/Overlay.cpp
+++ b/src/mumble/Overlay.cpp
@@ -38,11 +38,12 @@
#include "Global.h"
#include "GlobalShortcut.h"
#include "MainWindow.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "OverlayText.h"
#include "ServerHandler.h"
#include "User.h"
#include "WebFetch.h"
+#include "ConversionHelpers.h"
OverlayAppInfo::OverlayAppInfo(QString name, QIcon icon) {
qsDisplayName = name;
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index 89743e379..5c62f3950 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -35,7 +35,7 @@
#include "User.h"
#include "Channel.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/OverlayConfig.cpp b/src/mumble/OverlayConfig.cpp
index 5fa0ec4a0..e8c9d83ca 100644
--- a/src/mumble/OverlayConfig.cpp
+++ b/src/mumble/OverlayConfig.cpp
@@ -35,7 +35,7 @@
#include "User.h"
#include "Channel.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/OverlayEditor.cpp b/src/mumble/OverlayEditor.cpp
index 0263c1fc3..dc637d2ef 100644
--- a/src/mumble/OverlayEditor.cpp
+++ b/src/mumble/OverlayEditor.cpp
@@ -35,7 +35,7 @@
#include "User.h"
#include "Channel.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/OverlayEditorScene.cpp b/src/mumble/OverlayEditorScene.cpp
index 95fe347cd..ef1a963ce 100644
--- a/src/mumble/OverlayEditorScene.cpp
+++ b/src/mumble/OverlayEditorScene.cpp
@@ -35,7 +35,7 @@
#include "User.h"
#include "Channel.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/OverlayUser.cpp b/src/mumble/OverlayUser.cpp
index 979af17f5..2c644761a 100644
--- a/src/mumble/OverlayUser.cpp
+++ b/src/mumble/OverlayUser.cpp
@@ -36,7 +36,7 @@
#include "Channel.h"
#include "ClientUser.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/OverlayUserGroup.cpp b/src/mumble/OverlayUserGroup.cpp
index f8831d52d..85f7f9914 100644
--- a/src/mumble/OverlayUserGroup.cpp
+++ b/src/mumble/OverlayUserGroup.cpp
@@ -36,7 +36,7 @@
#include "Channel.h"
#include "ClientUser.h"
#include "Global.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Database.h"
#include "NetworkConfig.h"
#include "ServerHandler.h"
diff --git a/src/mumble/Plugins.cpp b/src/mumble/Plugins.cpp
index 61f3ac221..9139761ee 100644
--- a/src/mumble/Plugins.cpp
+++ b/src/mumble/Plugins.cpp
@@ -35,10 +35,11 @@
#include "Global.h"
#include "Log.h"
#include "MainWindow.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "ServerHandler.h"
#include "../../plugins/mumble_plugin.h"
#include "WebFetch.h"
+#include "ConversionHelpers.h"
static ConfigWidget *PluginConfigDialogNew(Settings &st) {
return new PluginConfig(st);
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 7aecffdd1..d30db3a06 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -39,12 +39,13 @@
#include "Database.h"
#include "Global.h"
#include "MainWindow.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "NetworkConfig.h"
#include "OSInfo.h"
#include "PacketDataStream.h"
#include "SSL.h"
#include "User.h"
+#include "ConversionHelpers.h"
ServerHandlerMessageEvent::ServerHandlerMessageEvent(const QByteArray &msg, unsigned int mtype, bool flush) : QEvent(static_cast<QEvent::Type>(SERVERSEND_EVENT)) {
qbaMsg = msg;
@@ -84,7 +85,10 @@ static HANDLE loadQoS() {
}
#endif
-ServerHandler::ServerHandler() {
+ServerHandler::ServerHandler()
+ : QThread()
+ , mhMessageHandler() {
+
cConnection.reset();
qusUdp = NULL;
bStrong = false;
@@ -179,20 +183,20 @@ void ServerHandler::udpReady() {
PacketDataStream pds(buffer + 1, buflen-5);
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((buffer[0] >> 5) & 0x7);
unsigned int msgFlags = buffer[0] & 0x1f;
switch (msgType) {
- case MessageHandler::UDPPing: {
+ case MessageTypes::UDPPing: {
quint64 t;
pds >> t;
accUDP(static_cast<double>(tTimestamp.elapsed() - t) / 1000.0);
}
break;
- case MessageHandler::UDPVoiceCELTAlpha:
- case MessageHandler::UDPVoiceCELTBeta:
- case MessageHandler::UDPVoiceSpeex:
- case MessageHandler::UDPVoiceOpus:
+ case MessageTypes::UDPVoiceCELTAlpha:
+ case MessageTypes::UDPVoiceCELTBeta:
+ case MessageTypes::UDPVoiceSpeex:
+ case MessageTypes::UDPVoiceOpus:
handleVoicePacket(msgFlags, pds, msgType);
break;
default:
@@ -201,7 +205,7 @@ void ServerHandler::udpReady() {
}
}
-void ServerHandler::handleVoicePacket(unsigned int msgFlags, PacketDataStream &pds, MessageHandler::UDPMessageType type) {
+void ServerHandler::handleVoicePacket(unsigned int msgFlags, PacketDataStream &pds, MessageTypes::UDPMessageType type) {
unsigned int uiSession;
pds >> uiSession;
ClientUser *p = ClientUser::get(uiSession);
@@ -232,11 +236,11 @@ void ServerHandler::sendMessage(const char *data, int len, bool force) {
qba.resize(len + 6);
unsigned char *uc = reinterpret_cast<unsigned char *>(qba.data());
- * reinterpret_cast<quint16 *>(& uc[0]) = qToBigEndian(static_cast<quint16>(MessageHandler::UDPTunnel));
+ * reinterpret_cast<quint16 *>(& uc[0]) = qToBigEndian(static_cast<quint16>(MessageTypes::UDPTunnel));
* reinterpret_cast<quint32 *>(& uc[2]) = qToBigEndian(static_cast<quint32>(len));
memcpy(uc + 6, data, len);
- QApplication::postEvent(this, new ServerHandlerMessageEvent(qba, MessageHandler::UDPTunnel, true));
+ QApplication::postEvent(this, new ServerHandlerMessageEvent(qba, MessageTypes::UDPTunnel, true));
} else {
cConnection->csCrypt.encrypt(reinterpret_cast<const unsigned char *>(data), crypto, len);
qusUdp->writeDatagram(reinterpret_cast<const char *>(crypto), len + 4, qhaRemote, usPort);
@@ -381,7 +385,7 @@ void ServerHandler::sendPing() {
if (qusUdp) {
unsigned char buffer[256];
PacketDataStream pds(buffer + 1, 255);
- buffer[0] = MessageHandler::UDPPing << 5;
+ buffer[0] = MessageTypes::UDPPing << 5;
pds << t;
sendMessage(reinterpret_cast<const char *>(buffer), pds.size() + 1, true);
}
@@ -412,25 +416,25 @@ void ServerHandler::sendPing() {
void ServerHandler::message(unsigned int msgType, const QByteArray &qbaMsg) {
const char *ptr = qbaMsg.constData();
- if (msgType == MessageHandler::UDPTunnel) {
+ if (msgType == MessageTypes::UDPTunnel) {
if (qbaMsg.length() < 1)
return;
- MessageHandler::UDPMessageType umsgType = static_cast<MessageHandler::UDPMessageType>((ptr[0] >> 5) & 0x7);
+ MessageTypes::UDPMessageType umsgType = static_cast<MessageTypes::UDPMessageType>((ptr[0] >> 5) & 0x7);
unsigned int msgFlags = ptr[0] & 0x1f;
PacketDataStream pds(qbaMsg.constData() + 1, qbaMsg.size());
switch (umsgType) {
- case MessageHandler::UDPVoiceCELTAlpha:
- case MessageHandler::UDPVoiceCELTBeta:
- case MessageHandler::UDPVoiceSpeex:
- case MessageHandler::UDPVoiceOpus:
+ case MessageTypes::UDPVoiceCELTAlpha:
+ case MessageTypes::UDPVoiceCELTBeta:
+ case MessageTypes::UDPVoiceSpeex:
+ case MessageTypes::UDPVoiceOpus:
handleVoicePacket(msgFlags, pds, umsgType);
break;
default:
break;
}
- } else if (msgType == MessageHandler::Ping) {
+ } else if (msgType == MessageTypes::Ping) {
MumbleProto::Ping msg;
if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) {
CryptState &cs = cConnection->csCrypt;
@@ -463,7 +467,7 @@ void ServerHandler::message(unsigned int msgType, const QByteArray &qbaMsg) {
}
} else {
ServerHandlerMessageEvent *shme=new ServerHandlerMessageEvent(qbaMsg, msgType, false);
- QApplication::postEvent(g.mw, shme);
+ QApplication::postEvent(&mhMessageHandler, shme);
}
}
diff --git a/src/mumble/ServerHandler.h b/src/mumble/ServerHandler.h
index 459239830..47ba0c2e9 100644
--- a/src/mumble/ServerHandler.h
+++ b/src/mumble/ServerHandler.h
@@ -53,7 +53,7 @@
#define SERVERSEND_EVENT 3501
#include "Timer.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Mumble.pb.h"
class Connection;
@@ -76,6 +76,9 @@ class ServerHandler : public QThread {
private:
Q_OBJECT
Q_DISABLE_COPY(ServerHandler)
+
+ MessageHandler mhMessageHandler;
+
protected:
QString qsHostName;
QString qsUserName;
@@ -93,7 +96,7 @@ class ServerHandler : public QThread {
QUdpSocket *qusUdp;
QMutex qmUdp;
- void handleVoicePacket(unsigned int msgFlags, PacketDataStream &pds, MessageHandler::UDPMessageType type);
+ void handleVoicePacket(unsigned int msgFlags, PacketDataStream &pds, MessageTypes::UDPMessageType type);
public:
Timer tTimestamp;
QTimer *tConnectionTimeoutTimer;
@@ -121,7 +124,7 @@ class ServerHandler : public QThread {
void sendProtoMessage(const ::google::protobuf::Message &msg, unsigned int msgType);
void sendMessage(const char *data, int len, bool force = false);
-#define MUMBLE_MH_MSG(x) void sendMessage(const MumbleProto:: x &msg) { sendProtoMessage(msg, MessageHandler:: x); }
+#define MUMBLE_MH_MSG(x) void sendMessage(const MumbleProto:: x &msg) { sendProtoMessage(msg, MessageTypes:: x); }
MUMBLE_MH_ALL
#undef MUMBLE_MH_MSG
diff --git a/src/mumble/Tokens.cpp b/src/mumble/Tokens.cpp
index 777ffc3e1..5e565842a 100644
--- a/src/mumble/Tokens.cpp
+++ b/src/mumble/Tokens.cpp
@@ -35,6 +35,7 @@
#include "Database.h"
#include "Global.h"
#include "ServerHandler.h"
+#include "ConversionHelpers.h"
Tokens::Tokens(QWidget *p) : QDialog(p) {
setupUi(this);
diff --git a/src/mumble/UserEdit.cpp b/src/mumble/UserEdit.cpp
index 9d7f456e2..9430facc9 100644
--- a/src/mumble/UserEdit.cpp
+++ b/src/mumble/UserEdit.cpp
@@ -35,6 +35,7 @@
#include "Global.h"
#include "ServerHandler.h"
#include "User.h"
+#include "ConversionHelpers.h"
UserEdit::UserEdit(const MumbleProto::UserList &msg, QWidget *p) : QDialog(p) {
setupUi(this);
diff --git a/src/mumble/UserEdit.h b/src/mumble/UserEdit.h
index 3e763827d..9a4d2fb33 100644
--- a/src/mumble/UserEdit.h
+++ b/src/mumble/UserEdit.h
@@ -31,7 +31,7 @@
#ifndef USEREDIT_H_
#define USEREDIT_H_
-#include "Message.h"
+#include "MessageHandler.h"
#include "ui_UserEdit.h"
diff --git a/src/mumble/UserInformation.cpp b/src/mumble/UserInformation.cpp
index 6da8b80ee..583e1497f 100644
--- a/src/mumble/UserInformation.cpp
+++ b/src/mumble/UserInformation.cpp
@@ -38,6 +38,7 @@
#include "Net.h"
#include "ServerHandler.h"
#include "ViewCert.h"
+#include "ConversionHelpers.h"
static QString decode_utf8_qssl_string(const QString &input) {
QString i = input;
diff --git a/src/mumble/UserInformation.h b/src/mumble/UserInformation.h
index 71e190b5d..4ab115b4d 100644
--- a/src/mumble/UserInformation.h
+++ b/src/mumble/UserInformation.h
@@ -33,7 +33,7 @@
#include <QtNetwork/QSslCertificate>
-#include "Message.h"
+#include "MessageHandler.h"
#include "ui_UserInformation.h"
diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp
index a702e9d8d..d95cd4d1f 100644
--- a/src/mumble/UserModel.cpp
+++ b/src/mumble/UserModel.cpp
@@ -40,11 +40,12 @@
#include "LCD.h"
#include "Log.h"
#include "MainWindow.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Overlay.h"
#include "ServerHandler.h"
#include "Usage.h"
#include "User.h"
+#include "ConversionHelpers.h"
QHash <Channel *, ModelItem *> ModelItem::c_qhChannels;
QHash <ClientUser *, ModelItem *> ModelItem::c_qhUsers;
diff --git a/src/mumble/mumble.pro b/src/mumble/mumble.pro
index 89f08956e..3bdd457a7 100644
--- a/src/mumble/mumble.pro
+++ b/src/mumble/mumble.pro
@@ -4,8 +4,8 @@ DEFINES *= MUMBLE
TEMPLATE = app
QT *= network sql xml svg
TARGET = mumble
-HEADERS *= BanEditor.h ACLEditor.h ConfigWidget.h Log.h AudioConfigDialog.h AudioStats.h AudioInput.h AudioOutput.h AudioOutputSample.h AudioOutputSpeech.h AudioOutputUser.h CELTCodec.h CustomElements.h MainWindow.h ServerHandler.h About.h ConnectDialog.h GlobalShortcut.h TextToSpeech.h Settings.h Database.h VersionCheck.h Global.h UserModel.h Audio.h ConfigDialog.h Plugins.h PTTButtonWidget.h LookConfig.h Overlay.h OverlayText.h SharedMemory.h AudioWizard.h ViewCert.h TextMessage.h NetworkConfig.h LCD.h Usage.h Cert.h ClientUser.h UserEdit.h Tokens.h UserView.h RichTextEditor.h UserInformation.h FileEngine.h SocketRPC.h VoiceRecorder.h VoiceRecorderDialog.h WebFetch.h ../SignalCurry.h
-SOURCES *= BanEditor.cpp ACLEditor.cpp ConfigWidget.cpp Log.cpp AudioConfigDialog.cpp AudioStats.cpp AudioInput.cpp AudioOutput.cpp AudioOutputSample.cpp AudioOutputSpeech.cpp AudioOutputUser.cpp main.cpp CELTCodec.cpp CustomElements.cpp MainWindow.cpp ServerHandler.cpp About.cpp ConnectDialog.cpp Settings.cpp Database.cpp VersionCheck.cpp Global.cpp UserModel.cpp Audio.cpp ConfigDialog.cpp Plugins.cpp PTTButtonWidget.cpp LookConfig.cpp OverlayClient.cpp OverlayConfig.cpp OverlayEditor.cpp OverlayEditorScene.cpp OverlayUser.cpp OverlayUserGroup.cpp Overlay.cpp OverlayText.cpp SharedMemory.cpp AudioWizard.cpp ViewCert.cpp Messages.cpp TextMessage.cpp GlobalShortcut.cpp NetworkConfig.cpp LCD.cpp Usage.cpp Cert.cpp ClientUser.cpp UserEdit.cpp Tokens.cpp UserView.cpp RichTextEditor.cpp UserInformation.cpp FileEngine.cpp SocketRPC.cpp VoiceRecorder.cpp VoiceRecorderDialog.cpp WebFetch.cpp
+HEADERS *= BanEditor.h ACLEditor.h ConfigWidget.h Log.h AudioConfigDialog.h AudioStats.h AudioInput.h AudioOutput.h AudioOutputSample.h AudioOutputSpeech.h AudioOutputUser.h CELTCodec.h CustomElements.h MainWindow.h MessageHandler.h ServerHandler.h About.h ConnectDialog.h GlobalShortcut.h TextToSpeech.h Settings.h Database.h VersionCheck.h Global.h UserModel.h Audio.h ConfigDialog.h Plugins.h PTTButtonWidget.h LookConfig.h Overlay.h OverlayText.h SharedMemory.h AudioWizard.h ViewCert.h TextMessage.h NetworkConfig.h LCD.h Usage.h Cert.h ClientUser.h UserEdit.h Tokens.h UserView.h RichTextEditor.h UserInformation.h FileEngine.h SocketRPC.h VoiceRecorder.h VoiceRecorderDialog.h WebFetch.h ../SignalCurry.h
+SOURCES *= BanEditor.cpp ACLEditor.cpp ConfigWidget.cpp Log.cpp AudioConfigDialog.cpp AudioStats.cpp AudioInput.cpp AudioOutput.cpp AudioOutputSample.cpp AudioOutputSpeech.cpp AudioOutputUser.cpp main.cpp CELTCodec.cpp CustomElements.cpp MainWindow.cpp MainWindowMessages.cpp ServerHandler.cpp About.cpp ConnectDialog.cpp Settings.cpp Database.cpp VersionCheck.cpp Global.cpp UserModel.cpp Audio.cpp ConfigDialog.cpp Plugins.cpp PTTButtonWidget.cpp LookConfig.cpp OverlayClient.cpp OverlayConfig.cpp OverlayEditor.cpp OverlayEditorScene.cpp OverlayUser.cpp OverlayUserGroup.cpp Overlay.cpp OverlayText.cpp SharedMemory.cpp AudioWizard.cpp ViewCert.cpp MessageHandler.cpp TextMessage.cpp GlobalShortcut.cpp NetworkConfig.cpp LCD.cpp Usage.cpp Cert.cpp ClientUser.cpp UserEdit.cpp Tokens.cpp UserView.cpp RichTextEditor.cpp UserInformation.cpp FileEngine.cpp SocketRPC.cpp VoiceRecorder.cpp VoiceRecorderDialog.cpp WebFetch.cpp
SOURCES *= smallft.cpp
DIST *= ../../icons/mumble.ico licenses.h smallft.h ../../icons/mumble.xpm murmur_pch.h mumble.plist
RESOURCES *= mumble.qrc mumble_flags.qrc
diff --git a/src/murmur/DBus.cpp b/src/murmur/DBus.cpp
index 702f34fd7..3787f9484 100644
--- a/src/murmur/DBus.cpp
+++ b/src/murmur/DBus.cpp
@@ -33,7 +33,7 @@
#include "DBus.h"
#include "Connection.h"
-#include "Message.h"
+#include "MessageHandler.h"
#include "Server.h"
#include "ServerUser.h"
#include "ServerDB.h"
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp
index c0c108a9f..ed0fda90c 100644
--- a/src/murmur/Messages.cpp
+++ b/src/murmur/Messages.cpp
@@ -35,12 +35,12 @@
#include "Channel.h"
#include "ACL.h"
#include "Group.h"
-#include "Message.h"
#include "ServerDB.h"
#include "Connection.h"
#include "Server.h"
#include "ServerUser.h"
#include "Version.h"
+#include "ConversionHelpers.h"
#define MSG_SETUP(st) \
if (uSource->sState != st) { \
diff --git a/src/murmur/MurmurIce.cpp b/src/murmur/MurmurIce.cpp
index a9f1bd840..f41c2ecce 100644
--- a/src/murmur/MurmurIce.cpp
+++ b/src/murmur/MurmurIce.cpp
@@ -44,6 +44,7 @@
#include "ServerUser.h"
#include "ServerDB.h"
#include "User.h"
+#include "ConversionHelpers.h"
using namespace std;
using namespace Murmur;
diff --git a/src/murmur/RPC.cpp b/src/murmur/RPC.cpp
index d6c51e077..c616bcc13 100644
--- a/src/murmur/RPC.cpp
+++ b/src/murmur/RPC.cpp
@@ -37,6 +37,7 @@
#include "ServerDB.h"
#include "ServerUser.h"
#include "Version.h"
+#include "ConversionHelpers.h"
/*!
\fn void Server::setTempGroups(int userid, Channel *cChannel, const QStringList &groups)
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp
index b9ffdc4d9..832ed3b5b 100644
--- a/src/murmur/Server.cpp
+++ b/src/murmur/Server.cpp
@@ -38,11 +38,11 @@
#include "Group.h"
#include "User.h"
#include "Channel.h"
-#include "Message.h"
#include "Meta.h"
#include "PacketDataStream.h"
#include "ServerDB.h"
#include "ServerUser.h"
+#include "ConversionHelpers.h"
#ifdef USE_BONJOUR
#include "BonjourServer.h"
@@ -766,20 +766,20 @@ void Server::run() {
}
len -= 4;
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((buffer[0] >> 5) & 0x7);
switch (msgType) {
- case MessageHandler::UDPVoiceSpeex:
- case MessageHandler::UDPVoiceCELTAlpha:
- case MessageHandler::UDPVoiceCELTBeta:
+ case MessageTypes::UDPVoiceSpeex:
+ case MessageTypes::UDPVoiceCELTAlpha:
+ case MessageTypes::UDPVoiceCELTBeta:
if (bOpus)
break;
- case MessageHandler::UDPVoiceOpus: {
+ case MessageTypes::UDPVoiceOpus: {
u->bUdp = true;
processMsg(u, buffer, len);
break;
}
- case MessageHandler::UDPPing: {
+ case MessageTypes::UDPPing: {
QByteArray qba;
sendMessage(u, buffer, len, qba, true);
}
@@ -914,7 +914,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) {
pdi >> counter;
// Skip to the end of the voice data.
- if ((type >> 5) != MessageHandler::UDPVoiceOpus) {
+ if ((type >> 5) != MessageTypes::UDPVoiceOpus) {
do {
counter = pdi.next8();
pdi.skip(counter & 0x7f);
@@ -1264,7 +1264,7 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
u->resetActivityTime();
}
- if (uiType == MessageHandler::UDPTunnel) {
+ if (uiType == MessageTypes::UDPTunnel) {
int l = qbaMsg.size();
if (l < 2)
return;
@@ -1275,15 +1275,15 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
const char *buffer = qbaMsg.constData();
- MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7);
+ MessageTypes::UDPMessageType msgType = static_cast<MessageTypes::UDPMessageType>((buffer[0] >> 5) & 0x7);
switch (msgType) {
- case MessageHandler::UDPVoiceCELTAlpha:
- case MessageHandler::UDPVoiceCELTBeta:
- case MessageHandler::UDPVoiceSpeex:
+ case MessageTypes::UDPVoiceCELTAlpha:
+ case MessageTypes::UDPVoiceCELTBeta:
+ case MessageTypes::UDPVoiceSpeex:
if (bOpus)
break;
- case MessageHandler::UDPVoiceOpus:
+ case MessageTypes::UDPVoiceOpus:
processMsg(u, buffer, l);
break;
default:
@@ -1294,7 +1294,7 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
}
#ifdef QT_NO_DEBUG
-#define MUMBLE_MH_MSG(x) case MessageHandler:: x : { \
+#define MUMBLE_MH_MSG(x) case MessageTypes:: x : { \
MumbleProto:: x msg; \
if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) { \
msg.DiscardUnknownFields(); \
@@ -1303,10 +1303,10 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
break; \
}
#else
-#define MUMBLE_MH_MSG(x) case MessageHandler:: x : { \
+#define MUMBLE_MH_MSG(x) case MessageTypes:: x : { \
MumbleProto:: x msg; \
if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) { \
- if (uiType != MessageHandler::Ping) { \
+ if (uiType != MessageTypes::Ping) { \
printf("== %s:\n", #x); \
msg.PrintDebugString(); \
} \
@@ -1345,7 +1345,7 @@ void Server::tcpTransmitData(QByteArray a, unsigned int id) {
qba.resize(len + 6);
unsigned char *uc = reinterpret_cast<unsigned char *>(qba.data());
- * reinterpret_cast<quint16 *>(& uc[0]) = qToBigEndian(static_cast<quint16>(MessageHandler::UDPTunnel));
+ * reinterpret_cast<quint16 *>(& uc[0]) = qToBigEndian(static_cast<quint16>(MessageTypes::UDPTunnel));
* reinterpret_cast<quint32 *>(& uc[2]) = qToBigEndian(static_cast<quint32>(len));
memcpy(uc + 6, a.constData(), len);
diff --git a/src/murmur/Server.h b/src/murmur/Server.h
index bbd4757f9..228d3eb12 100644
--- a/src/murmur/Server.h
+++ b/src/murmur/Server.h
@@ -51,7 +51,7 @@
#endif
#include "ACL.h"
-#include "Message.h"
+#include "MessageTypes.h"
#include "Mumble.pb.h"
#include "Net.h"
#include "Timer.h"
@@ -250,9 +250,9 @@ class Server : public QThread {
// sendAll sends a protobuf message to all users on the server whose version is either bigger than v or
// lower than ~v. If v == 0 the message is sent to everyone.
#define MUMBLE_MH_MSG(x) \
- void sendAll(const MumbleProto:: x &msg, unsigned int v = 0) { sendProtoAll(msg, MessageHandler:: x, v); } \
- void sendExcept(ServerUser *u, const MumbleProto:: x &msg, unsigned int v = 0) { sendProtoExcept(u, msg, MessageHandler:: x, v); } \
- void sendMessage(ServerUser *u, const MumbleProto:: x &msg) { sendProtoMessage(u, msg, MessageHandler:: x); }
+ void sendAll(const MumbleProto:: x &msg, unsigned int v = 0) { sendProtoAll(msg, MessageTypes:: x, v); } \
+ void sendExcept(ServerUser *u, const MumbleProto:: x &msg, unsigned int v = 0) { sendProtoExcept(u, msg, MessageTypes:: x, v); } \
+ void sendMessage(ServerUser *u, const MumbleProto:: x &msg) { sendProtoMessage(u, msg, MessageTypes:: x); }
MUMBLE_MH_ALL
#undef MUMBLE_MH_MSG
diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp
index aaac7d762..dd217f9e2 100644
--- a/src/murmur/ServerDB.cpp
+++ b/src/murmur/ServerDB.cpp
@@ -41,6 +41,7 @@
#include "Server.h"
#include "ServerUser.h"
#include "User.h"
+#include "ConversionHelpers.h"
#define SQLDO(x) ServerDB::exec(query, QLatin1String(x), true)
#define SQLMAY(x) ServerDB::exec(query, QLatin1String(x), false, false)