diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2012-07-31 15:00:22 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2012-08-04 16:32:01 +0400 |
commit | 22fd0a1022a6e29c8907097d1ee94daa36555bf1 (patch) | |
tree | ba2557e334854ee7095d48c53c3947bac6b670e5 | |
parent | 892796f18ab7f73352a6095dc9f67dc761b76284 (diff) |
CodecVersion msg is MainWindow independent
-rw-r--r-- | src/mumble/MainWindow.h | 1 | ||||
-rw-r--r-- | src/mumble/MainWindowMessages.cpp | 42 | ||||
-rw-r--r-- | src/mumble/MessageHandler.cpp | 40 |
3 files changed, 39 insertions, 44 deletions
diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 854156887..731815f7b 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -266,7 +266,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { 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 removeContextAction(const MumbleProto::ContextActionModify &msg); }; diff --git a/src/mumble/MainWindowMessages.cpp b/src/mumble/MainWindowMessages.cpp index 3afcf087d..db5e5ba41 100644 --- a/src/mumble/MainWindowMessages.cpp +++ b/src/mumble/MainWindowMessages.cpp @@ -674,48 +674,6 @@ void MainWindow::msgPermissionQuery(const MumbleProto::PermissionQuery &msg) { } } -void MainWindow::msgCodecVersion(const MumbleProto::CodecVersion &msg) { - int alpha = msg.has_alpha() ? msg.alpha() : -1; - int beta = msg.has_beta() ? msg.beta() : -1; - bool pref = msg.prefer_alpha(); - -#ifdef USE_OPUS - g.bOpus = msg.opus(); -#endif - - // Workaround for broken 1.2.2 servers - if (g.sh && g.sh->uiVersion == 0x010202 && alpha != -1 && alpha == beta) { - if (pref) - beta = g.iCodecBeta; - else - alpha = g.iCodecAlpha; - } - - if ((alpha != -1) && (alpha != g.iCodecAlpha)) { - g.iCodecAlpha = alpha; - if (pref && ! g.qmCodecs.contains(alpha)) - pref = ! pref; - } - if ((beta != -1) && (beta != g.iCodecBeta)) { - g.iCodecBeta = beta; - if (! pref && ! g.qmCodecs.contains(beta)) - pref = ! pref; - } - g.bPreferAlpha = pref; - - int willuse = pref ? g.iCodecAlpha : g.iCodecBeta; - - static bool warned = false; - - if (! g.qmCodecs.contains(willuse)) { - if (! warned) { - g.l->log(Log::CriticalError, tr("Unable to find matching CELT codecs with other clients. You will not be able to talk to all users.")); - warned = true; - } - } else { - warned = false; - } -} void MainWindow::msgUserStats(const MumbleProto::UserStats &msg) { UserInformation *ui = qmUserInformations.value(msg.session()); diff --git a/src/mumble/MessageHandler.cpp b/src/mumble/MessageHandler.cpp index 76fda283e..f3e058232 100644 --- a/src/mumble/MessageHandler.cpp +++ b/src/mumble/MessageHandler.cpp @@ -221,7 +221,45 @@ void MessageHandler::msgPermissionQuery(const MumbleProto::PermissionQuery &msg) } void MessageHandler::msgCodecVersion(const MumbleProto::CodecVersion &msg) { - g.mw->msgCodecVersion(msg); + int alpha = msg.has_alpha() ? msg.alpha() : -1; + int beta = msg.has_beta() ? msg.beta() : -1; + bool pref = msg.prefer_alpha(); + +#ifdef USE_OPUS + g.bOpus = msg.opus(); +#endif + // Workaround for broken 1.2.2 servers + if (g.sh && g.sh->uiVersion == 0x010202 && alpha != -1 && alpha == beta) { + if (pref) + beta = g.iCodecBeta; + else + alpha = g.iCodecAlpha; + } + + if ((alpha != -1) && (alpha != g.iCodecAlpha)) { + g.iCodecAlpha = alpha; + if (pref && ! g.qmCodecs.contains(alpha)) + pref = ! pref; + } + if ((beta != -1) && (beta != g.iCodecBeta)) { + g.iCodecBeta = beta; + if (! pref && ! g.qmCodecs.contains(beta)) + pref = ! pref; + } + g.bPreferAlpha = pref; + + int willuse = pref ? g.iCodecAlpha : g.iCodecBeta; + + static bool warned = false; + + if (! g.qmCodecs.contains(willuse)) { + if (! warned) { + g.l->log(Log::CriticalError, tr("Unable to find matching CELT codecs with other clients. You will not be able to talk to all users.")); + warned = true; + } + } else { + warned = false; + } } void MessageHandler::msgUserStats(const MumbleProto::UserStats &msg) { |