quassel.git
6 years agoDefault to unread backlog fetch if not changed
Shane Synan [Thu, 8 Sep 2016 02:08:49 +0000 (21:08 -0500)]
Default to unread backlog fetch if not changed

Use PerBufferUnread by default for backlog fetching rather than
PerBufferFixed.  In cases with many slow channels or multiple PMs,
this reduces the amount of backlog fetched on connect by ignoring
content already read.  This also increases the chances of seeing
highlights past the previous fixed limit of 500 lines.

This modifies new installs and existing configurations if the prior
default value wasn't changed.

In most cases, this should speed up connecting.  However, if
problematic, the version upgrade system should be used to preserve
old defaults for existing installs.

Closes GH-247.

6 years agoDon't terminate the core due to backend issues while setting up
Manuel Nickschas [Wed, 30 Aug 2017 21:50:54 +0000 (23:50 +0200)]
Don't terminate the core due to backend issues while setting up

If the authenticator or storage backend selected by the user during
core setup cannot be initialized, the problem shall be communicated
to the client and the user can start over; the core shall not exit
in this case. Ensure that failure to initialize the selected backends
only terminates the core if it's not being setup.

6 years agoFix layout issues in CoreConfigWizard; cleanup
Manuel Nickschas [Wed, 30 Aug 2017 21:43:45 +0000 (23:43 +0200)]
Fix layout issues in CoreConfigWizard; cleanup

Qt has trouble layouting widgets dynamically added to wizard pages,
so switch to using QStackedWidget for storage and authenticator
settings. Add size policies as needed and explicitly set the size of
all pages to fit the largest one to ensure that the wizard is large
enough.

While we're at it, clean up related code a bit.

Closes GH-170.

6 years agoLDAP authenticator now logs server address as info message
Ben Rosser [Mon, 19 Jun 2017 18:38:47 +0000 (14:38 -0400)]
LDAP authenticator now logs server address as info message

As requested by Zhoriel, the core now prints the full address and port
of the LDAP server it is connecting to, in order to make debugging
a little easier.

6 years agoFix issue from rebase; migrateTo now needs writer.get().
Ben Rosser [Sat, 27 May 2017 18:19:09 +0000 (14:19 -0400)]
Fix issue from rebase; migrateTo now needs writer.get().

6 years agoLDAP username case-insensivity
Tuetuopay [Mon, 6 Feb 2017 13:51:42 +0000 (14:51 +0100)]
LDAP username case-insensivity

This patches a case sensitivity issue in the core.

LDAP itself is case insensitive, but the LDAP module of the core will
keep the case of the usename when creating a local Quassel account.
Thus, if you login with the same username but using a different casing,
a new internal Quassel account will be creating, resulting in an
apparent settings loss (networks, ...).

The patch converts the username to lowercase before handing it to the
core.

6 years agoFix quasseluser table setup on PostgreSQL and sort sql.qrc
Ben Rosser [Thu, 24 Nov 2016 23:51:11 +0000 (18:51 -0500)]
Fix quasseluser table setup on PostgreSQL and sort sql.qrc

It seems that at some point the DEFAULT option for a varchar()
column has become sensitive to whether or not single or double quotation
marks are used. In particular when ""s were used, core setup failed
with the message 'ERROR:  column "Database" does not exist'. Changing
to single quotation marks (''s) resolved the issue.

Also include @digitalcircuit's sorted version of sql.qrc.

Fix the upgrade script too.

6 years agotravis: Try to work around a build issue with LDAP on OSX
Manuel Nickschas [Tue, 1 Nov 2016 20:39:51 +0000 (21:39 +0100)]
travis: Try to work around a build issue with LDAP on OSX

Seems like the headers found in the OSX Frameworks are broken, so
try giving the include path explicitly.

6 years agoRework the handling of storage/auth backends and config
Manuel Nickschas [Tue, 1 Nov 2016 16:34:16 +0000 (17:34 +0100)]
Rework the handling of storage/auth backends and config

The legacy way of transmitting backend settings to the client
for initial core configuration was pretty weird, especially regarding
the setupKeys/setupDefaults mess that required guesswork on the
client side as of the property types. With the introduction of
authenticators, an opportunity presented itself to improve this.

Upon fixing this, I realized that lots of pretty crazy legacy code
was involved, and partially even duplicated for authenticator
handling. I could not keep myself from cleaning that up.
In the process, the affected parts of the code were modernized too,
leveraging Modern C++ and the STL where possible.

The setupKeys/setupDefaults properties of the backend info structs
are now deprecated and replaced by a setupData list of field IDs,
translatable display names, and default values/types. To keep
legacy clients working, the old properties are still transmitted
until the next protocol break.

6 years agocommon: Add Deferred{Unique|Shared}Ptr and helpers
Manuel Nickschas [Tue, 1 Nov 2016 16:23:44 +0000 (17:23 +0100)]
common: Add Deferred{Unique|Shared}Ptr and helpers

This commit adds smart pointers for holding QObject derivatives.
On destruction, they will deleteLater() the object they're holding.
This is the recommended and safe way for deleting QObject instances.
Be careful with using such smart pointers outside of the scope of
their parent, for objects that are owned. The parent will delete
its children, and any outside reference still held by a smart pointer
will lead to a double free!

6 years agoldap: Don't use the backend's display name as identifier
Manuel Nickschas [Sun, 23 Oct 2016 23:03:16 +0000 (01:03 +0200)]
ldap: Don't use the backend's display name as identifier

We'd like to have the display name translatable, so it should not
be used as an identifer. Instead, introduce a backendId property
for this purpose.

6 years agoldap: Use correct authenticator name for mono client
Manuel Nickschas [Sun, 23 Oct 2016 22:23:34 +0000 (00:23 +0200)]
ldap: Use correct authenticator name for mono client

Should be "Database" instead of "StorageAuth".

6 years agoldap: ConnectionProperties -> AuthProperties
Manuel Nickschas [Sun, 23 Oct 2016 22:21:05 +0000 (00:21 +0200)]
ldap: ConnectionProperties -> AuthProperties

This commit changes the settings key to something making slightly
more sense in the context of authentication.

6 years agoldap: Some cleanups for GH-170
Manuel Nickschas [Wed, 19 Oct 2016 21:17:47 +0000 (23:17 +0200)]
ldap: Some cleanups for GH-170

Mostly formatting and a few other bits.

6 years agoldap: Remove warnings
Manuel Nickschas [Thu, 13 Oct 2016 21:25:12 +0000 (23:25 +0200)]
ldap: Remove warnings

6 years agoRe-add the ":authenticator" property to insert_quasseluser.sql
Ben Rosser [Fri, 9 Sep 2016 06:29:06 +0000 (02:29 -0400)]
Re-add the ":authenticator" property to insert_quasseluser.sql

This was removed during the rebase commits.

6 years agoAuthenticator code cleanup as per review
Ben Rosser [Fri, 9 Sep 2016 05:27:27 +0000 (01:27 -0400)]
Authenticator code cleanup as per review

* Standardized on "authenticator" rather than "authBackend"
* Removed XXXs and replaced with TODO or FIXME comments appropriately
* Fixed a couple whitespace errors
* Cleared up some comments in the ldap cmake
* In the authenticator code, renamed displayName to backendId
* Added missing newline at the end of authenticator.cpp

6 years agoAttempt to link against openldap on Windows, too
Ben Rosser [Tue, 2 Feb 2016 18:28:00 +0000 (13:28 -0500)]
Attempt to link against openldap on Windows, too

Rewrite cmake module to remove special case for Windows.

Added some (commented out) example code to ldapauthenticator as
how we'd need to link against winldap.h, but the implementations
are sufficiently different that it's probably a waste of time.

6 years agoAdd --select-authenticator switch to core
Ben Rosser [Mon, 1 Feb 2016 00:17:46 +0000 (19:17 -0500)]
Add --select-authenticator switch to core

The select-authenticator switch now behaves exactly like the
select-backend switch for storage backends, allowing the user to
reconfigure their authenticator from the commandline or do initial
core setup.

Initial core setup should look something like this now:
quasselcore -c _dir_ --select-backend=SQLite --select-authenticator=Database

6 years agoFix a couple of whitespace errors in core.{cpp,h}
Ben Rosser [Mon, 4 Jan 2016 22:00:22 +0000 (17:00 -0500)]
Fix a couple of whitespace errors in core.{cpp,h}

6 years agoAdd authenticator column to quasseluser migration table
Ben Rosser [Sat, 2 Jan 2016 20:18:04 +0000 (15:18 -0500)]
Add authenticator column to quasseluser migration table

Commit these too.

6 years agoAdd password changing checks
Ben Rosser [Fri, 1 Jan 2016 20:43:07 +0000 (15:43 -0500)]
Add password changing checks

Don't allow passwords to be changed if it's forbidden by the auth
provider.

6 years agoAdd authenticator column to quasseluser table
Ben Rosser [Wed, 30 Dec 2015 06:23:26 +0000 (01:23 -0500)]
Add authenticator column to quasseluser table

... as additional cross-check when logging in a user.

This will default to storage-based auth.

6 years agoFirst attempt local auth, then try external provider
Ben Rosser [Mon, 28 Dec 2015 22:18:45 +0000 (17:18 -0500)]
First attempt local auth, then try external provider

6 years agoDelete authenticators in core destructor too
Ben Rosser [Thu, 24 Dec 2015 21:37:40 +0000 (16:37 -0500)]
Delete authenticators in core destructor too

6 years agoMake authenticator changes to protocol backwards-compatible
Ben Rosser [Thu, 24 Dec 2015 03:30:48 +0000 (22:30 -0500)]
Make authenticator changes to protocol backwards-compatible

An older client setting up a newer core will cause the core to
default to using the SqlAuthenticator class.

An newer client setting up an older core won't show the auth
selection dialog.

6 years agoAdd LdapAuthenticator class for logging in users via LDAP
Ben Rosser [Wed, 23 Dec 2015 04:31:43 +0000 (23:31 -0500)]
Add LdapAuthenticator class for logging in users via LDAP

This is based on abustany's pull request #4, refactored into an
authenticator.

LDAP bindings now only get built if WITH_LDAP is set.

Added filters, also added -DHAVE_LDAP flag to compilation from cmake.

6 years agoImplement authenticator class used for logging in users
Ben Rosser [Sat, 14 Nov 2015 19:44:36 +0000 (14:44 -0500)]
Implement authenticator class used for logging in users

Added authenticator setup info to the core, also added a new core
setup dialog page for authenticators.

Wrote a SqlAuthenticator that simply wraps the existing
storage-based auth.

6 years agocore: Fix timestamps in manual /away messages
Shane Synan [Fri, 14 Apr 2017 00:26:08 +0000 (19:26 -0500)]
core: Fix timestamps in manual /away messages

Change handleAway() to NOT skip timestamp formatting by default.
This is the intended behavior as the one situation where it should be
skipped already manually sets skipFormatting to true.  All other
places deal with unformatted input strings (either from identity or
set by the client).

Remove now-redundant call to formatCurrentDateTimeInString() as the
handleAway command now uses it by default.

Fixes sending "/away Away since %%hh:mm%% on %%dd.MM%%" on the client
not getting formatted as "Away since 07:43 on 22.10" or some such.

Resolves GH-288.

6 years agocore: connectToIrc: Pick first IRC server specified when not failed
genius3000 [Fri, 14 Apr 2017 00:01:36 +0000 (18:01 -0600)]
core: connectToIrc: Pick first IRC server specified when not failed

When connecting to the IRC network, only clear the
'_previousConnectionAttemptFailed' flag when trying the next server
in the list. Otherwise, reset server index to start from the top.

Currently, Quassel will continue to use the last used (working)
server (or a random server if set to). This doesn't match the
intention of having an ordered list of servers to use. The change
here just makes Quassel start with the first server in the list
unless it's a failed attempt, in which it continues down the list
(same as currently).

This fixes the issue of getting "stuck" on a specific server even if
you manually disconnect and connect.

Reference: http://bugs.quassel-irc.org/issues/693
And: http://bugs.quassel-irc.org/issues/1006
Fixes #693 and #1006
Resolves GH-287

6 years agoPoint to github in Core Info
esainane [Tue, 4 Apr 2017 05:59:41 +0000 (17:59 +1200)]
Point to github in Core Info

Resolves GH-285.

6 years agocore: Drop the 'update_lastmsgid' statements
Shane Synan [Sun, 16 Apr 2017 04:28:44 +0000 (23:28 -0500)]
core: Drop the 'update_lastmsgid' statements

Remove the 'update_lastmsgid.sql' queries from PostgreSQL and SQLite
and remove the 'setBufferLastMsgId()' functions from
PostgreSqlStorage and SqliteStorage.  These are no longer needed now
that database triggers handle updating the 'lastmsgid' for buffers.

This removes redundancy and might improve performance.

Resolves GH-290.

6 years agocore: Add backlog trigger to update lastmsgid
Shane Synan [Sun, 16 Apr 2017 04:13:59 +0000 (23:13 -0500)]
core: Add backlog trigger to update lastmsgid

Add PostgreSQL function 'backlog_lastmsgid_update()' that sets the
'lastmsgid' of a buffer according to the latest message ID available.
Also add a PostgreSQL trigger 'backlog_lastmsgid_update' that acts
whenever a new message is inserted to or updated in the backlog
table.

Add two SQLite triggers, 'backlog_lastmsgid_update_trigger_insert'
for inserting messages into the backlog, and
'backlog_lastmsgid_update_trigger_update' for updating messages in
the backlog.  Both triggers update the 'lastmsgid' of a buffer
according to the latest message ID available.

Unfortunately, SQLite lacks niceties such as functions or complex
triggers, requiring two separate triggers to do the same thing.  Ah
well, SQLite is much easier to bundle and set up.

This fixes some cases where 'update_lastmsgid' was not being called
when it should, namely when inserting multiple messages.

NOTE:  Currently Quassel does not offer an option to delete
specific messages without deleting a buffer, nor to update the
message ID of existing messages (this would break many assumptions).
However, for completion-sake, the UPDATE triggers are included.
DELETE triggers should be added if individual message deletion is
added.

Thanks to justJanne for the suggestion and PostgreSQL code!

6 years agocore: Separate SQL current and upgrade scripts
Shane Synan [Sun, 16 Apr 2017 05:50:33 +0000 (00:50 -0500)]
core: Separate SQL current and upgrade scripts

Move the current SQL queries into the 'SQL/[database]' top folder,
move all database schema upgrade scripts into the
'SQL/[database]/version/##' subfolders.  This preserves repository
history for the general SQL queries when adding a new schema version,
and simplifies rebasing a branch if the master schema version changes
in the meantime (e.g. managing multiple pull requests).

Thanks to justJanne and others for the suggestion!

Update 'sql.qrc' with the moved SQL files.

Modify AbstractSqlStorage 'setupQueries()' and 'upgradeQueries()' to
use these new folder locations, and modify 'queryString()' to pick
either the current SQL schema folder or the versioned schema folder
according to whether a version was specified when calling it.

Update 'updateSQLResource.sh' with the new folder locations,
including fixing the 'sort' command to sort independent of the
current operating system language settings.

Update 'upgradeSchema.sh' with the new locations and stop moving the
non-upgrade '*.sql' scripts.  Now, it just adds a new folder and
prints a message on how to use it.  Also send error messages to
standard error.

Add more documentation on schema upgrades.  You can never have enough
testing...

6 years agoFix icon import to not lose channel icons in breeze
romibi [Fri, 14 Apr 2017 14:11:20 +0000 (16:11 +0200)]
Fix icon import to not lose channel icons in breeze

Resolves GH-289.

7 years agoicons: Add missing dialog-warning icon
Manuel Nickschas [Thu, 13 Apr 2017 23:02:18 +0000 (01:02 +0200)]
icons: Add missing dialog-warning icon

That one was introduced in a recent commit.

7 years agoicons: Fix import script
Manuel Nickschas [Thu, 13 Apr 2017 22:59:37 +0000 (00:59 +0200)]
icons: Fix import script

Make it work with newer Perl, and some other tweaks.

7 years agoUpdate Icons
romibi [Sat, 25 Mar 2017 18:10:18 +0000 (19:10 +0100)]
Update Icons

Resolves GH-283.

7 years agoSupport extra theme dependent icons via import-script
romibi [Sat, 25 Mar 2017 15:42:35 +0000 (16:42 +0100)]
Support extra theme dependent icons via import-script

7 years agoAdd new connect/disconnect hicolor icons
romibi [Sat, 25 Mar 2017 15:41:32 +0000 (16:41 +0100)]
Add new connect/disconnect hicolor icons

7 years agoFix Icon fallback issue
romibi [Sat, 25 Mar 2017 10:30:46 +0000 (11:30 +0100)]
Fix Icon fallback issue

and make the connect/disconnect to core buttons 'themeable'
and fix some wrong inactive icon fallback in code

7 years agoSave Core settings synchronously and report errors.
Christian Schwarz [Sat, 18 Mar 2017 19:05:43 +0000 (20:05 +0100)]
Save Core settings synchronously and report errors.

Resolves GH-281.

7 years agoAssert Settings backing store is writable if core is unconfigured.
Christian Schwarz [Sat, 18 Mar 2017 19:03:57 +0000 (20:03 +0100)]
Assert Settings backing store is writable if core is unconfigured.

7 years agoFix an issue in the .gitignore
Janne Koschinski [Thu, 16 Mar 2017 21:07:01 +0000 (22:07 +0100)]
Fix an issue in the .gitignore

Resolves GH-279.

7 years agoUpdated gitignore to ignore files generated by JetBrains IDEs
Janne Koschinski [Fri, 17 Mar 2017 17:34:26 +0000 (18:34 +0100)]
Updated gitignore to ignore files generated by JetBrains IDEs

Resolves GH-280.

7 years agoFix handling systray notifications
György Balló [Thu, 16 Feb 2017 07:41:08 +0000 (08:41 +0100)]
Fix handling systray notifications

Only toggle/activate the main window if the notification message comes
from quassel.

This fixes the problem that Quassel's main window is opened when the
user clicks on any notification bubbles from other applications.

Resolves GH-272.

7 years agoFix expanding networks in Chat Monitor settings
Shane Synan [Sat, 14 Jan 2017 20:54:53 +0000 (14:54 -0600)]
Fix expanding networks in Chat Monitor settings

Update the network expanded/collapsed state when setting a model,
including filtered models.

This fixes the Chat Monitor settings page not updating the expanded
and collapsed networks on first load.  It might be excessive to apply
on every model change; if performance issues arise, it can be moved
to BufferView::setFilteredModel() or elsewhere.

Add comments!

Resolves GH-271.

7 years agocommon: Don't return a bool from main()
Manuel Nickschas [Thu, 13 Apr 2017 20:01:30 +0000 (22:01 +0200)]
common: Don't return a bool from main()

gcc now warns about this (rightfully).

7 years agoShow timestamp format tooltips when core supports
Shane Synan [Sun, 8 Jan 2017 19:30:38 +0000 (13:30 -0600)]
Show timestamp format tooltips when core supports

Only change tooltip for away messages when supported by the core.
Restore original tooltip and concatenate together to reuse existing
translations (can be split apart if not a good idea).

Add new feature flag "AwayFormatTimestamp" to indicate when the core
supports parsing timestamp formats in away messages.

This isn't strictly required and if needed can be left out.  It just
might be confusing for the UI to say you can do something.. and it
doesn't work.

Resolves GH-270.

7 years agoUse timestamp format for manual away, not restore
Shane Synan [Sun, 8 Jan 2017 22:52:38 +0000 (16:52 -0600)]
Use timestamp format for manual away, not restore

Apply the timestamp formatting to manual /away commands, too.  This
offers consistency between the auto-away settings and manual away.

Add skipFormatting flag to handleAway/issueAway commands to skip
applying timestamp formatting.  This avoids re-processing timestamp
formatting when restarting the core, leaving any '%%' as '%%'.  The
message should already be processed once stored.

More comments!

7 years agoHandle multiple timestamp formats, escape code
Shane Synan [Sun, 8 Jan 2017 22:53:06 +0000 (16:53 -0600)]
Handle multiple timestamp formats, escape code

Move search and replace into a loop to handle multiple timestamp
format strings.  Include a limit on maximum number of iterations to
avoid any potential infinite loops (512 ought be enough for anybody).

Add check for empty %% group to allow using '%%%%' as '%%', two
literal percent signs.

Comments!  Document all the things.

Examples:
All Quassel clients vanished from the face of the earth... %%hh:mm:ss%%
> All Quassel clients vanished from the face of the earth... 23:20:34
Away since %%hh:mm%% on %%dd.MM%% - %%%% not here %%%%
> Away since 23:20 on 21.05 - %% not here %%

7 years agoOptionally include timestamp when entering away
Marcin Jabrzyk [Sun, 16 Mar 2014 22:10:01 +0000 (23:10 +0100)]
Optionally include timestamp when entering away

- In utils added function to find regexp format
- Added formatting the away message in core
- Tooltip update in client about possible away message format

7 years agoClarify settings migration logic comments
Shane Synan [Sat, 7 Jan 2017 01:16:31 +0000 (19:16 -0600)]
Clarify settings migration logic comments

Add comments clarifying use of VERSION_MINOR_CURRENT in
migrateSettings() and the switch statements in
applySettingsMigration().  It's easy enough to do one and miss the
other as they're not very close by.

(I should've commented this in the first place.  Pardon!)

Resolves GH-269.

7 years agoSort sql.qrc when generating, emphasize script
Shane Synan [Fri, 6 Jan 2017 20:07:20 +0000 (14:07 -0600)]
Sort sql.qrc when generating, emphasize script

Modify the update SQL resource script to version-sort output and
batch append it to the sql.qrc file.  This improves readability in
'git diff' output, and might slightly improve performance, too.

Move UPDATE_SQL_RESOURCE.sh to SQL/updateSQLResource.sh, making it
easier to find, right next to the other SQL management script.  This
required a few changes to the logic.

Document the new behavior in upgradeSchema.sh, keep the manual
instructions in case the script doesn't work.

Comments, comments everywhere.

(I really wish I would've known about this script earlier...)

Resolves GH-268.

7 years agoFix SASL appearing active when Use SASL unchecked
Shane Synan [Sat, 7 Jan 2017 01:52:01 +0000 (19:52 -0600)]
Fix SASL appearing active when Use SASL unchecked

Workaround SASL contents getting enabled irrespective of Use SASL
checkbox whenever sslUpdated() determines the identity does not have
an SSL key.

Simplify SASL EXTERNAL UI hide/show logic by adding an invisible
frame inside sasl QGroupBox containing all child widgets.  Only the
frame is enabled and disabled.

Fixes SASL account and password showing up as enabled when Use SASL
was not checked.

Resolves GH-267.

7 years agoUse label and Details button, check if connected
Shane Synan [Sat, 7 Jan 2017 02:40:22 +0000 (20:40 -0600)]
Use label and Details button, check if connected

Keep "Use SASL Authentication" static, to avoid confusion and
concerns with longer languages.

Add another row with an icon, text, and "Details..." button to show
current SASL availability.

Check if disconnected separately from network existing and capability
negotiation support.  Show a different message when disconnected from
the network.  This should help reduce confusion.

Move SASL status UI updates to separate function to avoid cluttering
general capability updates handling function.

7 years agoEncourage SASL over NickServ when server supports
Shane Synan [Sun, 4 Dec 2016 09:12:02 +0000 (03:12 -0600)]
Encourage SASL over NickServ when server supports

Move Use SASL Authentication above Auto Identify.

Change the label for SASL according to whether or not SASL support
is advertised by the network.  If disconnected or unknown, no change.
Otherwise, set to "Use SASL Authentication (preferred)" when known,
or "Use SASL Authentication (might not work)" when not advertised.

Unfortunately there's no way to be sure, but this seems to do the
right thing.  One can still enable and disable as before.

Add explanatory tooltips to authentication options, including
recommending SASL if you need to identify before joining channels
(this gets asked a lot in #quassel).

7 years agoHide the SASL EXTERNAL notice while loading
Shane Synan [Sun, 4 Dec 2016 05:32:08 +0000 (23:32 -0600)]
Hide the SASL EXTERNAL notice while loading

Update the status of the "SASL EXTERNAL in use" when first loading
the Network settings page.  This avoids briefly showing it when
opening the Networks settings page while loading backlog from the
core.

7 years agoAdd capAvailable to Network akin to capEnabled
Shane Synan [Sun, 4 Dec 2016 05:43:10 +0000 (23:43 -0600)]
Add capAvailable to Network akin to capEnabled

Add capAvailable to Network, checking if the server advertised the
given capability.  This mimics capEnabled, but applies regardless of
whether or not Quassel requested the capability.

This is useful for showing elsewhere whether or not a certain
capability could've been requested.

Use this in Network::saslMaybeSupports to avoid falsely claiming SASL
support when the SASL capability wasn't advertised.  This matches the
behavior of CoreNetwork.

7 years agoMove SASL maybeSupports into Network class
Shane Synan [Sun, 4 Dec 2016 05:40:46 +0000 (23:40 -0600)]
Move SASL maybeSupports into Network class

Move IrcCap::SaslMechs::maybeSupported to the Network class,
simplifying usage.  Now there's no need to specify the capability
value, avoiding hassle for most cases when you already have the
Network object.

Update CoreNetwork to use the moved function.  Tidy!

7 years agoNew default sender colors!
Shane Synan [Fri, 2 Dec 2016 23:35:32 +0000 (17:35 -0600)]
New default sender colors!

Add a full range of 16 sender colors, loosely readable and
distinguishable.

This results in less redundant nickname colors and possibly better
readability (subjective).  All changes can be undone, as expected.

Colors generated with an algorithm suggested to to the Pidgin
implementation.  Credit to 'lobais' for the original algorithm.

Bump settings minor version to preserve old sender colors.  This only
affects those who have used the git master branch,  and if desired
can be removed.

Algorithm code:
def genColor (n, startpoint=0):
    assert n >= 1
    # This splits the 0 - 1 segment in the pizza way
    h = (2*n-1)/(2**ceil(log(n)/log(2)))-1
    h = (h + startpoint) % 1
    # We set saturation based on the amount of green, in the range 0.6 to 0.8
    rgb = colorsys.hsv_to_rgb(h, 1, 1)
    rgb = colorsys.hsv_to_rgb(h, 1, (1-rgb[1])*0.2+0.6)
    return rgb

See https://developer.pidgin.im/ticket/4534#comment:4

Resolves GH-266.

7 years agoDetect and label changes from ourself
Shane Synan [Sat, 3 Dec 2016 03:06:41 +0000 (21:06 -0600)]
Detect and label changes from ourself

On the core, detect when changes apply to our own nick and flag the
message as Self.

On the client, work around old nick change messages lacking the Self
flag.  Working around the other messages would be more difficult.

This fixes nick change styling not correctly applying for
"sender=self" in themes.

7 years agoUse new nick for finding hash of Nick messages
Shane Synan [Sat, 3 Dec 2016 00:43:15 +0000 (18:43 -0600)]
Use new nick for finding hash of Nick messages

For nick change messages, use the new nickname for calculating the
sender hash, not the old one.  This more closely matches
expectations.

Works around a limitation in the Quassel theming engine that doesn't
allow different styling for multiple nicks in one message.
Unfortunately, rewriting the necessary parts of the theme engine to
support multiple styles per nick is above my understanding right now.

7 years agoOptionally color nicknames in all messages
Shane Synan [Sat, 3 Dec 2016 00:40:30 +0000 (18:40 -0600)]
Optionally color nicknames in all messages

Find senderHash for all nickname-relevant messages that don't have
multiple nicknames (e.g. netsplits).

Add new preference "UseNickGeneralColors" to toggle sender coloring
on all available nicknames, not just action messages.  This might be
undesired by some given the level of colors, so it's kept as a
separate preference from ACTION message coloring.

Bump settings minor version to keep nickname coloring disabled for
existing setups.

7 years agoSwitch sender colors to use color palette
Shane Synan [Fri, 2 Dec 2016 22:36:36 +0000 (16:36 -0600)]
Switch sender colors to use color palette

Add "sender-color-[hash]" to the list of valid palette color roles.

Switch QtUiStyle::generateSettingsQss() to make use of the color
palette, rather than redundantly specifying the color.  This cleans
up the output of settings.qss, and (more importantly) allows custom
themes to do the same.

There's trade-offs involved with using the color palette directly
(similar to MarkerLine).  It would make the GUI capable of toggling
sender coloring in themes, which would be nice.  However, themes
would no longer be able to set sender colors independently for
different message types.

Though untested, there might be performance trade-offs with querying
the settings provider on each render, too.

This can be revisited in the future.

7 years agoAllow palette names with digits 0-9
Shane Synan [Fri, 2 Dec 2016 21:50:38 +0000 (15:50 -0600)]
Allow palette names with digits 0-9

Modify the regular expression for palette matching to allow digits
(e.g. 0-9) in the name.  There seems to be no reason to block them.

Document the palette-matching regex.

7 years agoOptionally use system locale for chat timestamp
Shane Synan [Sat, 3 Dec 2016 02:05:20 +0000 (20:05 -0600)]
Optionally use system locale for chat timestamp

Using QLocale::system().timeFormat(), check if the AM/PM designator
exists; if so, assume a 12-hour style timestamp, otherwise assume the
previous 24-hour style timestamp.

Generate a timestamp of either " hh:mm:ss" or " h:mm:ss ap" in order
to include seconds (QLocale::ShortFormat does not specify seconds).

Add new setting UseCustomTimestampFormat to switch between system
or user timestamp string.  Bump settings version minor to keep old
behavior for upgrades.

7 years agoChange ChannelMsg default to match system default
Shane Synan [Fri, 2 Dec 2016 23:04:41 +0000 (17:04 -0600)]
Change ChannelMsg default to match system default

Change ChannelMsg default to match the system text color palette.

On systems tested, "palette(text)" doesn't refer to pure black, but
instead a very dark gray (60, 60, 60).  Use that as default instead.

This won't affect existing installs as ChannelMsg is stored as
non-default if non-default colors are chosen.

7 years agoMake ErrorMsg color distinct from ServerMsg
Shane Synan [Sun, 4 Dec 2016 20:44:48 +0000 (14:44 -0600)]
Make ErrorMsg color distinct from ServerMsg

Switch ErrorMsg to a reddish color rather than the golden hues of
ServerMsg, matching the behavior of Quasseldroid.

This helps with discovering if Auto Identify fails now that SASL
authentication errors are reported in the server buffer.  It also
points out any messages Quassel doesn't handle correctly, which might
be unexpected, but should help with discovering them.

No settings migration logic included as custom colors are an
all-or-nothing approach.  Due to 'default.qss' using a system
palette color, there's no easy way to upgrade without changing
existing colors or loading all of Qt's color palettes in startup.
For example, palette(text) is dependent upon the system theme:
ChatLine {
  foreground: palette(text);
}

7 years agoChange CommandMsg color from purple to gray
Shane Synan [Fri, 2 Dec 2016 23:02:33 +0000 (17:02 -0600)]
Change CommandMsg color from purple to gray

The intense purple stands out a lot more than it probably needs to.
Let's switch that to a gray color.

No settings migration logic included as custom colors are an
all-or-nothing approach.  Due to 'default.qss' using a system
palette color, there's no easy way to upgrade without changing
existing colors or loading all of Qt's color palettes in startup.
For example, palette(text) is dependent upon the system theme:
ChatLine {
  foreground: palette(text);
}

7 years agoSwitch from kdelibs4 sounds to Plasma 5 sound files
Jonathan Riddell [Fri, 21 Oct 2016 16:07:52 +0000 (17:07 +0100)]
Switch from kdelibs4 sounds to Plasma 5 sound files

Resolves GH-260.

7 years agoMerge pull request #277 from mamarley/psqlleast
Marcus Eggenberger [Wed, 15 Mar 2017 21:38:07 +0000 (22:38 +0100)]
Merge pull request #277 from mamarley/psqlleast

Fix lastseenmsgid updates in PostgreSQL

7 years agoFix lastseenmsgid updates in PostgreSQL 277/head
Michael Marley [Thu, 9 Mar 2017 15:46:14 +0000 (10:46 -0500)]
Fix lastseenmsgid updates in PostgreSQL

GH-273 introduced a workaround for the issue where sometimes the
lastseenmsgid for a buffer was set to a msgid not in that buffer.
However, the workaround was incorrect as the "min()" function in
PostgreSQL is an aggregate function for use on a column, not a
function to return the least of a list of values passed in.  The
correct function for use here is "least()".

7 years agoMerge pull request #276 from digitalcircuit/fix-sql-postgres-newerthan
Marcus Eggenberger [Mon, 6 Mar 2017 09:01:26 +0000 (10:01 +0100)]
Merge pull request #276 from digitalcircuit/fix-sql-postgres-newerthan

core: Fix Postgres messagesNewerThan wrong buffer

7 years agocore: Fix Postgres messagesNewerThan wrong buffer 276/head
Shane Synan [Sun, 5 Mar 2017 19:39:38 +0000 (13:39 -0600)]
core: Fix Postgres messagesNewerThan wrong buffer

Make the inner SELECT statement use the buffer ID for bufferid, NOT
the messageid.

This fixes select_messagesNewerThan using the wrong variable for the
buffer ID, causing more recent messages to not show up when fetching
backlog with the "Unread messages" method.

Fixes regression in pull request #273, missed by pull request #274.

NOTE: The client still needs fixed to stop sending invalid IDs.  That
should be addressed with another set of commits.

See https://github.com/quassel/quassel/pull/274#issuecomment-284205802

7 years agoMerge pull request #274 from digitalcircuit/fix-sql-inconsistencies
Marcus Eggenberger [Sun, 5 Mar 2017 11:24:57 +0000 (12:24 +0100)]
Merge pull request #274 from digitalcircuit/fix-sql-inconsistencies

Fix SQLite setup, PostgreSQL migrate, cleanup SQL

7 years agoFix SQLite buffer setup, fix PostgreSQL migration 274/head
Shane Synan [Sat, 4 Mar 2017 22:15:13 +0000 (16:15 -0600)]
Fix SQLite buffer setup, fix PostgreSQL migration

Remove the ALTER TABLE command, this isn't needed during setup as the
buffer's getting created for the first time.

Add the CHECK constraint as seen in the upgrade script, limiting the
value of lastseenmsgid.

Add handling for lastmsgid when migrating from SQLite to PostgreSQL.

Fix 'SELECT populate_lastmsgid()' call by first resetting the query.

This fixes breakages caused by incomplete work in pull request #273.

7 years agoAdd lastmsgid limit on fetching backlog to SQLite
Shane Synan [Sat, 4 Mar 2017 21:09:14 +0000 (15:09 -0600)]
Add lastmsgid limit on fetching backlog to SQLite

Copy lastmsgid fetch limit improvements from PostgreSQL to SQLite,
improving performance by not requiring scanning from the start of the
backlog table to the present.

This builds upon pull request #273, including the original intent of
improving performance for unread backlog fetching.  The original pull
request left out these lines when applying the PostgreSQL changes to
SQLite.

NOTE:  The client-side generating these invalid values should be
fixed in future commits.

7 years agoUnify SQL filenames, sort sql.qrc
Shane Synan [Sun, 5 Mar 2017 04:58:00 +0000 (22:58 -0600)]
Unify SQL filenames, sort sql.qrc

Unify SQL filenames, renaming PostgreSQL 'select_messages' to
'select_messagesNewestK', and renaming SQLite 'select_messages' to
'select_messagesRange'.

Sort sql.qrc alphabetically.

This makes it easier to see which functionality is related, e.g. when
making future schema changes.  Sorting improves 'git diff' output.

7 years agoAdd documentation, clean up whitespace
Shane Synan [Sun, 5 Mar 2017 04:57:51 +0000 (22:57 -0600)]
Add documentation, clean up whitespace

Maintain tabs in .sql files, remove extra newline.

Add documentation to the setLastMsg function.

This helps maintain consistency with the other files.

7 years agoMerge pull request #273 from ReimuHakurei/master
Marcus Eggenberger [Sat, 4 Mar 2017 14:37:15 +0000 (15:37 +0100)]
Merge pull request #273 from ReimuHakurei/master

Improve performance of PostgreSQL database in instances where buffers exist with no recent activity

7 years agoPort the previous PostgreSQL improvements to SQLite3. 273/head
Alex Ingram [Sat, 4 Mar 2017 02:34:20 +0000 (20:34 -0600)]
Port the previous PostgreSQL improvements to SQLite3.

7 years agoPostgreSQL: Improve performance and squish bug.
Alex Ingram [Fri, 3 Mar 2017 20:05:30 +0000 (14:05 -0600)]
PostgreSQL: Improve performance and squish bug.

Improve performance of the unread messages backlog fetcher by using a normal JOIN instead of a LEFT JOIN.

Correct for bug in which buffer.lastseenmsgid was set to a value higher than buffer.lastmsgid. This is a client bug, but this prevents it from screwing up the database.

7 years agoImprove PostgreSQL performance for unread message fetch method, too.
Alex Ingram [Fri, 3 Mar 2017 16:34:23 +0000 (10:34 -0600)]
Improve PostgreSQL performance for unread message fetch method, too.

7 years agoImprove performance of PostgreSQL for large databases.
Alex Ingram [Fri, 3 Mar 2017 05:40:23 +0000 (23:40 -0600)]
Improve performance of PostgreSQL for large databases.

This change requires a change to the database schema.

Currently, in cases where buffers exist that have not had any activity for an extended period of time, during initial backlog fetching, Quassel will have to scan backwards through all activity in all buffers until it reaches activity for the buffer in question.

This adds an additional field to the buffer table, "lastmsgid", which is the messageid of the most recent message added for that buffer. This improves performance by allowing Quassel to skip straight to where the most recent activity was, instead of scanning millions of rows (in large databases) in futility.

7 years agoSplit messages on newlines as per IRC protocol
Shane Synan [Tue, 27 Dec 2016 13:26:03 +0000 (08:26 -0500)]
Split messages on newlines as per IRC protocol

When handling user input sent over the protocol, split apart messages
on QChar::LineFeed, processing and displaying each as individual
messages sent one after the other.  This applies to /query, /say,
/notice, and /me.  Otherwise, the IRC protocol interprets anything
after each line break as a new message.

Fixes inability to send multi-line content via copy-paste on
Quasseldroid.  Quassel desktop currently works around this issue by
sending multiple individual messages for every line break.

Test case:
1.  Install Quasseldroid (stable or alpha), connect to a core
2.  Copy some text to the Android clipboard that has a line break in
    it (not just word-wrap).
3.  Paste into Quasseldroid
4.  Send message

Before: Message shows up with line break (LF character on desktop),
        IRC server treats all lines after first as raw commands.

After:  Message gets split into multiple smaller messages at each
        line break.

This should also work for /query, /say, /notice, and /me.

See: https://tools.ietf.org/html/rfc1459#page-8

Closes GH-263.

7 years agoMake reloadCerts also handle the IPv6 server
Willem Jan Palenstijn [Sun, 27 Nov 2016 13:34:07 +0000 (14:34 +0100)]
Make reloadCerts also handle the IPv6 server

Closes GH-264.

7 years agoDo a full install by default
Hannah von Reth [Sat, 22 Oct 2016 13:37:55 +0000 (15:37 +0200)]
Do a full install by default

Closes GH-261.

7 years agoFix AppVeyor Chocolatey failures by retrying
Daniel Albers [Mon, 28 Nov 2016 18:20:45 +0000 (19:20 +0100)]
Fix AppVeyor Chocolatey failures by retrying

Merges pull request #265 from digitalcircuit/fix-ci-retry-chocolatey

7 years agoFix typo Chocolately -> Chocolatey 265/head
Shane Synan [Mon, 28 Nov 2016 11:46:31 +0000 (05:46 -0600)]
Fix typo Chocolately -> Chocolatey

Official name is Chocolatey, e.g. https://chocolatey.org/ .

(The number of times I've mistyped this myself...)

7 years agoRetry Chocolatey install to workaround failures
Shane Synan [Mon, 28 Nov 2016 11:39:49 +0000 (05:39 -0600)]
Retry Chocolatey install to workaround failures

Automatically retry up to 3 times on failure when installing
Chocolatey modules, using the 'appveyor-retry' script.  This can be
removed later if needed.

Sometimes Chocolatey returns a 404 for a package that exists.  This
happens a lot.  The official fix is to get the Business edition for
the more-stable private CDN, but since we're an open-source community
effort, sometimes a little kludgery goes a long way.

See http://help.appveyor.com/discussions/suggestions/816-generic-wrapper-for-retry#comment_40579488
And https://github.com/appveyor/ci/issues/418

7 years agoFix hang for single result search after others
Shane Synan [Thu, 13 Oct 2016 08:39:14 +0000 (03:39 -0500)]
Fix hang for single result search after others

Add check for equal start and end indices in updateHighlights, stop
the search loop when this happens.  Regular search still seems to
work fine (if you found this via 'git blame', whoops).

Unfortunately, this seems specific to the contents of a buffer.
First, find a buffer that you've encountered freezing, and keep track
of what was loaded, where it was, and the two most recent search
terms.

For example...
1.  Load some backlog to a buffer
2.  Search for term with any number of matches
3.  Making sure to -type over existing words without first
    backspacing-, search for another term with only one match

Expected: Search results found, no freezing
Actual:   Quassel hangs.  startPos and endPos = same place,
          start = 0, end = 0, _currentHighlight appears to retain
          values from the previous search.

Resolves GH-259.

7 years agoRe-add execute permissions to bundled inxi
Shane Synan [Tue, 4 Oct 2016 06:54:42 +0000 (01:54 -0500)]
Re-add execute permissions to bundled inxi

Re-add execute permissions to bundled copy of inxi, letting Quassel
run it via /exec (including /sysinfo and /inxi).

Finishes up upgrade started in 83923d7c121dbcf514d4ff5b0ac2abb6eb08c6b9

Resolves GH-258.

7 years agoFix CoreNetwork::updateRateLimiting comments
Shane Synan [Fri, 30 Sep 2016 22:42:13 +0000 (17:42 -0500)]
Fix CoreNetwork::updateRateLimiting comments

Expand and fix opening summary comment, also remarking that the token
bucket should -not- be reset in this function.

Fix description of logic for _skipMessageRates.

Fix alignment of indented comments describing variables.

Resolves GH-257.

7 years agoHide AutoWHO for nicks without IrcUser objects
Shane Synan [Thu, 29 Sep 2016 00:28:28 +0000 (19:28 -0500)]
Hide AutoWHO for nicks without IrcUser objects

Don't require an IrcUser to exist when checking if WHO replies should
be hidden.  The nickname is enough for checking.

This mimics CoreSessionEventProcessor::processIrcEvent403, where
ERR_NOSUCHCHANNEL replies are hidden if nickname is in the list
regardless of whether or not an IrcUser object exists.

Potentially fixes AutoWHO replies showing in the server buffer when
nicks quickly join and leave channels, resulting in the IrcUser
object getting destroyed before the server replies to the AutoWHO
request.

It's difficult to recreate the issue on demand, so it's quite
possible there's more to fix.

Resolves GH-256.

7 years agoDisable high DPI scaling on anything but Windows
Martin T. H. Sandsmark [Sun, 25 Sep 2016 14:18:35 +0000 (16:18 +0200)]
Disable high DPI scaling on anything but Windows

The automatic scaling only works well on Windows.

See e. g. e33532e048fa12ee32429ca83ee31aa8f065147d in qttools,
QTBUG-50698 and QTBUG-52318.

Resolves GH-254.

7 years agoEnable per-chat history, line wrap by default
Shane Synan [Sat, 24 Sep 2016 06:59:05 +0000 (01:59 -0500)]
Enable per-chat history, line wrap by default

Enable input widget per-chat history and line wrapping by default,
following the behavior of Quassel Web and most Messaging/SMS apps
(HexChat does per-chat history by default, but not line wrapping).

Bump settings minor version to 3, preserve old defaults for upgrades.

This shows the minimum necessary to change default settings while
preserving previous defaults for existing installs.

Resolves GH-253.

7 years agoKeep old clients from removing message rate delay
Shane Synan [Thu, 22 Sep 2016 01:24:48 +0000 (20:24 -0500)]
Keep old clients from removing message rate delay

Add a guard against zero message delay in setMessageRateDelay,
following the error-checking of setMessageRateBurstSize.  This blocks
old clients from setting message rate delay to 0 seconds for newly-
created networks, improperly overriding the default of 2.2 seconds.

This affects creating a network in an old client, switching to a new
client, then enabling custom rate-limits.

The supported method for removing rate limits by setting Unlimited to
true still works.

Resolves GH-252.

7 years agoDefault to sqlite backend in core creation wizard
Ben Rosser [Mon, 19 Sep 2016 04:41:21 +0000 (00:41 -0400)]
Default to sqlite backend in core creation wizard

This introduces the notion of a "default" storage backend into
the core by adding a function (Core::isStorageBackendDefault),
which returns true if a given Storage object is 'default' and
false if not. This information is then added to the BackendInfo
dictionary passed through the protocol to the user interface,
which ensures the backend that is default will always be the
one displayed by default.

This change was prompted by conversation in IRC with [Saint]
and @digitalcircuit about making core creation slightly more
intuitive.

This allows us to, potentially, change the default storage
backend shown at core creation time should at some point
another backend be introduced, without having to modify
the interface.

It is a little weird having "isDefault" be an attribute of
*each* storage backend, but this was the simplest way to do
it without modifying the handshake. (Whichever is the last
storage backend to claim to be the default will win).

(As an aside, should this be merged and should #170 be merged
I'll implement something similar for authenticators in a
separate PR).

Resolves GH-250.

7 years agodcc: Add settings page for DCC configuration dcc
Manuel Nickschas [Sat, 8 Oct 2016 15:06:13 +0000 (17:06 +0200)]
dcc: Add settings page for DCC configuration