quassel.git
5 years agoclient: Add Highlight Rules tooltips, UI polish
Shane Synan [Thu, 1 Mar 2018 12:48:47 +0000 (06:48 -0600)]
client: Add Highlight Rules tooltips, UI polish

Add tooltips to every element of Highlight/Highlight Ignore tables,
and to the Local Highlight table.

Update the "Channel" tooltip to describe the non-regular-expression
approach used now.

Rename "Import" to "Import Local", add tooltip to better describe
purpose.

Move "Highlight Ignore Rules" table into QGroupBox to place at even
height with "Highlight Rules" box, making it less jarring to switch
between the two.

5 years agoclient: Unify Local/Remote Highlights table order
Shane Synan [Thu, 1 Mar 2018 10:06:22 +0000 (04:06 -0600)]
client: Unify Local/Remote Highlights table order

Put "Enabled" at front of Local Highlights table column order,
matching the ordering and name of Remote Highlights.

5 years agoclient: Fix Local Highlights import to remote
Shane Synan [Thu, 1 Mar 2018 08:29:29 +0000 (02:29 -0600)]
client: Fix Local Highlights import to remote

Make "importRules()" a private slot, not just a private function.
This allows the button signal to connect to this function, making
imports work.

5 years agoReally use Remote Highlights for nick, not Local
Shane Synan [Thu, 1 Mar 2018 23:59:50 +0000 (17:59 -0600)]
Really use Remote Highlights for nick, not Local

Really disable local nick highlights by default.  This will affect
those who upgrade and haven't changed the default highlight settings.
No settings migration provided since we intend to migrate to
core-side highlights entirely in the future.

Really enable remote nick highlights by default, setting a default
value for when highlights are not yet set up.  Fixes behavior of no
nickname highlighting by default.

5 years agocommon: Put scopeMatch in util, use in highlights
Shane Synan [Thu, 1 Mar 2018 08:06:42 +0000 (02:06 -0600)]
common: Put scopeMatch in util, use in highlights

Move ignore rule scopeMatch() to util to share usage with highlight
rule scope matching.

Use scopeMatch() in highlight rule channel name processing.

Advantages:
> Simpler to manage common cases
> Shares the same rules as ignore lists, already-learned behavior
Disadvantages:
> No way to escape ';' in rules
> No longer able to use full regular expressions
> Breaks existing channel name rules (also applies to local!)

(Another approach is to keep only local highlight rules inconsistent)

5 years agocommon: Add inverted scope match rules to ignores
Shane Synan [Thu, 1 Mar 2018 05:54:10 +0000 (23:54 -0600)]
common: Add inverted scope match rules to ignores

Add support for inverted scope matching subrules to ignore entries.
A match now only happens when the string does NOT match ANY inverted
rules and matches AT LEAST one normal rule, unless no normal rules
exist (implicit wildcard match).

Example:
> #quassel*; #foobar; !#quasseldroid

Matches "#foobar" and anything "#quassel...", except for
"#quasseldroid"

Example:
> !#quassel*; !#foobar

Matches anything except for "#foobar" or anything "#quassel..."

5 years agoclient: Disable case-sensitive check for no nick
Shane Synan [Wed, 28 Feb 2018 01:34:10 +0000 (19:34 -0600)]
client: Disable case-sensitive check for no nick

Disable "Case sensitive" highlight checkbox when highlight nicks is
set to "No nicks", as it has no effect on outcome.

5 years agoAdd a Configure menu item to Networks in the buffer list
genius3000 [Wed, 23 Nov 2016 09:04:46 +0000 (02:04 -0700)]
Add a Configure menu item to Networks in the buffer list

Add 'Configure' above 'Disconnect' in the right-click menu from a
network in the buffer list. Clicking 'Configure' will open the
Configure Networks dialog to the selected network.
Fixes #607

5 years agocommon: Notify if key was removed from settings
Manuel Nickschas [Sun, 3 Jun 2018 22:04:47 +0000 (00:04 +0200)]
common: Notify if key was removed from settings

Settings have a notification feature so consumers can subscribe to
value changes. This notification should also be emitted in case
a settings key is removed altogether.

5 years agocommon: Improve logger configuration
Manuel Nickschas [Wed, 23 May 2018 22:24:28 +0000 (00:24 +0200)]
common: Improve logger configuration

Initialize logging earlier, so output during core initialization
gets routed properly.

Enable the logging options also for quasselclient; there's no good
reason to limit this to the core and monolithic client. However, as
a side-effect, the default log level is now Info also for the client,
so "-l Debug" must be specified on the command line to get debug
output.

5 years agocommon: Use override instead of virtual
Manuel Nickschas [Wed, 23 May 2018 21:08:54 +0000 (23:08 +0200)]
common: Use override instead of virtual

Avoids a warning for inconsistent overrides.

This commit finishes up the giant rollup PR provided by
@digitalcircuit to consolidate a number of conflicting and
interdepending PRs. Thanks a lot for all the work!

Closes GH-357.

5 years agocommon: Remove the lastAwayMessage Q_PROPERTY declaration
Manuel Nickschas [Wed, 23 May 2018 21:01:41 +0000 (23:01 +0200)]
common: Remove the lastAwayMessage Q_PROPERTY declaration

Since this property is only synced by pre-0.13 cores, and not used
by any released clients, it doesn't need to be marked as a Q_PROPERTY.

Also avoids a warning for the property not having a getter.

5 years agocore: Migrate SQLite schema to MSec, warn of slow
Shane Synan [Sun, 13 May 2018 20:46:11 +0000 (15:46 -0500)]
core: Migrate SQLite schema to MSec, warn of slow

Migrate SQLite schema to read and store time in milliseconds,
offering greater precision matching that of PostgreSQL.

On upgrade, run "UPDATE backlog SET time = time * 1000" to adjust
existing times.  This is a full backlog update, potentially taking
minutes to hours.

Based on testing, this was the fastest "proper" way to migrate an
existing database.  A pessimistic scenario, 328 MB database on a
Raspberry Pi 2 with Ubuntu 16.04 running from a Class 10 SD card
takes...
> In-place update (chosen method): 361.991s
> Create new table, multiply int:  905.749s
> Create new table, numeric:       983.501s

A normal HDD is much faster, e.g. 97.686s for the same database on a
5400 RPM drive, Seagate ST96812AS.
(Thanks @romibi for testing!)

Other methods may be faster, but may be more prone to mistakes down
the road.

Update the schema upgrade message to warn of delays for major
upgrades, and provide feedback when upgrade succeeds.

> Installed Schema (version %1) is not up to date. Upgrading to
> version %2...  This may take a while for major upgrades.

> Installed Schema successfully upgraded to version %1.

CAUTION:  Monolithic does not show any migration GUI.  Monolithic
installs with large databases on slower computers may appear to not
be responsive.  Include a mention of upgrade time in the release
notes.

5 years agoIrcUser: Rename lastAwayMessage to lastAwayMessageTime
Michael Marley [Sat, 12 May 2018 20:20:58 +0000 (16:20 -0400)]
IrcUser: Rename lastAwayMessage to lastAwayMessageTime

This will make it easier for clients to implement both at the same
time.  Also, add a backwards-compatibility function to allow old
cores to set the lastAwayMessageTime.  There is still no forwards-
compatibility (support for old clients on new cores) since no
existing clients do anything with lastAwayMessage.

5 years agoIrcUser: Use QDateTime for lastAwayMessage, not int
Michael Marley [Thu, 10 May 2018 18:32:31 +0000 (14:32 -0400)]
IrcUser: Use QDateTime for lastAwayMessage, not int

This converts the lastAwayTime to a 64-bit time.  Backwards-
compatibility is also included in Network to convert back and forth
between the old 32-bit type for legacy peers.  No backwards-
compatibility is provided for the SYNC call because the value is
never actually used in any existing clients.  New clients that want
to implement this functionality would need to implement the
LongTime feature.

5 years agoFinish 64-bit time conversion, modify protocol
Shane Synan [Fri, 11 May 2018 00:20:12 +0000 (19:20 -0500)]
Finish 64-bit time conversion, modify protocol

Convert the remaining uses of 32-bit quint-based
"[to|from|set]Time_t()" to the modern 64-bit qint64-based
"[to|from|set]MSecsSinceEpoch()", handling the Y2038 problem while
also gaining higher precision in some places.

For places where seconds are needed, e.g. converting incoming time
from the IRC protocol, make use of "[to|set|from]SecsSinceEpoch()"
instead.  As this was only added in Qt 5.8, use the "QT_VERSION"
macro for backwards compatibility, manually dividing by 1000 for the
"MSecs" function equivalents.

Beware, all new code should use "[to|from|set]MSecsSinceEpoch()" and
NOT use "[to|from|set]Time_t()", or you'll re-introduce Y2038 bugs!

Modify protocol to rename "LongMessageTime" to "LongTime", and
send/receive all times as "qint64" instead of "quint64" or "quint".
"LongMessageTime" was never in Quassel git master, so renaming it
should have no impact.

Modify Event timing to be 64-bit compatible, too.

"IrcUser::lastAwayMessage()" will be fixed in a follow-up commit.

SQLite millisecond precision will be fixed in a follow-up commit.

See https://doc.qt.io/qt-5/qdatetime.html
And https://doc.qt.io/qt-5/datastreamformat.html
And https://doc.qt.io/qt-5/qdatetime-obsolete.html

5 years agoChange Message::Flags/Type cast to Int, not UInt
Shane Synan [Tue, 8 May 2018 23:24:38 +0000 (18:24 -0500)]
Change Message::Flags/Type cast to Int, not UInt

Use toInt() for casting `Message::Flags` and `Message::Type`, instead
of toUint().

MSVC has trouble with uint-based enums, so Quassel switched to int
enums.  However, not all of the enum casts were converted, resulting
in needless unsigned-to-signed casting.

Thanks to @justJanne for reporting this.

5 years agocore: Fix 64-bit ID SQLite -> Postgres migration
Shane Synan [Sun, 13 May 2018 22:07:07 +0000 (17:07 -0500)]
core: Fix 64-bit ID SQLite -> Postgres migration

Change skipSteps and stepSize() from 32-bit int to qint64, avoiding
integer wraparound during backlog reading for migration.

This only gets triggered when a message with a 64-bit ID exists in
the SQLite backlog before migration.  One can force this by sending
a message with the text 'MARKER_MSG', then running this on the SQLite
database before migration.

INSERT INTO backlog (messageid, time, bufferid, type, flags,
                     senderid, senderprefixes, message)
VALUES (50000000005000000000000,
        (SELECT bufferid FROM backlog WHERE message = 'MARKER_MSG'),
        1, 1,
        (SELECT senderid FROM backlog WHERE message = 'MARKER_MSG'),
        "", "Test 64-bit message");

> Before, debug output
SQLi::readMo - skipSteps 42948, start 2147400383, stop 2147450383
SQLi::readMo - skipSteps 42949, start 2147450383, stop -2147466913
SQLi::readMo - skipSteps 42950, start -2147466913, stop -2147416913
...
SQLi::readMo - skipSteps 85898, start -66913, stop -16913
SQLi::readMo - skipSteps 85899, start -16913, stop 33087
SQLi::readMo - MsgId: 1, message: Connecting to chat.freenode.net:...
PSql::writeMo - MsgId: 1, message: Connecting to chat.freenode.net...
> After, debug output
SQLi::readMo - skipSteps 99999, start 4999950383, stop 5000000383
SQLi::readMo - MsgId: 5000000000, message: Test 64-bit message
PSql::writeMo - MsgId: 5000000000, message: Test 64-bit message

5 years agoUse 64-bit IDs for messages
Michael Marley [Fri, 9 Mar 2018 17:17:05 +0000 (12:17 -0500)]
Use 64-bit IDs for messages

Increase the length of message IDs from 32 to 64 bits, allowing for
many more total messages be stored.  Because messages are synced to
the client, this requires a protocol change.  The protocol change is
guarded behind a new feature flag that will retain backwards
compatibility with existing clients, at least until the IDs go above
the maximum for a 32-bit number.  At this point, legacy clients will
behave incorrectly or perhaps crash, but this is an acceptable risk
because in the current implementation, this event would cause the
core to behave incorrectly or crash.  The client is also still
limited to 32 bits worth of backlog per buffer displayed at once
(due to Qt limitations), but it would be highly unlikely to hit
this limit because the client becomes unusably slow with a small
fraction of that amount of backlog loaded in a single buffer.

For SQLite, no schema change was necessary as SQLite makes no
differentiation between the bitnesses of integers.

For PostgreSQL, this patch also changes senderId to 64-bit, but
this has no effect outside the PostgreSQL database driver.

This patch only changes the message ID to 64-bit.  All other IDs
are left at 32 bits because it is either exceedingly unlikely or
technically infeasible to have more than 32 bits worth of entries
in any of the other tables.  If, at some point, it is decided that
other IDs should also be 64-bit, the way in which the feature flag
affects (de)serialization will need to be changed.  This is because
the flag LongMessageId currently acts upon all IDs inheriting from
SignedId64 and it would be necessary to independently control the
(de)serialization of each ID if other IDs became 64-bit in order to
continue to maintain backwards compatibility.  One possible method
of doing this would be to subclass the SignedId64 class for each
ID that inherits from it to allow for separately controlling
(de)serialization for each of the types.  I have not implemented
this, however, because of the unlikelihood of any of the other IDs
ever being made 64-bit.

Closes GH-343.

5 years agocore: Allow configuring DB/auth from environment
Janne Koschinski [Tue, 8 May 2018 21:49:11 +0000 (16:49 -0500)]
core: Allow configuring DB/auth from environment

Add support for environment variables to configure database and
authenticator backends.  This improves using Quassel in a container
-based system as no configuration file needs to be written.

Toggle use of environment variables via a new CLI switch,
'--config-from-environment', which will disregard the core settings
file (if it exists) and use environment variables instead.

New environment variables:
> Backend selection
DB_BACKEND = ["SQLite", "PostgreSQL"]
AUTH_AUTHENTICATOR = ["Database", "LDAP"]
> PostgreSQL connection properties
DB_PGSQL_USERNAME
DB_PGSQL_PASSWORD
DB_PGSQL_HOSTNAME
DB_PGSQL_PORT
DB_PGSQL_DATABASE
> LDAP connection properties
AUTH_LDAP_HOSTNAME
AUTH_LDAP_PORT
AUTH_LDAP_BIND_DN
AUTH_LDAP_BIND_PASSWORD
AUTH_LDAP_BASE_DN
AUTH_LDAP_FILTER
AUTH_LDAP_UID_ATTRIBUTE

Closes GH-341.

5 years agocore: Store session state in database, migrate old
Janne Koschinski [Sat, 3 Mar 2018 07:45:31 +0000 (08:45 +0100)]
core: Store session state in database, migrate old

Store core session state in database rather than configuration file.
This improves containerization as the configuration file doesn't need
to be preserved, and also makes database restoration handle restoring
active sessions.

Migrate existing legacy sessions to database storage, ensuring that
the core state fallback is handled correctly, too.

Part of GH-341.

5 years agoImplement type-filtered backlog fetching
Janne Koschinski [Tue, 8 May 2018 20:50:41 +0000 (15:50 -0500)]
Implement type-filtered backlog fetching

Add new backlog fetching methods that only return messages of the
specified types.  This allows clients to only fetch the types of
messages that they need, e.g. if join/part/quit is hidden.

This is not yet used in Quassel itself, but third-party clients
including QuasselDroid use this for better performance on limited
bandwidth networks.

Signed-off-by: Janne Koschinski <janne@kuschku.de>
Closes GH-339.

5 years agocore: Fix PostgreSQL realname/avatarurl handling
Shane Synan [Fri, 11 May 2018 06:37:55 +0000 (01:37 -0500)]
core: Fix PostgreSQL realname/avatarurl handling

In insert_message, when selecting a senderid coalesce "realname" and
"avatarurl".  This fixes inserting redundant senders due to NULL
values, e.g. messages from the server during connect.

Test case: start up core, client.  Connect, check PostgreSQL database
"sender" table.  Disconnect, reconnect.  There shouldn't be new NULL
senders in the table (e.g. sender set, but NULL realname).

NOTE: The realname/avatarurl columns can be NULL values.  Due to
this, we need to coalesce them to '' in order to use the same queries
rather than "column = some value" and "column IS NULL".  Both column
and the input parameter need coalesced in case one or the other is
NULL.  As there's minimal functional difference in protocol handling
between '' and NULL, we consider them the same.

(This could be squashed down if preferred, I just wanted to document
 what was needed to fix this for PostgreSQL, and to simplify figuring
 out what to change should a better solution arise.)

5 years agocore: Fix SQLite realname/avatarurl handling
Shane Synan [Fri, 11 May 2018 05:36:21 +0000 (00:36 -0500)]
core: Fix SQLite realname/avatarurl handling

In insert_message, when selecting a senderid also match on "realname"
and "avatarurl".  This fixes cases where sometimes senderid would
refer to a sender without a realname after a realname was added, etc.

Test case: start up core, client.  Send several messages quickly after
joining.  Shut down core, check SQLite database "sender" table.

Before this fix, once a sender entry is put in, sometimes
permutations of realname/avatarurl would NOT create a new sender
entry, clearly visible in QuasselDroid's display of of the realname.

After this fix, changing realname/avatarurl causes new sender entries
to be added every single time there's a change, as expected, and they
display correctly in QuasselDroid.

PostgreSqlStorage was immune to this, but for once, not due to being
a better database, but due to how the queries are constructed.  For
PostgreSQL, senders were always fetched separately, properly checking
avatarurl and realname.

NOTE: The realname/avatarurl columns can be NULL values.  Due to
this, we need to coalesce them to '' in order to use the same queries
rather than "column = some value" and "column IS NULL".  Both column
and the input parameter need coalesced in case one or the other is
NULL.  As there's minimal functional difference in protocol handling
between '' and NULL, we consider them the same.

(This could be squashed down if preferred, I just wanted to document
 what was needed to fix this and why only SQLite was changed.)

5 years agoImplement sender realname/avatarurl storage
Janne Koschinski [Tue, 8 May 2018 20:17:38 +0000 (15:17 -0500)]
Implement sender realname/avatarurl storage

- Store sender realname and avatarurl in database
- Guard protocol changes behind feature flag 'RichMessages'
- Avatar URLs are not actually stored yet, as we do not implement
  METADATA yet.

This is not yet used in Quassel itself, but third-party clients
including QuasselDroid use this to provide more context in messages
and allow for realname-based fallback avatar fetching to work in the
chat message backlog.

Incorporates suggestions from @mamarley.

Closes GH-351.

5 years agoprotocol: Implement 64-bit message timestamps
Janne Koschinski [Tue, 10 Apr 2018 23:58:09 +0000 (01:58 +0200)]
protocol: Implement 64-bit message timestamps

Add serialization and feature flag for 64-bit message timestamp.
Avoids a Y2038 problem and offers higher message time accuracy.

Closes GH-340.

5 years agoStore highlight status per buffer coreside
Janne Koschinski [Tue, 8 May 2018 18:36:25 +0000 (13:36 -0500)]
Store highlight status per buffer coreside

- Add highlightCount to buffersyncer, same as with buffer activities
- If this value is increased, it is synced with clients, and they add
  it to the buffer status, showing it in orange
- This allows you to see highlights even if they are not loaded in
  initial backlog, but only core-side highlights.

Closes GH-333.

5 years agoPersist Blowfish keys in the database
Michael Marley [Tue, 8 May 2018 18:49:33 +0000 (13:49 -0500)]
Persist Blowfish keys in the database

Add a new text field called "cipher" and store the hex-encoded
cipher key there whenever a new key is set or exchanged.  Also,
when each network is initialized, load the ciphers out of the
database and initialize the in-memory hashmap.  Then, the existing
behavior of each CoreIrcNetwork automatically using these keys
upon construction occurs.

Additionally, this makes PM buffer ciphers persistent both across
destruction/construction and across core restarts.

Note that the existing "key" field in the database is confusingly
named.  It does not contain any sort of cryptographic key but
instead holds channel passwords.

Closes #1473

Closes GH-332.

5 years agocore: Avoid confusing log message when legacy client connects
Manuel Nickschas [Thu, 17 May 2018 19:37:46 +0000 (21:37 +0200)]
core: Avoid confusing log message when legacy client connects

Older clients don't report the features they support, which resulted
in a log message listing all features as missing if such a client
connected.
Handle this special case by checking if any client feature is enabled,
and if not, providing a different log message to avoid user
confusion.

5 years agoFixes the Highlight Rule Manager
Janne Koschinski [Tue, 17 Apr 2018 02:08:10 +0000 (04:08 +0200)]
Fixes the Highlight Rule Manager

- Previously, sync calls included the new HighlightNickType
- This causes deserialization trouble in older clients
- Now int is used, and the data is static_cast'd back and forth

5 years agoSome cleanups
Manuel Nickschas [Mon, 7 May 2018 20:20:10 +0000 (22:20 +0200)]
Some cleanups

* Use properly camel-cased method names
* Use override instead of virtual to avoid warnings
* Simplify some code

Closes GH-348.

5 years agoCache strict sysident mappings
Michael Marley [Wed, 4 Apr 2018 12:25:14 +0000 (08:25 -0400)]
Cache strict sysident mappings

To avoid unnecessary database hits, we store a mapping of all permitted
strict sysidents in memory. This mapping is reloaded on SIGHUP.

A miss will make a call to the database.

Co-authored-by: Sai Nane <esainane+github@gmail.com>
Co-authored-by: Michael Marley <michael@michaelmarley.com>
5 years agoAdd strict-oidentd mode
Michael Marley [Tue, 3 Apr 2018 18:21:11 +0000 (14:21 -0400)]
Add strict-oidentd mode

This mode is disabled by default.  When specified, this restricts
authoratative ident responses to be the authuser account name.

This is a cut-down version of,
https://github.com/quassel/quassel/pull/164 which was originally
authored by @esainane.  @AlD requested that the database schema
change be removed, but the request fell dormant and was eventually
closed.  This version removes the schema change as requested,
always using the user's core username as the ident when enabled.

Co-authored-by: Sai Nane <esainane+github@gmail.com>
Co-authored-by: Michael Marley <michael@michaelmarley.com>
5 years agoAdd support for Elliptic Curve keys for CertFP
Michael Marley [Sat, 31 Mar 2018 18:06:16 +0000 (14:06 -0400)]
Add support for Elliptic Curve keys for CertFP

This functionality is controlled by a feature flag so that clients
supporting EC keys won't try to set an EC key on a core that
doesn't.  As with the previous EC patch, this requires Qt 5.5 to
work but uses the QT_VERSION macro to remain compileable with Qt4.

This patch also fixes the QSsl::KeyAlgorithm indices to be correct
for both Qt4 and Qt5.  In Qt4, RSA was 0 and DSA was 1, but in Qt5
0 became Opaque, 1 because RSA, and two became DSA.  EC is 3 and
wasn't added until 5.5.  The new macro handles all three versions
correctly.  (See https://doc.qt.io/qt-5/qssl.html#KeyAlgorithm-enum
and https://doc.qt.io/archives/qt-4.8/qssl.html#KeyAlgorithm-enum.)
Thanks to @justJanne for pointing out this discrepancy.

Closes GH-347.

5 years agocmake: Fix build with Qt 5.11
Manuel Nickschas [Thu, 3 May 2018 21:19:34 +0000 (23:19 +0200)]
cmake: Fix build with Qt 5.11

Qt 5.11 removes the qt5_use_modules function, so add a copy. If
present, the Qt-provided function will be used instead.

Closes GH-355.

5 years agoImprove channel navigation shortcut in some cases
romibi [Tue, 23 Jan 2018 00:17:42 +0000 (01:17 +0100)]
Improve channel navigation shortcut in some cases

Select first/last if nothing selected yet
Enable wrap around navigation

Closes GH-323.

5 years agocore: handleMode: Fix persistent modes reset
genius3000 [Thu, 11 Jan 2018 04:54:41 +0000 (21:54 -0700)]
core: handleMode: Fix persistent modes reset

The check for '-reset' currently comes after a bufferName is
prepended to params, therefore never being true.
Move this check to be first and add a reply to the client.

Closes GH-322.

5 years agoFix support for extended features on Qt4
Janne Koschinski [Wed, 11 Apr 2018 01:16:21 +0000 (03:16 +0200)]
Fix support for extended features on Qt4

- On Qt4, Q_ENUMS can *not* handle enum class, but only enum
- This patch adds an #ifdef to only use enum class on Qt5

Closes GH-352.

5 years agoUpdate ChangeLog
Manuel Nickschas [Mon, 23 Apr 2018 21:37:04 +0000 (23:37 +0200)]
Update ChangeLog

5 years agoUpdate AboutData
Manuel Nickschas [Mon, 23 Apr 2018 21:36:56 +0000 (23:36 +0200)]
Update AboutData

5 years agoReject clients that attempt to login before the core is configured
Michael Marley [Mon, 2 Apr 2018 23:11:31 +0000 (19:11 -0400)]
Reject clients that attempt to login before the core is configured

Properly-implemented clients should never try to do this, but if it
is done, this patch prevents it from crashing the core.

Thanks to @chaign_c (https://twitter.com/chaign_c/) for finding this
issue.

5 years agoImplement custom deserializer to add our own sanity checks
Janne Koschinski [Mon, 2 Apr 2018 20:26:34 +0000 (22:26 +0200)]
Implement custom deserializer to add our own sanity checks

This is a rough first implementation in preparation of writing
proper serializers independently of QDataStream.

Thanks to @chaign_c (https://twitter.com/chaign_c/) for finding
issues with QDataStream that prompted this change.

6 years agouisupport: Forcefully disable horizontal scrollbar in BufferView
Manuel Nickschas [Thu, 12 Apr 2018 20:38:02 +0000 (22:38 +0200)]
uisupport: Forcefully disable horizontal scrollbar in BufferView

Qt 5.10.1 severly broke QHeaderView and by extension, QTreeView,
resulting in a horizontal scrollbar being shown. In order to avoid
making this issue too obvious for people using that version of Qt
(including the builds currently generated by our CI), force the
scrollbar to be hidden in BufferView.

The contents can still be scrolled sideways e.g. with horizontal
mouse wheel emulation, but that should not hit many users in
practice.

Earlier or later versions of Qt seem to not suffer from that issue,
but always hiding the scrollbar doesn't hurt either way.

6 years agocmake: Add exception handling support to MSVC compile flags
Manuel Nickschas [Tue, 10 Apr 2018 20:18:33 +0000 (22:18 +0200)]
cmake: Add exception handling support to MSVC compile flags

Since STL types may throw, MSVC needs to get told to support
exceptions by specifying the /EHsc flag. Otherwise, it warns about
the lack thereof, even though Quassel itself does not use nor handle
exceptions.

Closes GH-350.

6 years agoSemi-yearly copyright bump
Manuel Nickschas [Tue, 10 Apr 2018 19:59:19 +0000 (21:59 +0200)]
Semi-yearly copyright bump

It's no longer 2016.

6 years agoPackage Mac Style plugin (for Qt 5.10+)
romibi [Fri, 6 Apr 2018 17:25:17 +0000 (19:25 +0200)]
Package Mac Style plugin (for Qt 5.10+)

Closes GH-349.

6 years agoPostgreSqlStorage: Fix apparently-incorrect index in requestAllMsgs
Michael Marley [Tue, 27 Mar 2018 23:41:28 +0000 (19:41 -0400)]
PostgreSqlStorage: Fix apparently-incorrect index in requestAllMsgs

This function was using 1 for its date index, which is the same
index as was used for bufferid.  The correct index to use is 2.

Closes GH-346.

6 years agoSslServer: Add support for Elliptic Curve keys
Michael Marley [Mon, 26 Mar 2018 02:11:39 +0000 (22:11 -0400)]
SslServer: Add support for Elliptic Curve keys

If the key won't load as an RSA key, attempt to load it again as an
EC key.  DSA support was not added because DSA is obsolete and no-
one should be using it.

Note that this only works with Qt5.5 and up as EC support was added
in that version (https://github.com/qt/qtbase/commit/962ea569). An
if macro has been used to allow for continued compilation under Qt4
and Qt5<5.5.

Closes GH-344.

6 years agoChange HTTP links to HTTPS for quassel-irc.org and subdomains
phuzion [Tue, 27 Feb 2018 21:25:35 +0000 (21:25 +0000)]
Change HTTP links to HTTPS for quassel-irc.org and subdomains

Closes GH-335.

6 years agocore: Fix CAP REQ display for SASL only supported
Shane Synan [Tue, 27 Feb 2018 19:50:43 +0000 (13:50 -0600)]
core: Fix CAP REQ display for SASL only supported

Modify queuedCapsDisplay to only add a ", " when both
_capsQueuedIndividual and _capsQueuedBundled are not empty.  This
avoids adding a spurious ", " when there's only individual caps, e.g.
SASL.  Though the docs don't mention it, QStringList.join() will only
add the separator when there's more than one item in the list.

Before:
* Negotiating capabilities (requesting: sasl, )...
After:
* Negotiating capabilities (requesting: sasl)...

See https://doc.qt.io/qt-5/qstringlist.html#join

Closes GH-334.

6 years agoLock Toolbars too
romibi [Mon, 5 Mar 2018 17:54:15 +0000 (18:54 +0100)]
Lock Toolbars too

Closes GH-324.

6 years agoLock Buffer- and Nick-Lists too
romibi [Wed, 31 Jan 2018 15:13:37 +0000 (16:13 +0100)]
Lock Buffer- and Nick-Lists too

Fixes #1465

6 years agoclient: Remove unused attribute
Manuel Nickschas [Thu, 5 Apr 2018 21:54:02 +0000 (23:54 +0200)]
client: Remove unused attribute

Clang warns about this.

6 years agoqa: Replace [[fallthrough]] by [[clang::fallthrough]]
Manuel Nickschas [Tue, 27 Feb 2018 10:33:03 +0000 (11:33 +0100)]
qa: Replace [[fallthrough]] by [[clang::fallthrough]]

The [[fallthrough]] attribute is a C++17 extension. It happens to work
in GCC 7, but causes warnings or even failures in other compilers.

In my quest to find a syntax that makes all compilers happy without
having to disable the (useful) warning, I think I have finally
found a way. Using the clang:: namespace seems to solve several
issues:

* It is marked as a compiler extension, so compilers not supporting it
  should simply ignore the attribute
* It (obviously) works in Clang, which is nice when using a Clang-based
  IDE like Qt Creator
* For some reason, it also seems to silence warnings in GCC; I guess one
  of GCC's fancy regexes somehow matches

6 years agoCorrect issue where messages were over-trimmed
Daniel Silverstone [Wed, 7 Feb 2018 10:51:55 +0000 (10:51 +0000)]
Correct issue where messages were over-trimmed

In an attempt to correct a problem with quasseldroid multiline
messages (97a9b1646bb0d6362cef14bac3a577481cc01e49) the core started
trimming leading whitespace from lines. This broke pasting of things
like formatted code.

This commit ensures that only the splitting is done, and that we skip
empty lines when handling /SAY since they sometimes cause issues on
networks and the clients which split client-side already skip empty
lines.

Closes GH-331.

6 years agoSupport $i:account in aliases
Svetlana Tkachenko [Mon, 8 Jan 2018 04:44:17 +0000 (04:44 +0000)]
Support $i:account in aliases

Closes GH-321.

6 years agoSupport $i:ident in aliases
Svetlana Tkachenko [Mon, 8 Jan 2018 00:39:45 +0000 (00:39 +0000)]
Support $i:ident in aliases

https://bugs.quassel-irc.org/issues/1454

Implements #1454.

6 years agoclient: Avoid warning for unused argument
Manuel Nickschas [Wed, 28 Mar 2018 21:17:04 +0000 (23:17 +0200)]
client: Avoid warning for unused argument

6 years agoFix compile error with Qt4
Janne Koschinski [Fri, 22 Dec 2017 02:47:09 +0000 (03:47 +0100)]
Fix compile error with Qt4

In Qt4, signals are protected, therefore we can’t emit a signal on
Client from the ClientUserInputHandler.

Therefore we wrap the signal emitter with a function on the Client.

Closes GH-320.

6 years agoMake /list open the Channel List dialog
Janne Koschinski [Fri, 22 Dec 2017 01:39:43 +0000 (02:39 +0100)]
Make /list open the Channel List dialog

6 years agoIgnore self messages
Janne Koschinski [Sun, 18 Feb 2018 20:14:35 +0000 (21:14 +0100)]
Ignore self messages

Closes GH-317.

6 years agoPer default, set local nick highlight to none
Janne Koschinski [Thu, 21 Dec 2017 23:20:15 +0000 (00:20 +0100)]
Per default, set local nick highlight to none

6 years agoPer popular request, always enable local highlights
Janne Koschinski [Thu, 21 Dec 2017 22:50:26 +0000 (23:50 +0100)]
Per popular request, always enable local highlights

6 years agoFix an issue where empty elements were shown in the highlight list
Janne Koschinski [Thu, 21 Dec 2017 22:48:03 +0000 (23:48 +0100)]
Fix an issue where empty elements were shown in the highlight list

- Replace clearContents with while (rowCount()) removeRow

6 years agoOnly enable the relevant highlight depending on core features
Janne Koschinski [Thu, 21 Dec 2017 21:18:11 +0000 (22:18 +0100)]
Only enable the relevant highlight depending on core features

- If connected to a modern core, disable local highlights
- Otherwise, disable remote highlights

6 years agoAdd an import button to import local rules into the new page
Janne Koschinski [Thu, 21 Dec 2017 21:07:55 +0000 (22:07 +0100)]
Add an import button to import local rules into the new page

6 years agoDisable the highlights page when not connected
Janne Koschinski [Thu, 21 Dec 2017 20:57:03 +0000 (21:57 +0100)]
Disable the highlights page when not connected

6 years agocommon: Set sourcePeer() also for internal (mono) connections
Manuel Nickschas [Mon, 26 Mar 2018 22:04:01 +0000 (00:04 +0200)]
common: Set sourcePeer() also for internal (mono) connections

So far, SignalProxy::sourcePeer() was only set while processing
messages from remote peers. Set this also for internal connections.

Also remove InternalPeer's special-casing for in-thread communication,
as the two connected peers always live in different threads anyways.

Closes GH-345.

6 years agocommon: Represent core/client features as string list in the protocol
Manuel Nickschas [Wed, 21 Mar 2018 23:58:46 +0000 (00:58 +0100)]
common: Represent core/client features as string list in the protocol

The previous way of representing all supported features as a bit-wise
combination of flags is reaching its limits, due to the fact that the
old Features enum didn't have a defined width, and thus the compiler
can (and does) choose to represent it as a 16 bit value even though
the serialization in the protocol is defined as a 32 bit value.

In order to solve this problem, and to make feature negotiation more
robust, a new field "FeatureList" is added to both "ClientInit"
and "ClientInitAck" handshake messages that holds a string list with
the supported features.

Clients still send both "Features" and "FeatureList" fields when
registering, in order to support older cores. The core now omits
the legacy "CoreFeatures" field if the client indicates support
for extended features. Support for extended features is indicated
as the legacy feature 0x8000.

Note that legacy features are a subset of the new extended features.
Clients supporting extended features are encouraged to send the
full list, including legacy ones, in their FeatureList field.

Internally, the string-based feature list is mapped to a
std::vector<bool> to provide for fast lookup of enabled features.
The new methods Client::isCoreFeatureEnabled() and Peer::hasFeature()
allow for convenient checking.

Both client and core now output a log message if there is a mismatch
between the peers.

6 years agocommon: Make the Quassel class a proper singleton, clean up
Manuel Nickschas [Wed, 21 Mar 2018 00:41:28 +0000 (01:41 +0100)]
common: Make the Quassel class a proper singleton, clean up

No longer have the various application classes inherit from the
Quassel class, which is a precondition for making the latter a
QObject down the line. Enable application-specific config reload
and quit behaviors by providing the means to register handler
functions, replacing the previous inheritance-based mechanism.

Make the Quassel class a proper singleton, remove inline functions
and modernize the code.

6 years agouistyle: Ignore format code for Monospace
Manuel Nickschas [Wed, 7 Mar 2018 23:53:50 +0000 (00:53 +0100)]
uistyle: Ignore format code for Monospace

Since the current rendering engine does not easily support switching
fonts in the middle of a message, we can't currently support the
Monospace format code as specified in [1].
However, to avoid weird artifacts when other clients send this, ignore
the format code for now.

[1] https://modern.ircdocs.horse/formatting.html#monospace

Closes GH-342.

6 years agouistyle: Support rendering of strikethrough'd text
Manuel Nickschas [Wed, 7 Mar 2018 23:47:39 +0000 (00:47 +0100)]
uistyle: Support rendering of strikethrough'd text

As defined in [1], format code 0x1e indicates text that is struck
through. Add support for rendering this accordingly.

Extend the stylesheet parser so the format can be defined, and
add to the default stylesheet.

[1] https://modern.ircdocs.horse/formatting.html#strikethrough

6 years agouistyle: Support reverse color rendering
Manuel Nickschas [Wed, 7 Mar 2018 23:22:24 +0000 (00:22 +0100)]
uistyle: Support reverse color rendering

Format codes 0x12 and 0x16 toggle the swap of foreground and
background colors. In the current implementation, the color
swap only applies to custom colors, i.e. mIRC colors and hex
colors. Normal text is not affected.

Since this is not a styleable property, remove support for it
from the stylesheet parser.

6 years agouistyle: Define via stylesheet if color codes have an effect
Manuel Nickschas [Wed, 7 Mar 2018 19:59:37 +0000 (20:59 +0100)]
uistyle: Define via stylesheet if color codes have an effect

In certain situations, color codes should have no effect, e.g. when
selecting text. This required hacks in stylesheets; for example
when setting a foreground color for self or highlighted messages,
the mIRC colors had to be redefined in the stylesheet for that label.
Also the code had some workaround, e.g. for URLs.

With the introduction of the non-styleable extended mIRC and
hex colors, these workarounds are no longer possible.

Solve these issues by introducing two new properties that can be set
in the stylesheet:

allow-foreground-override: true|false
allow-background-override: true|false

The default stylesheet sets them to true by default, and to false
e.g. for selections.

Remove the now unneeded workaround from m4yer's stylesheet, too.

6 years agouistyle: Support rendering of hex colors
Manuel Nickschas [Wed, 7 Mar 2018 18:37:12 +0000 (19:37 +0100)]
uistyle: Support rendering of hex colors

Hex colors are a relatively new addition to IRC, as defined in
<https://modern.ircdocs.horse/formatting.html#hex-color>.

Note that there are known issues with prioritization in the theme
engine (i.e., setting the foreground explicitly in the stylesheet
will always override hex colors), which will be fixed in a follow-up
commit.

6 years agouistyle: Fix weird way of registering Qt types
Manuel Nickschas [Wed, 7 Mar 2018 00:38:53 +0000 (01:38 +0100)]
uistyle: Fix weird way of registering Qt types

Well, maybe it didn't seem so weird a decade ago, but these days
we can do type registration in a nicer way.

6 years agouistyle: Support extended mIRC colors
Manuel Nickschas [Wed, 7 Mar 2018 00:31:34 +0000 (01:31 +0100)]
uistyle: Support extended mIRC colors

Support mIRC color values between 16 and 98, as specified in [1].
Extended color values are not styleable.

[1] https://modern.ircdocs.horse/formatting.html

6 years agouistyle: Add more type-safety to UiStyle, and clean up a bit
Manuel Nickschas [Tue, 6 Mar 2018 20:07:42 +0000 (21:07 +0100)]
uistyle: Add more type-safety to UiStyle, and clean up a bit

Migrate all UiStyle enums to be enum classes. Enforce explicit types
instead of quint32 in most places using them, and handle MessageLabel
in a more obvious fashion. A bunch of bit-wise operators had to be
added to avoid lots of boilerplate when dealing with the enums.

FormatList now holds the formats in a struct rather than as plain enum
(or quint32) values. This will be needed for extended color support;
as the format type cannot hold the hard-coded extended color values,
the colors will be stored explicitly in the list and applied as
appropriate.

Also, in the quest to modernize the codebase, FormatList is now a
std::vector rather than a QList.

6 years agoUpdate stripFormatCodes() for additional formatting characters
Michael Marley [Thu, 1 Mar 2018 22:19:47 +0000 (17:19 -0500)]
Update stripFormatCodes() for additional formatting characters

 - \x04 for hex color (IRCCloud)
 - \x11 for monospace (IRCCloud)
 - \x1e for strikethrough (Textual)

This patch does not actually add support for rendering those
styles, but at least ensures that highlighting still works
correctly if they are used.

Closes GH-337.

6 years agodcc: Disable DCC features until they're ready for public consumption
Manuel Nickschas [Thu, 1 Mar 2018 23:06:21 +0000 (00:06 +0100)]
dcc: Disable DCC features until they're ready for public consumption

Don't advertise that we support DCC when we actually don't yet. Also,
don't create the transfer widget and settings page for now.

6 years agoproxy: Actually fix settings migration logic
Manuel Nickschas [Thu, 1 Mar 2018 21:03:53 +0000 (22:03 +0100)]
proxy: Actually fix settings migration logic

Not sure what the previous code was supposed to accomplish, but
proxy settings are stored in [CoreAccounts] and thus migration needs
to happen for each configured account. Also, the UseProxy flag was
removed and thus must be translated to ProxyType::NoProxy.

Closes GH-181.

6 years agoReorder includes alphabetically
Javier Llorente [Sun, 10 Sep 2017 21:31:03 +0000 (23:31 +0200)]
Reorder includes alphabetically

6 years agoMove account details out of 'ManualProxy'
Javier Llorente [Sun, 10 Sep 2017 21:28:26 +0000 (23:28 +0200)]
Move account details out of 'ManualProxy'

6 years agoUpdate VERSION_MINOR_CURRENT, realign spaces for comment (case 4)
Javier Llorente [Sat, 7 Jan 2017 00:27:37 +0000 (01:27 +0100)]
Update VERSION_MINOR_CURRENT, realign spaces for comment (case 4)

6 years agoAdd case 4 for new proxy type default value
Javier Llorente [Fri, 6 Jan 2017 23:03:12 +0000 (00:03 +0100)]
Add case 4 for new proxy type default value

6 years agoAdd system proxy support for quassel-client
Javier Llorente [Sun, 7 Feb 2016 23:36:17 +0000 (00:36 +0100)]
Add system proxy support for quassel-client

6 years agoqtui: Avoid bogus tr() context warning
Manuel Nickschas [Tue, 27 Feb 2018 22:28:31 +0000 (23:28 +0100)]
qtui: Avoid bogus tr() context warning

lupdate in Qt versions prior to 5.6.1 has issues parsing brace-
initialization in constructors, and complains about "tr() cannot
be called without context". Work around this by explicitly giving
the class name as suggested in QTBUG-34128.

6 years agoFix compile error with Qt4
Janne Koschinski [Fri, 22 Dec 2017 02:46:12 +0000 (03:46 +0100)]
Fix compile error with Qt4

In Qt4, signals are protected, therefore we can’t emit a signal on
Client from the ClientUserInputHandler.

Therefore we wrap the signal emitter with a function on the Client.

Closes GH-318.

6 years agoImplement /ignore functionality
Janne Koschinski [Thu, 21 Dec 2017 22:22:52 +0000 (23:22 +0100)]
Implement /ignore functionality

- If /ignore <nickname> is used, a new rule for nickname!*@* is added,
  with dynamic strictness, limited to the current network.
- If /ignore <rule> (where rule contains ! or @) is used, that rule is
  added, with dynamic strictness, limited to the current network.
- If /ignore with no parameters is used, the ignore list is shown

6 years agoPolish session list UI
Janne Koschinski [Thu, 21 Dec 2017 20:43:18 +0000 (21:43 +0100)]
Polish session list UI

- Only show disconnect button if available
- Show if client is connected securely
- Make the UI look more native

Closes GH-316.

6 years agoTransmit feature flag for remote disconnecting with peer info
Janne Koschinski [Thu, 21 Dec 2017 20:42:26 +0000 (21:42 +0100)]
Transmit feature flag for remote disconnecting with peer info

6 years agoIntroduce feature flag for remote disconnecting
Janne Koschinski [Thu, 21 Dec 2017 20:42:10 +0000 (21:42 +0100)]
Introduce feature flag for remote disconnecting

6 years agoUse craft on appveyor
Hannah von Reth [Wed, 21 Jun 2017 12:17:50 +0000 (14:17 +0200)]
Use craft on appveyor

This will use the well maintained packages from Craft.
It will reduce the maintenance cost for providing a Windows installer.
Additionally we now use up to date binaries built exactly for this compiler,
so we no longer depend on 33dparty openssl binaries etc.

Using and deploying KDE Framework 5 libaries on Windows is also possible now.
This build provides KDE Sonnet

Find out more about Craft: https://community.kde.org/Craft
Contribute to the Quassel blueprint:
https://github.com/KDE/craft-blueprints-kde/blob/master/qt-apps/quassel/quassel.py

Closes GH-312.

6 years agouisupport: Also fix doubleclick in nick views
Manuel Nickschas [Tue, 27 Feb 2018 09:59:52 +0000 (10:59 +0100)]
uisupport: Also fix doubleclick in nick views

Since the Q_WS_* macros no longer exist in Qt5, replace them by the
appropriate Q_OS_* macros. Remove some needless ones, too.

6 years agouisupport: Join channels on doubleclick on all but Windows and OSX
Manuel Nickschas [Tue, 27 Feb 2018 09:23:39 +0000 (10:23 +0100)]
uisupport: Join channels on doubleclick on all but Windows and OSX

The Q_WS_* macros no longer exist in Qt5, so the OS detection for
the click behavior in bufferviews didn't work correctly. Use the
correct Q_OS_* macros to ensure that a doubleclick is required on
platforms other than Windows and OSX.

6 years agoclient: Fix Chat Monitor missing sender brackets
Shane Synan [Fri, 22 Sep 2017 23:56:49 +0000 (18:56 -0500)]
client: Fix Chat Monitor missing sender brackets

Always re-add hidden sender brackets for the Chat Monitor as the
normal sender prefixes get replaced with Network, Buffer, and Sender
names.

Sender brackets shown:
> Copy-pasted
  Chat Monitor: <Bitlbee:#channel> digitalcircuit does things
  Channel:      -*- digitalcircuit does things

Before:
> Copy-pasted with sender brackets hidden (wrong)
  Chat Monitor: Bitlbee:#channel digitalcircuit does things
  Channel:      -*- digitalcircuit does things

After:
> Copy-pasted with sender brackets hidden (correct)
  Chat Monitor: <Bitlbee:#channel> digitalcircuit does things
  Channel:      -*- digitalcircuit does things

Closes GH-314.

6 years agoPackage bearer plugin on OSX
romibi [Fri, 2 Feb 2018 11:45:09 +0000 (12:45 +0100)]
Package bearer plugin on OSX

Fixes #1442. Closes GH-324.

6 years agoFix OSX compile and deploy
romibi [Fri, 1 Sep 2017 08:06:10 +0000 (10:06 +0200)]
Fix OSX compile and deploy

Set additional compile flag
Fix FindLdap.cmake for OSX
Fix DMG creation (sometimes fails if no volume size is provided)

Closes GH-304.

6 years agocommon: Fix typo in Network::capAvailable() docs
Shane Synan [Sun, 17 Sep 2017 17:54:05 +0000 (12:54 -0500)]
common: Fix typo in Network::capAvailable() docs

In Network::capAvailable(), fix typo of "guarentee" -> "guarantee".
This doesn't have any impact on running code, but should still be
fixed.

Thanks to @justJanne for finding this.

Closes GH-300.

6 years agocore: Stop ratelimiting log spam with old client
Shane Synan [Fri, 18 Aug 2017 20:34:38 +0000 (15:34 -0500)]
core: Stop ratelimiting log spam with old client

Downgrade invalid 'setMessageRateBurstSize' and 'setMessageRateDelay'
warning messages to debugging level.  This happens any time an older
client tries to configure a network for a newer core and in most
cases can be ignored.

Should an issue arise, the log level can be set to debug.