quassel.git
5 years agocore: Workaround Qt 4 SQL bindValue() duplicates
Shane Synan [Wed, 6 Feb 2019 23:37:01 +0000 (18:37 -0500)]
core: Workaround Qt 4 SQL bindValue() duplicates

Workaround Qt 4 QSqlQuery::bindValue() not handling duplicate
parameter names by giving every duplicated parameter a unique name.

Qt 5 handles this as one expects, so this doesn't need forward-ported
to 0.14/master where Qt 4 support has been dropped.

Applies to SQLite and PostgreSQL.

Note: PostgreSQL prepared statements properly handle repeated "$"
parameters, so there's no need to modify those.

Test case for prepared statements:
> PREPARE qcore_test_var
  AS SELECT * FROM buffer WHERE bufferid = $1 AND userid = $1
    AND networkid = $1;
> EXECUTE qcore_test_var(1);
Gives a result if bufferid = userid = networkid = 1 exists.

Credit to @justJanne for finding the root cause of the issue, and
suggesting the fix, and to 'galfwender' and @darkstar for reporting.

Fixes #1506

See https://doc.qt.io/archives/qt-4.8/qsqlquery.html#bindValue
And https://doc.qt.io/qt-5/qsqlquery.html#bindValue

5 years agologger: Dedup code, fix client Debug Log loglevel
Shane Synan [Thu, 14 Feb 2019 00:31:50 +0000 (19:31 -0500)]
logger: Dedup code, fix client Debug Log loglevel

Deduplicate code by moving LogEntry formatting into a separate
function, LogEntry::toString(), which applies timestamps and the log
level string.

Fix client Debug Log dialog to print log level using this new function.

Modify msgWithTime() to use this new function, too.

5 years agologger: Make output to syslog nicer
Wolfgang Müller [Wed, 13 Feb 2019 23:27:18 +0000 (18:27 -0500)]
logger: Make output to syslog nicer

Resolve the level string in msgWithTime.  This means that the log
level string is included in logs to files and stdout even if syslog
output is enabled.

Resolve the program name using RunMode and BuildInfo, distinguishing
between client, core, and monolithic.

[Backported from 0.14/git-master]

5 years agocore: Remove redundant updateSchemaVersion() call
Shane Synan [Tue, 29 Jan 2019 05:07:10 +0000 (00:07 -0500)]
core: Remove redundant updateSchemaVersion() call

Remove the redundant updateSchemaVersion() call at the end of schema
migrations.  This is already called within the final iteration of the
loop.

Cleans up a leftover from f10304a35af0a7a4f8b812e467e69287d358ce7c

5 years agocore: Display problem step if storage setup fails
Shane Synan [Tue, 29 Jan 2019 05:06:58 +0000 (00:06 -0500)]
core: Display problem step if storage setup fails

Print the problematic setup step (e.g. 'setup_070_coreinfo') if
storage backend initialization fails.  This may help with debugging.

Modify setupQueries() to return a list of query strings and
resource filenames, used for the above.

5 years agocore: Track upgrade step within schema version
Shane Synan [Tue, 29 Jan 2019 05:06:25 +0000 (00:06 -0500)]
core: Track upgrade step within schema version

Track the last successful upgrade step (upgrade_###_XXX.sql) within
each schema version, storing it within 'coreinfo' table as
'schemaupgradestep'. When a schema upgrade finishes, clear
'schemaupgradestep' and set 'schemaversion'.

This allows for resuming multi-step schema upgrades that were
interrupted in the middle.

Whenever starting a schema upgrade, also check the value of
'schemaupgradestep'.  One of two states exist:
1.  Empty ('') or nonexistent
    No interrupted schema upgrade, start the next schema version
    upgrade from the first query.
2.  Contains text, e.g. 'upgrade_010_alter_sender_64bit_ids'
    The schema upgrade was interrupted, skip schema upgrade steps
    including the specified successful step, and resume from the next
    step.

For case 2, if the schema upgrade step cannot be found, warn and bail
out.  This should only happen if:
1.  The storage of successful query glitched, or the database was
    manually changed
2.  Quassel changed the filenames of upgrade queries, and the local
    Quassel core version was replaced during an interrupted schema
    upgrade

Modify SqliteStorage and PostgreSqlStorage to fetch/save the
'schemaupgradestep' key.  Clearing this key is done atomically within
updateSchemaVersion().

(Ideally, the whole upgrade would be wrapped in a transaction, but
 that doesn't seem to be easily possible.)

Modify upgradeQueries() to return a list of query strings and
resource filenames, used for tracking the upgrade step and providing
clearer feedback on what steps fail.

5 years agocommon: Don't add quotes to exit exceptions
Shane Synan [Sun, 27 Jan 2019 07:46:10 +0000 (02:46 -0500)]
common: Don't add quotes to exit exceptions

When logging exit exceptions, wrap the QString in qPrintable(),
removing the extra quotes added by the debug logger.

5 years agobuild: Add Boost 1.0 license for CMake script
Shane Synan [Sat, 26 Jan 2019 04:16:40 +0000 (23:16 -0500)]
build: Add Boost 1.0 license for CMake script

Add copy of Boost 1.0 license for the included CMake script
GetGitRevisionDescription.  This addresses licensing concerns for
Debian and derivatives.

Rename the license file according to existing licenses GPLv2 and v3.

See https://www.boost.org/LICENSE_1_0.txt

Fixes #1504

5 years agoFixes misalignment of buttons in inputwidget
Janne Koschinski [Tue, 15 Jan 2019 16:24:16 +0000 (17:24 +0100)]
Fixes misalignment of buttons in inputwidget

5 years agoFixes bug where nicklist was broken on first start
Janne Koschinski [Tue, 15 Jan 2019 16:23:14 +0000 (17:23 +0100)]
Fixes bug where nicklist was broken on first start

Starting with commit 66e6d26 the nicklist gets hidden in
setDisconnectedState, but only unhidden in loadLayout.

As loadLayout skips the setVisible(true) if the state is empty, the
actual widget gets never shown, and the nicklist dock remains empty.

This was fixed by moving the setVisible call above the conditional
return.

5 years agoApply suggested info change
Shane Synan [Wed, 13 Feb 2019 08:46:30 +0000 (09:46 +0100)]
Apply suggested info change

Co-Authored-By: justjanne <janne@kuschku.de>
5 years agoAllow configuring listen address
Janne Koschinski [Tue, 12 Feb 2019 21:30:45 +0000 (22:30 +0100)]
Allow configuring listen address

5 years agoProperly handle options if core has just now been configured
Janne Koschinski [Wed, 2 Jan 2019 18:02:34 +0000 (19:02 +0100)]
Properly handle options if core has just now been configured

5 years agoMake the identd listen on all addresses
Janne Koschinski [Wed, 2 Jan 2019 16:22:13 +0000 (17:22 +0100)]
Make the identd listen on all addresses

5 years agosrc: Yearly copyright bump
Manuel Nickschas [Thu, 24 Jan 2019 23:20:32 +0000 (00:20 +0100)]
src: Yearly copyright bump

... and it's still January!

5 years agoclient: Don't use list initialization for QStringList
Manuel Nickschas [Tue, 4 Dec 2018 18:33:36 +0000 (19:33 +0100)]
client: Don't use list initialization for QStringList

The minimal build requirements we defined for the 0.13 branch don't
support list initialization for QStringList, so replace the two
places where we accidentally slipped that in by the legacy way
of doing things.

Fixes #1503.

5 years agoserializers: Fix quint16 deserialization, remove code duplication
Manuel Nickschas [Sun, 18 Nov 2018 22:18:47 +0000 (23:18 +0100)]
serializers: Fix quint16 deserialization, remove code duplication

Fix a bug where a quint16 would be deserialized into a QVariant
of type Int (instead of UShort). This broke the sync of
autoReconnectRetries in the network settings, because the slot's
signature didn't match the type of the QVariant.

The issue was caused by QVariant not having a constructor for
quint16, thus casting it into an int. Fix this by using
QVariant::fromValue(), which handles the type correctly.

Use the opportunity to remove much of the code duplication in the
deserialization code by providing and using a template function,
avoiding potential other issues with using QVariant's constructor.

(cherry picked from commit 95848fd9232d92f388e0e533adb15f6ba9d2d492)

5 years agoqa: Remove dead code
Manuel Nickschas [Sun, 18 Nov 2018 19:51:01 +0000 (20:51 +0100)]
qa: Remove dead code

(cherry picked from commit ba3f171f93c522212aee15eb5ce23db4dca6e359)

5 years agocmake: Set proper install paths for Windows
Manuel Nickschas [Sun, 18 Nov 2018 17:31:07 +0000 (18:31 +0100)]
cmake: Set proper install paths for Windows

Instead of dumping everything into the install prefix, set
separate paths for runtime and library artifacts.

The paths chosen match the expectations of Craft packaging, so
we can subsequently remove the overrides in the craft blueprint.

(cherry picked from commit 21b3d4d17220feb9d3b2f3d856d17f8606da5879)

5 years agoBump version for release 0.13.0
Manuel Nickschas [Thu, 15 Nov 2018 23:46:16 +0000 (00:46 +0100)]
Bump version for release

5 years agoUpdate ChangeLog
Manuel Nickschas [Thu, 15 Nov 2018 23:44:51 +0000 (00:44 +0100)]
Update ChangeLog

5 years agoMinor cleanup of BufferView
Manuel Nickschas [Fri, 16 Nov 2018 19:04:01 +0000 (20:04 +0100)]
Minor cleanup of BufferView

Fix some nitpicks.

5 years agoAllow selecting the search result when searching for buffers
Martin T. H. Sandsmark [Mon, 29 Oct 2018 11:52:17 +0000 (12:52 +0100)]
Allow selecting the search result when searching for buffers

If multiple buffers are displayed when filtering by name, allow
selecting one of the using the up/down keys. This makes it possible
to jump to a buffer other than the topmost.

5 years agocommon: Fix syncing of BufferViewManager
Manuel Nickschas [Wed, 7 Nov 2018 20:01:39 +0000 (21:01 +0100)]
common: Fix syncing of BufferViewManager

Two syncable methods where accidentally demoted from being slots,
so adding/removing buffer views would not be synced anymore.

Fix this by making those methods slots again.

5 years agoqtui: Make the debug log a proper dialog
Manuel Nickschas [Tue, 6 Nov 2018 22:46:33 +0000 (23:46 +0100)]
qtui: Make the debug log a proper dialog

For some reason unbeknownst and shrouded in ancient mystery, the
debug log was displayed in a naked widget, which caused it to not
be rendered in a window when using not-so-smart window managers
(such as Windows™).

Make the debug log a proper dialog, and also fix the close button
not being part of a platform-agnostic QDialogButtonBox, while we're
at it.

5 years agocore: Avoid Clang warning for inconsistent override
Manuel Nickschas [Thu, 1 Nov 2018 09:09:35 +0000 (10:09 +0100)]
core: Avoid Clang warning for inconsistent override

5 years agoircuser: Fix setting of away message time by pre-0.13 cores
Manuel Nickschas [Tue, 30 Oct 2018 16:26:43 +0000 (17:26 +0100)]
ircuser: Fix setting of away message time by pre-0.13 cores

IrcUser::setLastAwayMessage() is called by pre-0.13 cores (newer
cores call setLastAwayMessageTime() instead). Fix wrong use of
QDateTime::from[M]SecsSinceEpoch(), which is a static method returning
a new QDateTime instance rather than a modifying setter.

Also fix signatures passing primitive types as const refs.

5 years agoqtui: Disable web preview by default
Manuel Nickschas [Tue, 30 Oct 2018 19:07:44 +0000 (20:07 +0100)]
qtui: Disable web preview by default

Upon popular request, disable the web preview by default. This
feature tends to surprise unwitting new users that just happen
to hover over a questionable link, and the preview's functionality
is limited anyway with today's complex websites.

The web preview can still be enabled explicitly in chatview settings.
Existing configurations are unaffected by this change.

5 years agoFix the order of the Davids
David ‘Bombe’ Roden [Mon, 22 Oct 2018 14:04:16 +0000 (16:04 +0200)]
Fix the order of the Davids

5 years agoBump version for release 0.13-rc2 build/0.13-rc2
Manuel Nickschas [Mon, 15 Oct 2018 17:51:51 +0000 (19:51 +0200)]
Bump version for release

5 years agoUpdate ChangeLog
Manuel Nickschas [Mon, 15 Oct 2018 17:51:00 +0000 (19:51 +0200)]
Update ChangeLog

5 years agocommon: Remove left-overs from signal handling rework
Manuel Nickschas [Sun, 14 Oct 2018 19:39:03 +0000 (21:39 +0200)]
common: Remove left-overs from signal handling rework

Remove some remnants of the old code that were missed when pushing
the reworked implementation.

5 years agoclient: For filter, prioritize exact, startsWith
Shane Synan [Sat, 6 Oct 2018 18:53:59 +0000 (13:53 -0500)]
client: For filter, prioritize exact, startsWith

When filtering buffer view results, prioritize exact string matches,
then prioritize startsWith matches, both case-insensitive.  Within
these results, sort normally (e.g. alphabetical).

This gives weight to exact matches and the start of the string.  When
no filter string is specified, sorting goes back to normal.

Search string: "car"
Before:
> acar
> bcar
> careful
> caring
> racecar
> car [hidden]

After:
> car [hidden]
> careful
> caring
> acar
> bcar
> racecar

Where [hidden] represents a buffer that's temporarily or permanently
hidden.

5 years agoclient: Sort network name case-insensitively
Shane Synan [Sat, 6 Oct 2018 17:48:20 +0000 (12:48 -0500)]
client: Sort network name case-insensitively

Set BufferViewFilter to sort case-insensitively.  This results in
network names being sorted regardless of case.  Channel/nickname
sorting is handled elsewhere.

Before:
> Alpha
> Freenode
> beta

After:
> Alpha
> beta
> Freenode

This probably matches expectations better, and hopefully doesn't
break existing workflows too much...  https://xkcd.com/1172/

5 years agocommon: Don't use unsafe functions when handling POSIX signals
Manuel Nickschas [Fri, 5 Oct 2018 21:07:04 +0000 (23:07 +0200)]
common: Don't use unsafe functions when handling POSIX signals

The set of functions we're allowed to safely use in a POSIX signal
handler is very limited, and certainly does not include anything Qt.
While our previous implementation seemingly worked anyway as long as
all it did was quitting the application, we now start seeing issues
when doing a proper shutdown.

Fix this by providing a generic API for watching signal-like external
events that can be specialized for the various platforms we support.
Provide PosixSignalWatcher, which uses socket notification to safely
hand over control from the signal handler to the Qt event loop.

Also provide an implementation for Windows that still uses the
previous approach; since Windows doesn't support socketpair(), we
can't easily reuse the POSIX implementation. On the bright side, so
far we don't know if signal handlers on Windows face the same
limitations as on POSIX anyway...
Also on Windows we now support console events, i.e. Ctrl+C as well
as closing the console window.

5 years agoqtui: Don't parent dialogs created on the stack
Manuel Nickschas [Thu, 4 Oct 2018 10:52:42 +0000 (12:52 +0200)]
qtui: Don't parent dialogs created on the stack

Dialogs that are created on the stack should not have a parent,
lest they get double-deleted if the main window is destroyed while
such a dialog is still open.

5 years agoRevert "qtui: Don't create parented dialogs on the stack"
Manuel Nickschas [Thu, 4 Oct 2018 10:19:54 +0000 (12:19 +0200)]
Revert "qtui: Don't create parented dialogs on the stack"

Auto-deleting dialogs is a bad idea if we're accessing the instance
after exec(). We could work around this in the affected cases,
however it may be easier and cleaner to create the dialogs on the
stack again, but don't parent them to avoid the crashes we intended
to fix with this commit.

This reverts commit 4e452ee828fdb411e6b1db07c18e02681a30ff27.

5 years agocommon: Don't warn on unknown user in IrcChannel
Manuel Nickschas [Sat, 29 Sep 2018 17:47:05 +0000 (19:47 +0200)]
common: Don't warn on unknown user in IrcChannel

When quitting a channel, the IrcChannel instance may still be
receiving pending events for IrcUsers that have already been removed.
Don't log a warning in this case, because it doesn't help and confuses
users.

5 years agocore: Fix quitting from networks on shutdown
Manuel Nickschas [Sat, 29 Sep 2018 17:38:43 +0000 (19:38 +0200)]
core: Fix quitting from networks on shutdown

The previous implementation relied on processEvents() to let the
QUIT command be sent to the IRC server. However, processEvents()
does not guarantee that it processes all events (also in other
threads), and indeed, the previous approach was not reliable.

Fix this by waiting for the networks to emit the disconnected()
signal after requesting the quit. There already is a 10 second
timeout in case the IRC server does not close the socket within
a reasonable time, so rely on that. Also ensure that connect requests
are ignored during shutdown.

With the CoreSession requesting a clean shutdown, we no longer need
a similar handling in CoreNetwork's dtor, so remove this.

See also GH-203 and GH-207, which were previous attempts on getting
this right.

5 years agocore: Allow clean shutdown of the core
Manuel Nickschas [Sat, 29 Sep 2018 15:31:42 +0000 (17:31 +0200)]
core: Allow clean shutdown of the core

Relying on things to happen while the core is being destroyed is
fragile (and does not work in practice), because events are no
longer delivered to objects that are scheduled for deletion.

Add an explicit call for shutting down the core, its sessions and
their networks. Wait for everything to be cleaned up properly before
quitting the session threads, and ultimately shutting down the main
event loop.

While we're at it, refactor SessionThread to follow the worker
pattern, rather than inheriting from QThread. This avoids accidentally
calling slots in the wrong thread. Ensure that all cross-thread
communication happens through queued signals. Simplify the API, too.

5 years agoqtui: Fix quit sequence and lifetime issues
Manuel Nickschas [Sat, 29 Sep 2018 09:52:12 +0000 (11:52 +0200)]
qtui: Fix quit sequence and lifetime issues

Make use of the Singleton mixin for Client and GraphicalUi. Fix
ownership and explicitly construct and destroy the pseudo singletons.
Remove some static init methods in favor of initializing in the
constructor where possible. We still need delayed initialization
of the main UI however, so GraphicalUi::init() has to stay.

Simply calling QCoreApplication::quit() doesn't clean up properly,
because it immediately stops event processing, which means that
any deferred deletions won't be processed anymore.

Since we perform some important and asynchronous tasks during
shutdown, such as saving settings and properly unregistering from
IRC, we really want proper cleanup, though.

Fix this by relying on Quassel::quit() instead, and registering
appropriate quit handlers that shut down the client in orderly
and controlled fashion. Ensure that all open windows and dialogs
are closed prior to MainWin's destruction.

Core shutdown warrants a more complex approach, which will be
implemented in a follow-up commit.

5 years agogit: Update .gitignore
Manuel Nickschas [Fri, 28 Sep 2018 20:54:15 +0000 (22:54 +0200)]
git: Update .gitignore

Actually hide project files from Qt Creator, as well as KDevelop.

5 years agocore: Use the Singleton mixin for the Core instance
Manuel Nickschas [Fri, 28 Sep 2018 20:28:33 +0000 (22:28 +0200)]
core: Use the Singleton mixin for the Core instance

Instead of implementing the instance pointer manually, use the
Singleton mixin.

5 years agocommon: Prepare Quassel::quit() to be used more widely
Manuel Nickschas [Fri, 28 Sep 2018 20:24:33 +0000 (22:24 +0200)]
common: Prepare Quassel::quit() to be used more widely

In the future we want to use Quassel::quit() as the central entry
point for cleanly quitting the application, instead of relying
on QCoreApplication::quit(), which directly stops the event loop
and thus won't process any asynchronous cleanup tasks.

Make the slot public, and protect against multiple invocations.

5 years agocommon: Use the Singleton mixin for the Quassel instance
Manuel Nickschas [Fri, 28 Sep 2018 19:41:31 +0000 (21:41 +0200)]
common: Use the Singleton mixin for the Quassel instance

Make use of the newly added Singleton mixon to remove the custom
handling of Quassel's instance pointer. Clearly define Quassel's
lifetime by making it a local instance in main(), rather than
relying on someone to call Quassel::instance() at the right time.

Now it is also clear that the instance is deleted after main()
returns (which was the case before, however there still was a no-op
Quassel::destroy() method too, which has now been removed). This
is fine, because Quassel does not own resources that should be deleted
before exiting the event loop.

5 years agocommon: Provide Singleton mixin for handling pseudo singletons
Manuel Nickschas [Fri, 28 Sep 2018 19:17:32 +0000 (21:17 +0200)]
common: Provide Singleton mixin for handling pseudo singletons

We have several singleton and pseudo-singleton classes in Quassel.
A pseudo singleton can be constructed and destroyed in a controlled
manner, but can be accessed through a static instance pointer while
it is alive. As an example, QCoreApplication behaves like this.

In order to avoid duplication and unify the behavior of our singletons
in the future, provide a mixin. Classes can inherit from this and gain
an instance() method, as well as protection against multiple
instantiation and access outside of the object's lifetime.

5 years agocommon: Don't warn when "closing" InternalPeer
Manuel Nickschas [Thu, 27 Sep 2018 22:56:35 +0000 (00:56 +0200)]
common: Don't warn when "closing" InternalPeer

InternalPeer may be closed legitimately like any other peer type.
Although for InternalPeer this just sets a flag, it should not
produce a warning claiming that the method is not implemented.

Also actually report the open status for InternalPeer. Ensure that
it is constructed in open state, otherwise a signalproxy cannot
be set.

5 years agoqtui: Don't create parented dialogs on the stack
Manuel Nickschas [Wed, 26 Sep 2018 22:09:26 +0000 (00:09 +0200)]
qtui: Don't create parented dialogs on the stack

Create dialogs in MainWin on the heap, rather than on the stack.
This avoids crashes when MainWin is destroyed while a dialog is
open (in which case a double free would happen).

Set the WA_DeleteOnClose attribute on affected dialogs so they will
be deleted upon close, rather than hanging around in memory until
shutdown.

5 years agocommon: Avoid crash on SignalProxy destruction
Manuel Nickschas [Tue, 25 Sep 2018 22:47:14 +0000 (00:47 +0200)]
common: Avoid crash on SignalProxy destruction

Since SignalProxy itself attaches a slot, it will try to detach
itself on destruction, leading to a crash. Avoid this by checking
for self-detachment.

5 years agoClean up translator attributions
Daniel Albers [Mon, 24 Sep 2018 20:58:52 +0000 (22:58 +0200)]
Clean up translator attributions

5 years agoRemove empty translation files
Daniel Albers [Tue, 12 Sep 2017 22:06:01 +0000 (00:06 +0200)]
Remove empty translation files

- es_AR
- et_EE
- id_ID
- uz@Latn
- zh_TW

5 years agoUpdate quassel.pot
Daniel Albers [Wed, 20 Dec 2017 04:00:06 +0000 (05:00 +0100)]
Update quassel.pot

5 years agoUpdate translations from Transifex
Daniel Albers [Tue, 5 Sep 2017 03:00:24 +0000 (05:00 +0200)]
Update translations from Transifex

  27958 translated messages

Many thanks to:
 - cs: Jaroslav Lichtblau <dragonlord@seznam.cz>
 - da: Joe Hansen <joedalton2@yahoo.dk>
 - de: Steve M <transifex@lostinweb.eu>
 - el: Theofilos Intzoglou <int.teo@gmail.com>
 - eo: Tinjo Kohen <tiffypet@yahoo.com>
 - es: Chris Egeland <chris@chrisegeland.com>, Javier Llorente
   <javier@opensuse.org>
 - fi: Lasse Liehu <larso@gmx.com>
 - fr: Guillaume Gay <guillaume.gay@gmail.com>, Olivier Caron
   <crn.olivier@gmail.com>, Zoddo <transifex.com@zoddo.fr>
 - hi: Raju Devidas Vindane <rajuvindane@gmail.com>
 - ko: Tae-Hoon KWON <zerolaunch@naver.com>, Sungjin Kang <potopro@gmail.com>
 - lt: Liudas Ališauskas <liudas.alisauskas@gmail.com>
 - mr: Raju Devidas Vindane <rajuvindane@gmail.com>
 - nb: Chris Egeland <chris@chrisegeland.com>, sandsmark
   <inactive+sandsmark@transifex.com>
 - nl: Joep Seuren <joepseuren1@gmail.com>
 - pa: A S Alam <apreet.alam@gmail.com>
 - pl: Miłosz Rachwał <transifex@milek7.pl>, derpella <matwa@poczta.pl>
 - pt: Vitor Luis <ptirc@protonmail.com>
 - pt_BR: André Marcelo Alvarenga <alvarenga@kde.org>, Lucas A. V. Dantas
   <lucasdantas@yandex.com>
 - ro: Arthur Țițeică <arthur.titeica@gmail.com>, Sergiu Bivol <sergiu@cip.md>
 - ru: Svetlana Tkachenko <svetlana@members.fsf.org>, Viktor Suprun
   <popsul1993@gmail.com>, Yaroslav Veremenko <yaroslav@veremenko.info>
 - sl: Andrej Mernik <andrejm@ubuntu.si>
 - tr: Demiray “tulliana” Muhterem <mdemiray@msn.com>, Volkan Gezer
   <volkangezer@gmail.com>
 - uk: Yuri Chornoivan <yurchor@ukr.net>
 - zh_CN: leonfeng <chaofeng111@qq.com>

5 years agoUpdate Transifex URL
Daniel Albers [Thu, 29 Mar 2018 11:39:05 +0000 (13:39 +0200)]
Update Transifex URL

5 years agoqtui: Fix load/save states of SonnetSettingsPage
Manuel Nickschas [Mon, 17 Sep 2018 21:50:18 +0000 (23:50 +0200)]
qtui: Fix load/save states of SonnetSettingsPage

Call the base class functions to ensure that the changed state is
reset properly.

Unfortunately, the Sonnect::ConfigWidget does not allow for direct
comparison of settings, so toggling a setting will still not
reset the changed state; but at least loading or resetting now will.

5 years agocore: Remove away-notify hack for non-spec server
Shane Synan [Fri, 14 Sep 2018 19:54:31 +0000 (14:54 -0500)]
core: Remove away-notify hack for non-spec server

Remove the AutoWho-on-JOIN hack for IRC servers that do not fully
comply with the "away-notify" spec by not sending ":AWAY :message"
when a user marked /away joins a channel.

Advantages:
* Less network traffic (no WHO for every nickname that joins)
* Less likely to expose other bugs where an IRC server returns
  something unexpected causing auto-who output to go in the status
  buffer

Disadvantages:
* On non-compliant IRC servers, Quassel will no longer accurately
  know the away status of someone that joins a channel while /away
* On IRC servers that implement "away-notify" but not
  "extended-join", Quassel will no longer learn the logged-in account
  and realname for someone that joins a channel
  (This will break showing realname, fallback avatar fetching)

Remove all functions related to automatic nickname WHO'ng as they are
no longer needed.  Leaving them in wouldn't cause any issues other
than unnecessary work and code clutter.

Add a comment pointing to this commit in case someone decides to
resurrect this workaround.

See https://ircv3.net/specs/extensions/away-notify-3.1.html
And https://bugs.unrealircd.org/view.php?id=5144

5 years agocore: Clean up AutoWho comments, variable names
Shane Synan [Fri, 14 Sep 2018 18:51:40 +0000 (13:51 -0500)]
core: Clean up AutoWho comments, variable names

Clean up AutoWho variable names using the "name" convention from
RFC 1459.

Clean up AutoWho comments likewise, referring to "name" instead of
"channel" where appropriate.

See https://tools.ietf.org/html/rfc1459#section-4.5.1

5 years agocore: Cancel nickname AutoWho on IrcUser quit
Shane Synan [Thu, 13 Sep 2018 06:34:44 +0000 (01:34 -0500)]
core: Cancel nickname AutoWho on IrcUser quit

Remove any queued AutoWho for <nickname> if <nickname> quits.  This
avoids sending a needless AutoWho for <nickname> that'll only either
result in "No such nickname" if we're lucky, or random results for
non-extended WHO if <nickname> happens to match the realname/etc of
other IRC users.

This should fix any remaining cases of join/quit resulting in AutoWho
output in the Status Buffer for a network.

5 years agocore: AutoWhoX, only search nickname by nickname
Shane Synan [Thu, 13 Sep 2018 07:00:17 +0000 (02:00 -0500)]
core: AutoWhoX, only search nickname by nickname

When running automatic WhoX, explicitly specify "n" to search by
nickname only.  Don't rely on server defaults.  This fixes an issue
with Quassel's autoWHO causing noise in the Status Buffer uncovered
by InspIRCd 3.0's implementation of WhoX that follows the spec.

Fix up incorrect attempt to escape "%" as "%%".  Apparently,
QString::arg() doesn't need to escape this.

Before: WHO <nickname> %%chtsunfra,<unique_number>
After:  WHO <nickname> n%chtsunfra,<unique_number>

See https://github.com/quakenet/snircd/blob/master/doc/readme.who
And https://doc.qt.io/qt-5/qstring.html#arg

Thanks to @genius3000 for reporting and tracking down this issue!

Fixes #1487

5 years agosettings: Fix NetworkAddDlg states on type change
Shane Synan [Wed, 12 Sep 2018 23:57:44 +0000 (18:57 -0500)]
settings: Fix NetworkAddDlg states on type change

Add check for button states when changing between "Use preset" and
"Manually specify network settings".

This fixes the "OK" button remaining enabled when adding a network
and selecting manual, and also fixes re-enabling the "OK" after
switching back to presets.

5 years agoutil: Remove T separator from ISO 8601 (RFC 3339)
Shane Synan [Wed, 12 Sep 2018 22:54:25 +0000 (17:54 -0500)]
util: Remove T separator from ISO 8601 (RFC 3339)

Remove the "T" separator when formatting ISO 8601 date/time to
strings.  This improves readability without sacrificing machine
parsing, remaining compliant with RFC 3339.

Technically ISO 8601 specification states "T" can only be omitted,
but that makes readability even worse.

Example:
> Before: 2018-08-22T18:43:10-05:00
> After:  2018-08-22 18:43:10-05:00
          ..........^ (10th character)

NOTE:  Qt's own ISO 8601 parsing of strings to QDateTime will not
handle this correctly.  Custom format strings can be used, or just
replace the " " with "T" again.

See https://en.wikipedia.org/wiki/ISO_8601#cite_note-32

4.3.2 NOTE: By mutual agreement of the partners in information
interchange, the character [T] may be omitted in applications where
there is no risk of confusing a date and time of day representation
with others defined in this International Standard.

And https://www.ietf.org/rfc/rfc3339.txt

NOTE: ISO 8601 defines date and time separated by "T".
      Applications using this syntax may choose, for the sake of
      readability, to specify a full-date and full-time separated by
      (say) a space character.

Fixes #1456

5 years agoqa: Don't return a const ref from Settings::localValue()
Manuel Nickschas [Mon, 10 Sep 2018 21:24:07 +0000 (23:24 +0200)]
qa: Don't return a const ref from Settings::localValue()

Stumbled on this by accident because one particular CI configuration
warned about Settings::localValue() returning a stack reference
(may happen if the default value (which is a const ref itself) is
returned).

Not sure why I don't see this warning in my own setup, but it's
legitimate; thus fix the issue.

5 years agoChange to an early continue for a NULL IrcUser
Matt Schatz [Sun, 9 Sep 2018 18:27:37 +0000 (12:27 -0600)]
Change to an early continue for a NULL IrcUser

Commit e9096505f07fc0c08a7c36f3680c1fde975d4f80 changed the behaviour
in joinIrcUsers() from skipping a NULL IrcUser or an already tracked
IrcUser to updating the usermodes of said IrcUser. The call to
addUserMode() will call isKnownUser() which will log a warning
of 'received IrcUser Nullpointer' and return false. This is safe
from crashing, but shouldn't be allowed to happen.

5 years agoqa: Avoid warning about missing field initializers
Manuel Nickschas [Wed, 5 Sep 2018 20:17:16 +0000 (22:17 +0200)]
qa: Avoid warning about missing field initializers

Some compiler setups throw a warning when default-brace-initializing
UiStyle::Format. Avoid this by explicitly constructing an instance.

5 years agoqa: Try to avoid fall-through warnings
Manuel Nickschas [Wed, 5 Sep 2018 21:12:04 +0000 (23:12 +0200)]
qa: Try to avoid fall-through warnings

GCC8 warns again about some intentional fallthroughs. Try to fix this
by adding comments.

5 years agoqa: Don't compile the expression match tests
Manuel Nickschas [Wed, 5 Sep 2018 20:11:56 +0000 (22:11 +0200)]
qa: Don't compile the expression match tests

Those are not used unless manually hacked in, and compiling them
causes warnings in some compiler setups, so don't compile the
tests at all.

They're still referenced in the CMakeLists.txt and can easily be
added back if desired. Longer term, they'll move into a real
test framework.

5 years agoclang-tidy: Avoid another bogus warning about a potential leak
Manuel Nickschas [Wed, 5 Sep 2018 19:09:19 +0000 (21:09 +0200)]
clang-tidy: Avoid another bogus warning about a potential leak

False positive, fixed by assigning to an attribute. Seems like
clang-tidy really doesn't like ephemeral objects even if they
have a parent.

5 years agoclang-tidy: Avoid memory leak in MainWin
Manuel Nickschas [Wed, 5 Sep 2018 18:58:46 +0000 (20:58 +0200)]
clang-tidy: Avoid memory leak in MainWin

This one is legitimate: If no network is selected, the freshly
created ChannelListDlg instance is never deleted. Move instantiation
after the network ID check, so the dialog is shown (and self-deletes
on close). Set a parent for good measure, too.

5 years agoclang-tidy: Avoid another warning about potential memory leak
Manuel Nickschas [Wed, 5 Sep 2018 18:53:24 +0000 (20:53 +0200)]
clang-tidy: Avoid another warning about potential memory leak

This is a false positive (since the newly created QFormLayout takes
a widget as its parent), however some slight rearrangement of
code shuts up clang-tidy without resorting to NOLINT.

5 years agoclang-tidy: Avoid potential memory leak in QtUi
Manuel Nickschas [Wed, 5 Sep 2018 18:39:12 +0000 (20:39 +0200)]
clang-tidy: Avoid potential memory leak in QtUi

Clean up the instance handling in QtUi (and GraphicalUi) to ensure
that a newly created QtUi instance is always assigned to the local
_instance variable. Otherwise, clang-tidy warns about a potential
memory leak (although this would not happen in practice).

5 years agoclang-tidy: Remove dead stores
Manuel Nickschas [Tue, 4 Sep 2018 23:13:11 +0000 (01:13 +0200)]
clang-tidy: Remove dead stores

5 years agoclang-tidy: Avoid warnings for calling virtual methods from ctor
Manuel Nickschas [Tue, 4 Sep 2018 22:37:25 +0000 (00:37 +0200)]
clang-tidy: Avoid warnings for calling virtual methods from ctor

MessageFilter and its derivatives call their idString() method
during construction in order to access their settings. This is fine,
but causes (legitimate) warnings in static analysis.

Make the scope explicit when calling idString() to avoid the warning,
and make it clear to readers that we're not interested in the derived
version.

5 years agoclang-tidy: Don't make methods virtual for no reason in SslServer
Manuel Nickschas [Tue, 4 Sep 2018 21:47:44 +0000 (23:47 +0200)]
clang-tidy: Don't make methods virtual for no reason in SslServer

SslServer was calling virtual methods during construction, which is
dangerous. Turns out those methods don't even need to be virtual, so
unvirtualize them.

5 years agoclang-tidy: Add nullptr check
Manuel Nickschas [Tue, 4 Sep 2018 21:26:08 +0000 (23:26 +0200)]
clang-tidy: Add nullptr check

5 years agoclang-tidy: Avoid potential memory leak in BufferViewManager
Manuel Nickschas [Tue, 4 Sep 2018 21:19:22 +0000 (23:19 +0200)]
clang-tidy: Avoid potential memory leak in BufferViewManager

Explicitly delete a freshly created BufferViewConfig in case it cannot
be added, rather than relying on QObject parentship - clang-tidy
warns about that. I'm rather sure that this is a false positive, but
better safe than sorry.

Simplify and clean-up related code a bit.

5 years agoclang-tidy: Reorder NetworkMO attributes to avoid excessive padding
Manuel Nickschas [Mon, 3 Sep 2018 23:31:22 +0000 (01:31 +0200)]
clang-tidy: Reorder NetworkMO attributes to avoid excessive padding

Use a more optimal attribute order to avoid excessive padding in the
NetworkMO struct.

5 years agoclang-tidy: Reorder NetworkInfo attributes to avoid excessive padding
Manuel Nickschas [Mon, 3 Sep 2018 23:18:10 +0000 (01:18 +0200)]
clang-tidy: Reorder NetworkInfo attributes to avoid excessive padding

Use a more optimal attribute order to avoid excessive padding in the
NetworkInfo struct.
Remove the default constructor in favor of direct initialization.
Rewrite the comparison operator using a boolean expression instead
of a bunch of conditions.

5 years agocipher.cpp: Default to CBC instead of ECB
alturiak [Mon, 3 Sep 2018 18:35:20 +0000 (20:35 +0200)]
cipher.cpp: Default to CBC instead of ECB

For security reasons (and compatibility to other irc-client's implementations), default to CBC for blowfish encryption.

5 years agocommon: Add "--debug-irc" to log raw IRC messages
Shane Synan [Mon, 3 Sep 2018 04:36:23 +0000 (23:36 -0500)]
common: Add "--debug-irc" to log raw IRC messages

Add "--debug-irc" command-line option to Core and Monolithic to log
raw IRC messages to the log at Debug level.

Check for raw IRC logging in CoreNetwork and IrcParser, logging
anything sent and received with the Network ID and "<<" for received,
">>" for sent.

Add "--debug-irc-id" to limit raw logging to a specific Network ID,
handy for cores with multiple networks.  This option automatically
applies "--debug-irc".

These usually should be combined with "--loglevel Debug", though the
Monolithic build can show raw IRC messages in the "Debug Log" GUI
without setting that parameter.

CAUTION:  "--debug-irc" will leak all IRC passwords in plain text via
any configured logging receivers (file, syslog, etc) and should not
be used on production servers without taking special care to limit
access to logging output.

Note: The ideal approach is to have the core maintain the most recent
raw IRC logs on a rotating basis, allowing any client to request this
portion of logs on demand.  However, there's a lot more changes
involved, which might not be wise with the goal of stabilizing 0.13.

We should revisit this in the future.

5 years agoclient: Don't store the list of properties in every PropertyMapItem
Manuel Nickschas [Wed, 29 Aug 2018 20:11:46 +0000 (22:11 +0200)]
client: Don't store the list of properties in every PropertyMapItem

It's rather inefficient to store a QStringList in every item, since
it is the same for every type of item anyway. Use a pure virtual
accessor in the base class instead, and return a static QStringList
in every item type.

This prevents the usecase of adding properties dynamically after
creation, but we didn't use that feature anyway, so remove it.

5 years agoclient: Don't send dataChanged() before actually changing the data
Manuel Nickschas [Wed, 29 Aug 2018 19:02:41 +0000 (21:02 +0200)]
client: Don't send dataChanged() before actually changing the data

The PropertyMapItem didn't set a changed property before sending
the signal, so consumers synchronously reacting to dataChanged()
would still access the old value.

Not sure if this issue is the cause for some of the weird model
behavior we tend to see at times...

5 years agocommon: Port local nicks to NickHighlightMatcher
Shane Synan [Sat, 1 Sep 2018 21:37:32 +0000 (16:37 -0500)]
common: Port local nicks to NickHighlightMatcher

Port QtUiMessageProcessor nick highlights to NickHighlightMatcher
class, providing easy caching and simplifying expression handling.

This fixes nickname caching being reset when switching between
networks.

Add SIGNAL/SLOT traversal to pass on information about network
removal to clean up per-network nickname highlight caches, avoiding
memory leaks.

5 years agocommon: Port remote nicks to NickHighlightMatcher
Shane Synan [Sat, 1 Sep 2018 21:36:45 +0000 (16:36 -0500)]
common: Port remote nicks to NickHighlightMatcher

Port HighlightRuleManager nick highlights to NickHighlightMatcher
class, providing easy caching and simplifying expression handling.

This fixes nickname caching being reset when switching between
networks.

Add SIGNAL/SLOT traversal to pass on information about network
removal to clean up per-network nickname highlight caches, avoiding
memory leaks.

5 years agocommon: Add auto-caching NickHighlightMatcher
Shane Synan [Sat, 1 Sep 2018 21:33:03 +0000 (16:33 -0500)]
common: Add auto-caching NickHighlightMatcher

Add NickHighlightMatcher class to unify handling of nick highlight
matching in Quassel, including automatically updating the expression
matcher instance as needed per network.

Cached ExpressionMatch objects are updated on demand after any change
in nickname configuration or active/configured nicks.

This lays the foundation for performance and readibility improvements
in future commits.

5 years agoutil: Remove unused and broken scopeMatch()
Shane Synan [Sat, 1 Sep 2018 21:30:51 +0000 (16:30 -0500)]
util: Remove unused and broken scopeMatch()

Remove scopeMatch() from util.cpp - not only is it no longer needed,
superseded by ExpressionMatch, the scopeMatch behavior broke previous
Quassel functionality.

Details: Channel names can begin with "!", and scopeMatch() does not
support escaping "!" in the beginning of rules.  Escaping support
needs to be added.. but ExpressionMatch can now handle this.  Let us
keep the ugly parser loops confined to one place...

5 years agoclient: Port old HighlightRule to ExpressionMatch
Shane Synan [Sat, 1 Sep 2018 21:29:02 +0000 (16:29 -0500)]
client: Port old HighlightRule to ExpressionMatch

Port QtUiMessageProcessor HighlightRule objects to ExpressionMatch
class, providing easy caching and simplifying expression handling.

Migrate HighlightRule struct into a full-blown class for easier
management and greater assurance over automatic internal cache
management.

Port QtUiMessageProcessor to ExpressionMatch for nickname matching,
providing easy caching and simplifying expression handling.

Add tons of documentation comments, too, and fix up line lengths.

NOTE: Legacy highlight rules lack support for "sender", "ID", and
inverse rules.  There's no technical reason for this, just lack of
developer time.  Feel free to add support in the future!  Just make
sure to not miss any part - I'd suggest simply replacing the legacy
LegacyHighlightRule class in QtUiMessageProcessor with the full one
from HighlightRuleManager, and don't forget to fix
> QtUiMessageProcessor::HighlightRule::operator!=()
...and...
> QtUiMessageProcessor::HighlightRule::determineExpressions()

5 years agocommon: Fix whitespace CTCP ignore invalid index
Shane Synan [Sat, 1 Sep 2018 21:17:33 +0000 (16:17 -0500)]
common: Fix whitespace CTCP ignore invalid index

When constructing a CTCP ignore, check that splitting on whitespace
results in non-empty list before taking from the list.  If it's
empty, fall back to assuming any valid sender, i.e. "*"/".*"
depending on whether the rule is set as wildcard or regex.

This fixes issues when receiving a CTCP with an invalid CTCP ignore
rule such as "  ".

5 years agocommon: Port IgnoreListManager to ExpressionMatch
Shane Synan [Sat, 1 Sep 2018 21:40:21 +0000 (16:40 -0500)]
common: Port IgnoreListManager to ExpressionMatch

Port IgnoreListItem objects to ExpressionMatch class, providing easy
caching and simplifying expression handling.

Migrate IgnoreListItem struct into a full-blown class for easier
management and greater assurance over automatic internal cache
management.

Add tons of documentation comments, too, and fix up line lengths.

Thanks to @sandsmark for the initial efforts towards the
QRegularExpression migration; it helped a lot!

5 years agocommon: Port HighlightRule to ExpressionMatch
Shane Synan [Sat, 1 Sep 2018 21:02:00 +0000 (16:02 -0500)]
common: Port HighlightRule to ExpressionMatch

Port HighlightRule objects to ExpressionMatch class, providing easy
caching and simplifying expression handling.

Migrate HighlightRule struct into a full-blown class for easier
management and greater assurance over automatic internal cache
management.

Port HighlightRuleManager to ExpressionMatch for nickname matching,
providing easy caching and simplifying expression handling.
(Noticing a theme?)

Add tons of documentation comments, too, and fix up line lengths.

5 years agoclient: Handle newlines in Ignore rule scope edit
Shane Synan [Sat, 1 Sep 2018 20:53:16 +0000 (15:53 -0500)]
client: Handle newlines in Ignore rule scope edit

Handle "\n" and ";" as separator in scope rules.  This fixes using
newlines in the Configure Ignore Rule dialog.

Make use of ExpressionMatch::trimMultiWildcardWhitespace() to handle
all of the arcane details, unifying code into one place.

5 years agocommon: Add ExpressionMatchTests unit tests
Shane Synan [Sun, 2 Sep 2018 07:39:30 +0000 (02:39 -0500)]
common: Add ExpressionMatchTests unit tests

Add ExpressionMatchTests class to test the functionality of
ExpressionMatch, helping ensure it works across Qt 4 and Qt 5.

This is implemented as a series of Q_ASSERT()'s as Quassel does not
yet have an actual testing framework.  Once a test framework is
settled on, this class can be migrated to unit tests.

To use ExpressionMatchTests:

1.  Include it in "quassel.cpp"

2.  Call ExpressionMatchTests::runTests() near end of Quassel::init()
// DEBUG: Run tests!
ExpressionMatchTests::runTests();

5 years agocommon: Add auto-caching ExpressionMatch class
Shane Synan [Sun, 2 Sep 2018 16:52:12 +0000 (11:52 -0500)]
common: Add auto-caching ExpressionMatch class

Add ExpressionMatch class to unify handling of various search
expressions in Quassel, including automatically caching the regular
expression instances and providing Qt 4/5 compatibility.

The source expression depends on the matching mode:
* ExpressionMatch::MatchPhrase
Match the entire phrase, looking for whitespace or beginning/end
around either side of the phrase.  No further processing.
* ExpressionMatch::MatchMultiPhrase
Same as MatchPhrase, but split the expression on newlines ("\n") and
treat as match successful if any phrase is found.  This avoids having
to create multiple ExpressionMatch classes just to match multiple
phrases.
* ExpressionMatch::MatchWildcard
Split on ";" and newlines ("\n"), and apply basic wildcard globbing,
with "*" representing any characters and "?" a single character.
Prefixing a section with "!" turns it into an invert-match, negating
any other matching rules.  If only invert-match rules exist, matching
is true unless an invert-rule applies.  "\[...]" escapes the given
character.
* ExpressionMatch::MatchRegEx
Treat expression as a regular expression, inverting if prefixed with
"!" (and not escaped as "\!").

Cached regular expression objects are updated whenever changing any
parameters.

When Qt 4 support is dropped, the QT_VERSION macros can be adjusted.

This lays the foundation for performance and readibility improvements
in future commits.

5 years agoclient: Fix .ui reference to oxygen_icons.qrc
Shane Synan [Thu, 23 Aug 2018 03:41:23 +0000 (22:41 -0500)]
client: Fix .ui reference to oxygen_icons.qrc

Fix ignorelisteditdlg.ui's reference to oxygen_icons.qrc, pointing it
to the new location.

5 years agoWe don't need dbus on Windows
Hannah von Reth [Thu, 30 Aug 2018 21:04:53 +0000 (23:04 +0200)]
We don't need dbus on Windows

5 years agoDon't install clang on appveyor
Hannah von Reth [Thu, 30 Aug 2018 21:02:15 +0000 (23:02 +0200)]
Don't install clang on appveyor

5 years agomacos client: Fix copyright year in Info.plist
Manuel Nickschas [Wed, 29 Aug 2018 20:35:18 +0000 (22:35 +0200)]
macos client: Fix copyright year in Info.plist

5 years agomacos client: fix automatic GPU switching
Davide `rainbow` Gerhard [Wed, 29 Aug 2018 14:37:06 +0000 (16:37 +0200)]
macos client: fix automatic GPU switching

see https://codereview.qt-project.org/#/c/73839/

5 years agocore: Limit "User is away" to 1hr or when changed
Shane Synan [Thu, 23 Aug 2018 02:36:47 +0000 (21:36 -0500)]
core: Limit "User is away" to 1hr or when changed

Increase the "* User is away" silencing to one hour, and add tracking
for changes in away state.  Only print the "* User is away" if away
state has changed since last away message (including removing and
applying the same away message), or if 1 hour has elapsed.

This reduces the spamming of "* User is away" when one often knows
that, yes, the user is away.  Any change in away state or message
will still be shown.

5 years agocommon: Unify Date/Time formatting, UTC offset
Shane Synan [Thu, 23 Aug 2018 00:34:40 +0000 (19:34 -0500)]
common: Unify Date/Time formatting, UTC offset

Unify date/time formatting for the client UI, using
Qt::DateFormat::DefaultLocaleShortDate to respect the operating
system's configured locale.  This avoids Qt's kind-of-weird default
date/time format that mixes numbers and named short months/days.

See https://doc.qt.io/qt-5/qt.html#DateFormat-enum

Modify AM/PM detection to use application locale, which currently
defaults to system locale.  This avoids any inconsistencies should
Quassel later allow specifying an application-wide locale different
from the system locale.

In CTCP VERSION replies, always use UTC time in ISO8601 date format,
avoiding locale-specific replies and timezone differences.  This
fixes client version statistic-tracking software from treating
different languages and different timezones as unique versions of
Quassel IRC.

In CTCP TIME replies, use local time in ISO8601 date format with
timezone offset.  This provides a consistent format for others to
parse and still provides the timezone information.

Work around a Qt bug for the latter.

See https://bugreports.qt.io/browse/QTBUG-26161
And https://stackoverflow.com/questions/18750569/qdatetime-isodate-with-timezone

5 years agosettings: Fix defaults caching, cache key exists
Shane Synan [Wed, 22 Aug 2018 21:46:01 +0000 (16:46 -0500)]
settings: Fix defaults caching, cache key exists

Add separate cache of whether or not a settings key is persisted to
disk, separate from the cache of settings key values.  Modify
localKeyExists() to make use of this cache, offering a potential
slight performance boost.

Fix caching of default values as actual settings values by always
checking if the key is persisted to disk, returning the default value
if not.

This fixes ChatMonitorSettings's "OperationMode" getting set to
"InvalidMode" by ChatMonitorFilter::_operationMode's reading of a
default "InvalidMode", then when loading settings,
ChatMonitorSettingsPage::settings["OperationMode"] would incorrectly
default to "InvalidMode" instead of "OptOut".

Test case:
1.  Start with a fresh configuration.
2.  Open Chat Monitor settings, skipping first-run wizard/etc
3.  Check that "Opt Out" is the default mode
4.  Via qDebug() prints, check that ChatMonitorFilter still sees the
    default value as InvalidMode