This PR streamlines the settings format on all OS and (hopefully) increases the readability
of the settings file A LOT (more or less self-explaining settings identifiers instead of some
weird terms or variable names only understood by the core devs themselves (if at all)).
In addition to and surrounding this feature, several changes, improvements and fixes on
the general topic of handling settings are included as well. See individual commit messages
for details.
Fixes#1940
As an aside: This change is an important step towards being able to provide portable Mumble
installations.
If a link contains any percent encoded characters (e.g. umlauts),
the markdown parser sets a wrong offset, thus resulting in a cut off
link in the log.
This is fixed by adjusting the url parsing regex to include a percent
symbol.
The Screen struct has only been used as a namespace anyway and thus, it
is now converted into a proper namespace. This has the nice side-effect
of fixing name-clash issues with e.g. the X11 headers that also define a
Screen struct.
The server-specific shortcuts, which are saved to the DB, were
previously saved in two steps: First deleting all old shortcuts that are
stored in the DB for that server and then inserting the new shortcuts
afterwards.
However, if Mumble was to crash or forcefully quit for another reason
between these two steps, the server-specific shortcuts would be lost
completely (the old ones have been intentionally deleted from the DB and
the new ones haven't been saved yet).
Therefore, this commit now wraps these two steps into a single
transaction, which will execute atomically. So either the full
transaction succeeds (in which case the new shortcuts are saved as
expected) or it fails (or is aborted) in which case it will undo all
changes made so far (thus, in this case at least the old shortcuts that
have been stored previously are retained).
In the DB code at some places several SQL statements where packed in a
transaction to ensure atomicity of these instructions. However, instead
of accessing our created DB instance directly, they started the
transaction on the DB returned by the static function
QSqlDatabase::database(), which returns a DB with a default name. Since
we are using an explicit name for our DB, this default DB does not exist
and therefore starting the transaction on it will do nothing.
This commit fixes this by starting and committing the transaction on our
created DB instance directly.
Previously the default values for the member fields in the Settings
struct (and related structs) have been performed explicitly in the
corresponding constructor (if there even was one).
Besides the constructors not using initialization lists but instead
assigning a value in the constructor body (supposedly slower than member
initialization lists), this also blew up the constructor's size and
required to duplicate all variables in there (and not forget any, which
could in turn cause UB due to uninitialized memory).
For these reasons, this commit refactors these structs to us in-class
initialization of all member variables. Some of these values might get
overwritten in the corresponding constructor (e.g. if the value depends
on a preprocessor flag) but for most variables, this is not the case.
The script for generating the Settings JSON serialization was adapted
accordingly.
Previously all source files were added to a single executable file
(library on Windows). This makes reusing the source files (e.g. linking
them to test cases) close to impossible.
Therefore, this commit changes this by compiling all source files into
an object library that can be used for the aforementioned
executable/library but also be reused (e.g. in tests).
Previously settings were only saved upon Mumble's exit. This commit
makes sure that the settings are also saved to file every time, the user
accepts the settings window. That way settings are guaranteed to survive
potential crashes or other hard-exits of Mumble (e.g. Ctrl+C, Task
manager, etc.).
The Database::setShortcut function is used to save server-specific
shortcuts to the DB. However, at the same time it also deletes these
shortcuts from the passed list. This is a very unintuitive side-effect
of this function that also prevents saving shortcuts intermediately
instead of only upon disconnecting from a server (at which point we
indeed want to remove server-specific shortcuts).
Therefore, this commit removes this side-effect and instead explicitly
removes these shortcuts on disconnecting from a server.
We save a flag into our settings that indicates whether Mumble has quit
normally at the time the settings were saved. If upon loading, we don't
find this flag set, we have to assume that this may be because Mumble
has crashed the last time. Since the crash may be caused by changed
settings, we offer the user the possibility to load the backup settings
instead.
Previously we used different formats on different platforms (registry on
Windows, plists on macOS, ini files on Linux). This commit makes sure
that the same format is used on all platforms, regardless of the used
OS.
In this process a few unneeded settings have been removed and the
settings migration path has been tidied up as well (the code from
main.cpp was moved to Settings.cpp and the original uiUpdateCounter
variable was completely removed and replaced with logic inside the
routines handling the JSON (de)serialization of settings.
The old settings should be overtaken without issues and converted into
the new format on-the-fly without the user taking any notice of this.
From that on, the JSON settings file will be used instead.
Fixes#1940
The name `murmur` is deprecated and shouldn't be used anymore, as
decided by the Mumble project. While the server binary already uses the
"new" name, the man pages don't. Thus, rework the man pages so that its
successor `mumble-server` instead `murmur` is used and rename the
filenames of the man pages accordingly.
Also, rename the script `murmur-user-wrapper` to
`mumble-server-user-wrapper`, since also its man page is renamed.
This does not affect the configuration file `murmur.ini`.
Signed-off-by: Felix Singer <felixsinger@posteo.net>
CELT support will be removed, so Opus will not be optional any longer.
Remove all code outside of `USE_OPUS` scope with
```
$ git grep -w -l USE_OPUS -- '**/*'.{h,hpp,cpp} |
xargs unifdef -B -D USE_OPUS -M ''
```
This is a no-op since it has already been defined unconditionally.
Supersedes #5505.
PipeWire is correctly built and enabled in a Flatpak runtime, but does not properly intialize because the .so filename of the library is named slightly differently there.
See also flathub/info.mumble.Mumble#19 (comment)
After this, I can select PipeWire as back end in the Flatpak build. As mentioned in the above issue, it doesn't actually work yet after selecting it (no input or output is generated), but it's a first step. I'll do some digging to see if I can fix the second issue as well in a separate PR.
Found via `codespell -q 3 -S *.ts,./3rdparty,./3rdPartyLicenses -L
aci,ba,crypted,datas,doubleclick,feld,hsi,ist,keypair,ro,unknwn`
Includes misc. fixes to .github/ and cmake files
In a Plasma Wayland session the Mumble icon was not used in the task bar,
instead the generic Wayland icon shows up.
Setting the desktop file name resolves this.
Fixes#4851
As request in #2453, this commit implements the industry standard
for microphone hold time for voice activation detection. The calculation
that yields hold time (s) from the iVoiceHold setting is described and
comments are added to describe the function of related fields.
Implements #2453.
This is dead code since
```
commit c5644c7d73
Author: Robert Adam <dev@robert-adam.de>
Date: Thu May 7 08:14:09 2020 +0200
3rdparty: Removed sbcelt submodule as it is not used and broken
```
The bundled version is 0.7.0 and versions >0.7.x are NOT supported.
At least on OpenBSD (only packaging 0.11.x), the built would fail.
Yield and error at configure time with this fix.
CMake's `find_package()` function accepts an optional `version` argument
but Mumble's `find_pkg()` wrapper does not (treating it as package), so
roll our own check/error:
```
-- celt found | Version: 0.11.1
CMake Error at src/mumble/CMakeLists.txt:677 (message):
CELT 0.7.x is required, found 0.11.1!
```
Relates to #4476.
The library is readily available in OpenBSD's version of X[0].
Follow suit with Linux in enabling.
Noticed by the warning upon startup:
```
-<W>2022-01-21 02:30:40.548 GlobalShortcutX: No XInput support, falling back to polled input. This wastes a lot of CPU resources, so please enable one of the other methods.
+<W>2022-01-21 02:34:00.159 GlobalShortcutX: Using XI2 2.4
```
0: https://xenocara.org/
This changes the appstream id to info.mumble.Mumble, which is correct in regards to the specification.
This mostly upstreams the appstream metadata that was previously used for flatpak.
The clampFloatSample function is only used when rnnoise support is enabled, when it isn't this the presence of the function (since it is static) causes a -Wunused-function warning which ultimately ends up causing a build error due to -Werror.
As request in #2453, this commit implements the industry standard
for microphone hold time for voice activation detection. The calculation
that yields hold time (s) from the iVoiceHold setting is described and
comments are added to describe the function of related fields.
Implements #2453.
The clampFloatSample function is only used when rnnoise support is
enabled, when it isn't this the presence of the function (since it is
static) causes a `-Wunused-function` warning which ultimately ends up
causing a build error due to `-Werror`.
As per POSIX.1-2008, the correct header to include for poll(3) is
poll.h. Including sys/poll.h instead of poll.h causes the following
warning message on Alpine Linux:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
Due to `-Werror`, this ultimately causes the build to fail.
GNUInstallDirs is already used in cmake/install-paths.cmake. This fixes
arch-independent files ending up in $prefix/share instead of /usr/share.
This is required on multiarch/cross layouts setting the prefix to e.g.
/usr/x86_64-pc-linux-gnu or /usr/i686-pc-linux-gnu.
OS packages (at least on Linux and BSDs) prefer prepackaged libraries to
bundled/statically linked versions where possible.
Introduce `rnnoise` (default `ON`) and make `bundled-rnnoise` default to
it's value; this retains current behaviour.
This way, `rnnoise=OFF` disables use of RNNoise completely and a simple
`bundled-rnnoise=OFF` requires the system's library.
Tested on OpenBSD 7.0-CURRENT.
Move the declaration/definition of `iMessage` to where it is used,
otherwise the build fails with
```
src/mumble/AudioWizard.cpp:95:10: error: variable 'iMessage' set but not used [-Werror,-Wunused-but-set-variable]
quint32 iMessage = Settings::LogNone;
^
1 error generated.
```
Build-tested on OpenBSD 7.0-CURRENT using
```
$ cc --version
OpenBSD clang version 13.0.0
Target: amd64-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
```
There is an additional `elemsize` argument
(https://man.openbsd.org/kvm_getprocs.3):
Only the first elemsize bytes of each array entry are returned.
Complete OpenBSD signature:
```
struct kinfo_proc *
kvm_getprocs(kvm_t *kd, int op, int arg, size_t elemsize, int *cnt);
```
Linux, FreeBSD and NetBSD have the same four-argument signature:
```
struct kinfo_proc *
kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt);
```
Build-tested on OpenBSD 7.0-CURRENT.
kvm_getprocs(3) on Linux and FreeBSD
(https://www.freebsd.org/cgi/man.cgi?kvm_getprocs) has
```
KERN_PROC_PROC all processes, without threads
...
```
OpenBSD (https://man.openbsd.org/kvm_getprocs.3) and
NetBSD (https://man.openbsd.org/kvm_getprocs.3) however only know
```
KERN_PROC_KTHREAD
all processes (user-level plus kernel threads)
KERN_PROC_ALL
all user-level processes
...
```
and
```
KERN_PROC_ALL all processes
KERN_PROC_PID processes with process id arg
...
```
respectively, thus fall back to KERN_PROC_ALL where needed.
Build-tested on OpenBSD 7.0-CURRENT.
NB: The first hunk around kvm_openfiles(3) is from `clang-format`.
(should've have happened in the commit introducing this line, I guess.)
Move the declaration/definition of `iMessage` to where it is used,
otherwise the build fails with
```
src/mumble/AudioWizard.cpp:95:10: error: variable 'iMessage' set but not used [-Werror,-Wunused-but-set-variable]
quint32 iMessage = Settings::LogNone;
^
1 error generated.
```
Build-tested on OpenBSD 7.0-CURRENT using
```
$ cc --version
OpenBSD clang version 13.0.0
Target: amd64-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
```
When using the BanEditor to manually create a new Ban entry, it was
really easy to get the "mask" property wrong, which had the effect of
apparently not performing any action at all, when clicking on the "Add"
button.
The underlying problem was most likely that the "mask" field defaults to
128, which is only valid for IPv6 addresses. When entering an IPv4
address, the mask would be considered invalid (through some internal
wizardry) and thus the Ban would not be added.
However, the user was not presented with any kind of error message that
would have hinted at the problem.
This commit tackles this issue by first of all validating that the
entered IP address is valid. If it is not, then the respective input
field will be colored red. If it is, the mask spin box's maximum value
will automatically be set to the correct maximum value for the used IP
address flavor (32 for IPv4 and 128 for IPv6).
That way the user can only ever press "Add", if they entered a valid IP
address alongside a valid mask. Thus, pressing "Add" should now always
add the respective ban.
Fixes#3986
Having a separate RELEASE_ID just unnecessarily complicates drafting
releases. Plus, now that we are using different build numbers for every
new build anyway, a separate release ID is really not necessary.
Having a separate RELEASE_ID just unnecessarily complicates drafting
releases. Plus, now that we are using different build numbers for every
new build anyway, a separate release ID is really not necessary.
This is done, since the underlying framework for how channel listeners
are handled (more specifically: where they are stored) will be changed
in an upcoming PR. This upcoming change will cause listener persistence
to only apply to registered users. Thus, if the current persistence
feature was to be retained, that would mean that when introducing this
change, we'd remove a feature from Mumble.
As that is not a great thing to do, we'll remove the feature now that it
is still unreleased and then the upcoming change will introduce
persistence for some users instead of taking it away from others.
Furthermore, this PR fixes a little bug that made it possible for channel listeners
to be shown multiple times in the UI.
Tracy (wolfpld/tracy) is a profiler that is aimed at
having a very low impact on the runtime performance and is thus suitable
to be used in production systems to figure out what is going on and how
the code is performing.
For the time being, this commit instruments only the server code.
Furthermore, the instrumentation is performed in a rather minimalistic
way that should suffice to start profiling audio and control message
processing but is definitely far from being complete. Further
instrumentation will be added on-demand.