diff options
-rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 31 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/feature_request.md | 20 | ||||
-rw-r--r-- | .github/no-response.yml | 14 | ||||
-rw-r--r-- | src/Group.cpp | 4 | ||||
-rw-r--r-- | src/Group.h | 3 | ||||
-rw-r--r-- | src/mumble/Audio.cpp | 9 | ||||
-rw-r--r-- | src/mumble/Log.cpp | 31 | ||||
-rw-r--r-- | src/mumble/Log.h | 27 | ||||
-rw-r--r-- | src/mumble/main.cpp | 10 | ||||
-rw-r--r-- | src/mumble/mumble_en.ts | 7 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 1 |
11 files changed, 150 insertions, 7 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..4b97b1045 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Steps to Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. Windows 10] + - Version: [e.g. Mumble 1.3 or Murmur 1.3] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..02749a60f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Context ** +In which context would you expect your suggested feature to be useful? + +**Describe the feature you have in mind** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 000000000..627bd6712 --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,14 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 30 + +# Label requiring a response +responseRequiredLabel: needs-more-input + +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: | + This issue has been automatically closed because there has been no response to our request for more information. + With only the information that is currently in the issue, we don't have enough information to take action. + + Please reach out if you have or find the answers we need so that we can investigate further (or if you feel like this issue shouldn't be closed for another reason). diff --git a/src/Group.cpp b/src/Group.cpp index 7f38ef65d..cf886209d 100644 --- a/src/Group.cpp +++ b/src/Group.cpp @@ -13,6 +13,8 @@ #include <QtCore/QStack> #endif +const Qt::CaseSensitivity Group::accessTokenCaseSensitivity = Qt::CaseInsensitive; + Group::Group(Channel *assoc, const QString &name) { c = assoc; bInherit = true; @@ -141,7 +143,7 @@ bool Group::isMember(Channel *curChan, Channel *aclChan, QString name, ServerUse } if (token) - m = pl->qslAccessTokens.contains(name, Qt::CaseInsensitive); + m = pl->qslAccessTokens.contains(name, Group::accessTokenCaseSensitivity); else if (hash) m = pl->qsHash == name; else if (name == QLatin1String("none")) diff --git a/src/Group.h b/src/Group.h index 22210d4c1..a4b0546a2 100644 --- a/src/Group.h +++ b/src/Group.h @@ -16,6 +16,9 @@ class Group { private: Q_DISABLE_COPY(Group) public: + /// A flag indicatig whether access tokens shall be treated case-sensitive or case-insensitive + static const Qt::CaseSensitivity accessTokenCaseSensitivity; + Channel *c; QString qsName; bool bInherit; diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp index f56d04642..3dc0548c8 100644 --- a/src/mumble/Audio.cpp +++ b/src/mumble/Audio.cpp @@ -11,8 +11,13 @@ #ifdef USE_OPUS # include "OpusCodec.h" #endif -#include "Global.h" #include "PacketDataStream.h" +#include "Log.h" + +#include <QtCore/QObject> + +// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include. +#include "Global.h" class CodecInit : public DeferInit { public: @@ -32,7 +37,7 @@ void CodecInit::initialize() { oCodec->report(); g.oCodec = oCodec; } else { - qWarning("CodecInit: Failed to load Opus, it will not be available for encoding/decoding audio."); + Log::logOrDefer(Log::CriticalError, QObject::tr("CodecInit: Failed to load Opus, it will not be available for encoding/decoding audio.")); delete oCodec; } #endif diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index c208c24fc..fca6fcba5 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -24,6 +24,7 @@ #include <QtGui/QTextBlock> #include <QtGui/QTextDocumentFragment> #include <QtWidgets/QDesktopWidget> +#include <QtCore/QMutexLocker> // We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include. #include "Global.h" @@ -205,6 +206,10 @@ void LogConfig::browseForAudioFile() { } } +QMutex Log::qmDeferredLogs; +QVector<LogMessage> Log::qvDeferredLogs; + + Log::Log(QObject *p) : QObject(p) { #ifndef USE_NO_TTS tts = new TextToSpeech(this); @@ -303,6 +308,18 @@ QString Log::formatChannel(::Channel *c) { return QString::fromLatin1("<a href='channelid://%1/%3' class='log-channel'>%2</a>").arg(c->iId).arg(c->qsName.toHtmlEscaped()).arg(QString::fromLatin1(g.sh->qbaDigest.toBase64())); } +void Log::logOrDefer(Log::MsgType mt, const QString &console, const QString &terse, bool ownMessage, const QString &overrideTTS) { + if (g.l) { + // log directly as it seems the log-UI has been set-up already + g.l->log(mt, console, terse, ownMessage, overrideTTS); + } else { + // defer the log + QMutexLocker mLock(&Log::qmDeferredLogs); + + qvDeferredLogs.append(LogMessage(mt, console, terse, ownMessage, overrideTTS)); + } +} + QString Log::formatClientUser(ClientUser *cu, LogColorType t, const QString &displayName) { QString className; if (t == Log::Target) { @@ -598,6 +615,16 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own #endif } +void Log::processDeferredLogs() { + QMutexLocker mLocker(&Log::qmDeferredLogs); + + while (!qvDeferredLogs.isEmpty()) { + LogMessage msg = qvDeferredLogs.takeFirst(); + + log(msg.mt, msg.console, msg.terse, msg.ownMessage, msg.overrideTTS); + } +} + // Post a notification using the MainWindow's QSystemTrayIcon. void Log::postQtNotification(MsgType mt, const QString &plain) { if (g.mw->qstiIcon->isSystemTrayAvailable() && g.mw->qstiIcon->supportsMessages()) { @@ -618,6 +645,10 @@ void Log::postQtNotification(MsgType mt, const QString &plain) { } } +LogMessage::LogMessage(Log::MsgType mt, const QString &console, const QString &terse, bool ownMessage, const QString &overrideTTS) : mt(mt), console(console), + terse(terse), ownMessage(ownMessage), overrideTTS(overrideTTS) { +} + LogDocument::LogDocument(QObject *p) : QTextDocument(p) { } diff --git a/src/mumble/Log.h b/src/mumble/Log.h index 93df96177..9ed136097 100644 --- a/src/mumble/Log.h +++ b/src/mumble/Log.h @@ -7,6 +7,8 @@ #define MUMBLE_MUMBLE_LOG_H_ #include <QtCore/QDate> +#include <QtCore/QMutex> +#include <QtCore/QVector> #include <QtGui/QTextCursor> #include <QtGui/QTextDocument> @@ -39,6 +41,7 @@ class LogConfig : public ConfigWidget, public Ui::LogConfig { class ClientUser; class Channel; +class LogMessage; class Log : public QObject { friend class LogConfig; @@ -55,6 +58,11 @@ class Log : public QObject { static const MsgType msgOrder[]; protected: + /// Mutex for qvDeferredLogs + static QMutex qmDeferredLogs; + /// A vector containing deferred log messages + static QVector<LogMessage> qvDeferredLogs; + QHash<MsgType, int> qmIgnore; static const char *msgNames[]; static const char *colorClasses[]; @@ -77,8 +85,25 @@ class Log : public QObject { static QString msgColor(const QString &text, LogColorType t); static QString formatClientUser(ClientUser *cu, LogColorType t, const QString &displayName=QString()); static QString formatChannel(::Channel *c); + /// Either defers the LogMessage or defers it, depending on whether Global::l is created already + /// (if it is, it is used to directly log the msg) + static void logOrDefer(Log::MsgType mt, const QString &console, const QString &terse=QString(), bool ownMessage = false, const QString &overrideTTS=QString()); public slots: - void log(MsgType t, const QString &console, const QString &terse=QString(), bool ownMessage = false, const QString &overrideTTS=QString()); + void log(MsgType mt, const QString &console, const QString &terse=QString(), bool ownMessage = false, const QString &overrideTTS=QString()); + /// Logs LogMessages that have been deferred so far + void processDeferredLogs(); +}; + +class LogMessage { + public: + Log::MsgType mt; + QString console; + QString terse; + bool ownMessage; + QString overrideTTS; + + LogMessage() = default; + LogMessage(Log::MsgType mt, const QString &console, const QString &terse, bool ownMessage, const QString &overrideTTS); }; class LogDocument : public QTextDocument { diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index 2365c21bd..2d8db3d5d 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -418,9 +418,6 @@ int main(int argc, char **argv) { delete cr; #endif - // Initialize logger - g.l = new Log(); - // Initialize database g.db = new Database(QLatin1String("main")); @@ -446,6 +443,13 @@ int main(int argc, char **argv) { g.mw=new MainWindow(NULL); g.mw->show(); + // Initialize logger + // Log::log() needs the MainWindow to already exist. Thus creating the Log instance + // before the MainWindow one, does not make sense. if you need logging before this + // point, use Log::logOrDefer() + g.l = new Log(); + g.l->processDeferredLogs(); + #ifdef Q_OS_WIN // Set mumble_mw_hwnd in os_win.cpp. // Used by APIs in ASIOInput and GlobalShortcut_win that require a HWND. diff --git a/src/mumble/mumble_en.ts b/src/mumble/mumble_en.ts index 8af200518..534b51cd4 100644 --- a/src/mumble/mumble_en.ts +++ b/src/mumble/mumble_en.ts @@ -6362,6 +6362,13 @@ To upgrade these files to their latest versions, click the button below.</source </message> </context> <context> + <name>QObject</name> + <message> + <source>CodecInit: Failed to load Opus, it will not be available for encoding/decoding audio.</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>RichTextEditor</name> <message> <source>Failed to load image</source> diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 271c2405e..7ca90067e 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -1364,6 +1364,7 @@ void Server::sslError(const QList<QSslError> &errors) { case QSslError::SelfSignedCertificate: case QSslError::SelfSignedCertificateInChain: case QSslError::UnableToGetLocalIssuerCertificate: + case QSslError::UnableToVerifyFirstCertificate: case QSslError::HostNameMismatch: case QSslError::CertificateNotYetValid: case QSslError::CertificateExpired: |