quassel.git
10 years agoFix finding a custom Qt4 via -DQT_PATH
Manuel Nickschas [Sun, 23 Mar 2014 01:33:48 +0000 (02:33 +0100)]
Fix finding a custom Qt4 via -DQT_PATH

This CMake option has recently been renamed from QT to QT_PATH; we
really should actually use the new name...

10 years agoRemove unnecessary include
Manuel Nickschas [Sun, 23 Mar 2014 01:30:19 +0000 (02:30 +0100)]
Remove unnecessary include

CoreApplication does not in any way depend on KApplication.

10 years agoDon't make EventType::KeyEvent depend on HAVE_QCA2
Manuel Nickschas [Sun, 23 Mar 2014 01:27:45 +0000 (02:27 +0100)]
Don't make EventType::KeyEvent depend on HAVE_QCA2

This enum value can be known even if we don't have encryption support.

10 years agoAdd a CMake wrapper for finding indicate-qt
Manuel Nickschas [Sun, 23 Mar 2014 01:15:12 +0000 (02:15 +0100)]
Add a CMake wrapper for finding indicate-qt

Because CMake's feature_summary works only with dependencies found
via find_package, it makes sense to have a wrapper around the
PkgConfig call used to find indicate-qt. This is very basic and does
not support all of the usual options (such as checking for a particular
version), but sufficient for our needs.

10 years agoBacktrace generation depends on the target system, not the host
Manuel Nickschas [Sat, 22 Mar 2014 18:30:21 +0000 (19:30 +0100)]
Backtrace generation depends on the target system, not the host

We were checking for CMAKE_HOST_WIN32 and CMAKE_HOST_UNIX for determining
which kind of backtrace generation support to build. However, this should
obviously depend on the target platform, not on the platform we build on.

So let's use WIN32 and UNIX instead.

10 years agoImprove the CMake option stuff
Manuel Nickschas [Thu, 20 Mar 2014 21:29:42 +0000 (22:29 +0100)]
Improve the CMake option stuff

We now use cmake_dependent_option() to express dependencies between
the various options that you can give to CMake for configuring Quassel;
for example, enabling KDE4 now forces some options to OFF regardless
of the user-selected value (which will, however, be preserved in case
KDE integration is disabled again later).

This also renames WITH_QT5 to USE_QT5 (and adds a USE_QT4, too); this seems
to have emerged as the standard way to select a Qt version for dual-Qt
packages. However, Qt4 is still selected by default unless you force Qt5
by setting the USE_QT5 flag. BTW, don't get your hopes up, Qt5 support is
still broken... Once it's working, we may select Qt5 as default for certain
platforms.

Additionally we renamed QT to QT_PATH to make the function of this flag
more clear.

10 years agoOops, left in some debug stuff...
Manuel Nickschas [Thu, 20 Mar 2014 21:25:10 +0000 (22:25 +0100)]
Oops, left in some debug stuff...

10 years agoMerge pull request #54 from Bombe/issue-1227
Manuel Nickschas [Thu, 20 Mar 2014 21:44:55 +0000 (22:44 +0100)]
Merge pull request #54 from Bombe/issue-1227

Only create the regular expression for content/sender matches once.

10 years agoOnly create the regular expression for content/sender matches once. 54/head
David ‘Bombe’ Roden [Sun, 2 Feb 2014 11:27:33 +0000 (12:27 +0100)]
Only create the regular expression for content/sender matches once.

Fixes #1227.

10 years agoDon't actually build miniz if we have zlib
Manuel Nickschas [Wed, 19 Mar 2014 20:08:08 +0000 (21:08 +0100)]
Don't actually build miniz if we have zlib

We don't use miniz if we have zlib; but it was still being built, because
we never actually set HAVE_ZLIB as a build system variable.

Use ZLIB_FOUND instead.

10 years agoSimplify handling of (dual-)Qt in the build system
Manuel Nickschas [Wed, 19 Mar 2014 20:00:07 +0000 (21:00 +0100)]
Simplify handling of (dual-)Qt in the build system

We've used a somewhat complex way to link the various targets to the
required Qt libraries (and use the correct defines and CFLAGS...), because
when that stuff was written, there were no target properties in CMake, and
thus it was not easily possible to build targets within the same scope with
different settings. Therefore, we couldn't use the QT_USE_FILE and had to
write our own library handling.

These days, target properties exist, and Qt5 came up with a nice way to attach
the needed properties based on the Qt modules in use: qt5_use_modules()
This was later backported to Qt4, too, replacing the old way of having to
include QT_USE_FILE which would then set global variables.

We now make use of this; because qt4_use_modules() only showed up in
CMake 2.8.10, we've copied that function. It will be used only if it's
not present in CMake proper.

As a bonus, I've also wrapped all the qt-related macros into functions
that do the check for the Qt version we want to build against, and select
the proper macro to call, thus removing lots of WITH_QT5 conditionals
from the rest of the build system. Note that Qt5 support is still incomplete,
anyway.

10 years agoEnable automoc
Manuel Nickschas [Mon, 17 Mar 2014 22:15:57 +0000 (23:15 +0100)]
Enable automoc

Finally we can make use of this very convenient CMake feature and have
the moc stuff handled automagically. No need to list the headers anymore
for feeding them into the long-deprecated qt4_wrap_cpp macro.

Also, this should compile a bit faster and lead to slightly better optimized
code, because automoc will combine all the generated moc stuff for a target
into a single translation unit.

Note that we could get rid of various empty .cpp files (where all the code
is in the header) by just adding the header to the sources list; that way,
automoc will pick them up. There is no need to have a dummy .cpp file for
that.

10 years agoMove compile settings into a separate CMake module
Manuel Nickschas [Mon, 17 Mar 2014 21:33:50 +0000 (22:33 +0100)]
Move compile settings into a separate CMake module

That stuff just clutters the main CMakeLists.txt and is better off
in a separate file.

10 years agoMove all CMake scripts one level up
Manuel Nickschas [Sun, 16 Mar 2014 22:33:41 +0000 (23:33 +0100)]
Move all CMake scripts one level up

Having them in cmake/modules/ just adds a pointless extra directory,
so let's move them directly into cmake/.

10 years agoInstall current cmake in Travis CI environment
Daniel Albers [Sun, 16 Mar 2014 22:45:30 +0000 (23:45 +0100)]
Install current cmake in Travis CI environment

10 years agoDisable Github's Travis CI for now
Manuel Nickschas [Sun, 16 Mar 2014 22:27:09 +0000 (23:27 +0100)]
Disable Github's Travis CI for now

Since the Github build servers have only CMake 2.8.7, we can't build there
at the moment. We'll re-enable this once they upgrade their servers, or
alternatively if we decide that we can relax the CMake requirement a bit.

10 years agoDon't look recursively for a .git dir
Manuel Nickschas [Sun, 16 Mar 2014 21:00:49 +0000 (22:00 +0100)]
Don't look recursively for a .git dir

The original GetGitRevisionDescription.cmake script would look for
a .git dir recursively in the parent directories of its invocation;
while a nice feature, it may pick up an unrelated repository if there's
none in the Quassel directory. Because we know exactly where to find
our own .git if it's there at all, we can remove the recursion and
prevent this issue.

10 years agogenversion-B-GONE
Manuel Nickschas [Sun, 16 Mar 2014 20:42:51 +0000 (21:42 +0100)]
genversion-B-GONE

Back in the day, we wanted to have information about the git hash a
particular Quassel binary was built from in the About dialog, to allow
for diagnostic purposes. However, we didn't manage to retrieve that
kind of information using CMake alone (we're talking CMake 2.4 here, too);
so we came up with the hack to compile a small binary that would be run
at build time and called the git executable in order to write version
information into a file.

This is not particularly nice, as running random binaries at build time is
frowned upon and can cause problems in some setups, and of course we have
the overhead of building it first.

Meanwhile, we found a nice set of CMake macros created by Ryan Pavlik that
would retrieve that information purely running Git commands, making genversion
obsolete. Together with the configure_file feature of CMake, this allows us
to do this more elegantly.

So gone is genversion, and also the good old trusted version.inc file...

10 years agoUpdate README and COPYING-CMAKE-SCRIPTS
Manuel Nickschas [Sun, 16 Mar 2014 17:54:49 +0000 (18:54 +0100)]
Update README and COPYING-CMAKE-SCRIPTS

Just to make clear how to handle the files we bundle.

10 years agoUpdate currently bundled CMake scripts
Manuel Nickschas [Sun, 16 Mar 2014 16:45:10 +0000 (17:45 +0100)]
Update currently bundled CMake scripts

We still need to bundle some CMake scripts that are not part of a
standard CMake installation, and may not be present in particular
on non-UNIXy platforms (as e.g. Windows does not have the concept
of a system-wide CMake script location).

Let's use current versions of those.

10 years agoRemove obsolete CMake scripts
Manuel Nickschas [Sun, 16 Mar 2014 16:40:11 +0000 (17:40 +0100)]
Remove obsolete CMake scripts

We no longer need to bundle our own versions of FindOpenSSL and
FindPkgConfig, as recent CMake versions ship them.

10 years agoBump CMake version requirement to 2.8.9
Manuel Nickschas [Sun, 16 Mar 2014 16:14:49 +0000 (17:14 +0100)]
Bump CMake version requirement to 2.8.9

Time to modernize our build system, making use of all the fancy features
that have crept into CMake in the past few years. While 2.8.9 is by far not
the latest version, it is rather widely deployed in distros at this time and
thus seems to be a reasonable choice as a minimum requirement.

10 years agoStart of 0.11 cycle 0.11-pre
Manuel Nickschas [Sun, 16 Mar 2014 14:41:48 +0000 (15:41 +0100)]
Start of 0.11 cycle

10 years agoBump version.inc for release 0.10-rc1
Manuel Nickschas [Sun, 16 Mar 2014 14:35:21 +0000 (15:35 +0100)]
Bump version.inc for release

10 years agoYet another inxi version bump
Manuel Nickschas [Sun, 16 Mar 2014 12:46:15 +0000 (13:46 +0100)]
Yet another inxi version bump

This fixes the term-related warnings the last version had.

10 years agoUpdate ChangeLog
Manuel Nickschas [Sat, 15 Mar 2014 14:11:54 +0000 (15:11 +0100)]
Update ChangeLog

10 years agoBump inxi version to 2.1.1
Manuel Nickschas [Fri, 14 Mar 2014 21:51:37 +0000 (22:51 +0100)]
Bump inxi version to 2.1.1

Hasn't been bumped in rather a while.

10 years agoFix round-robin for networks that support it
Manuel Nickschas [Fri, 14 Mar 2014 20:13:09 +0000 (21:13 +0100)]
Fix round-robin for networks that support it

Some IRC networks perform round-robin by supplying a list of IP addresses
in their DNS records. However, Qt a) always uses the first address of that
list, and b) caches DNS records for a minute. This results that users who
connect at a roughly similar time (like at core startup) will all pick the
same IP for a given round-robin network address.

We now force Qt (simply by calling QHostInfo::fromName()) to perform a fresh
lookup every time it connects to an IRC network, which solves this problem.
However, this will not help you if your OS uses a system DNS cache that does
not reshuffle the list of IPs for repeated lookups.

10 years agoDon't always add a colon to custom commands
Manuel Nickschas [Fri, 14 Mar 2014 17:40:40 +0000 (18:40 +0100)]
Don't always add a colon to custom commands

The IRC spec mandates that spaces be used as separators between the
arguments for a command. However, the last parameter may itself contain
spaces, and to allow this, one can prefix that argument with a colon.

Instead of checking if the colon is needed, Quassel just always added
a colon to the last argument, which usually works fine. However, it broke
some uses of custom server commands.

This fix now checks if the last argument contains a space or starts with
a colon (which then needs to be escaped), and leaves it alone otherwise.

Fixes #1173 - thanks to Gunnar Beutner for providing the patch.

10 years agoMerge pull request #62 from Express50/issue_1243
Manuel Nickschas [Fri, 14 Mar 2014 17:32:39 +0000 (18:32 +0100)]
Merge pull request #62 from Express50/issue_1243

Fix URL regex

10 years agoFix URL regex 62/head
Express50 [Sun, 9 Mar 2014 17:42:01 +0000 (13:42 -0400)]
Fix URL regex

Removes unwise characters from URL regex. These characters should be percent escaped according to RFC 2396.

Fixes #1243

10 years agoadd context menu action to reset chat column widths
Daniel Albers [Sat, 1 Mar 2014 18:51:29 +0000 (19:51 +0100)]
add context menu action to reset chat column widths

If a ChatScene column has been resized during the current Quassel client
session or a column is <= 10 px wide, offer to reset the columns to sane
widths.

10 years agomake highlight rules case-insensitive by default
Daniel Albers [Wed, 26 Feb 2014 23:39:56 +0000 (00:39 +0100)]
make highlight rules case-insensitive by default

10 years agoSimplify clean-up-on-network-disconnect handling
Manuel Nickschas [Sun, 2 Mar 2014 20:19:34 +0000 (21:19 +0100)]
Simplify clean-up-on-network-disconnect handling

Previously, disconnecting from a network would trigger lots of unnecessary
stuff: because the NetworkModel needs to remove affected IrcChannels and
IrcUsers from its model items, we would trigger (on the core side!) an
IrcUser::quit() for every known user in that network, which would then remove
itself from all channels it's in, triggering the corresponding updates in the
related SyncableObjects, which would send lots of signals to the client which
would then perform its own cleanups per IrcUser, followed by throwing away
all IrcChannels and IrcUsers in that network anyway. By the time we reached
Network::removeChansAndUsers(), everything would actually be already all
gone triggered through syncobject updates.

Except in some rare cases when there was still something left behind, triggering
the dreaded "!_ircChannel && ircChannel" assert, that users have been reporting
for years. I still haven't figured out how that could possibly happen.

In any case, the only side effect that explicit call to IrcUser::quit() was
supposed to trigger was the removal of the relevant references in NetworkModel's
items. So now we just brutally delete all IrcUsers and IrcChannels on disconnect,
and have the NetworkModel items listen to the relevant destroyed() signals so
they can do their cleanup. This saves us from sending lots of stuff over the
network, and also should fix the assert (which we've replaced by a warning now,
just in case).

Fixes #1151 and a bunch of duplicates.

10 years agoDon't crash on very long inputs
Manuel Nickschas [Sat, 1 Mar 2014 13:07:36 +0000 (14:07 +0100)]
Don't crash on very long inputs

Because our style engine uses 16 bit indexes, strings can only be
styled if they're shorter than 2^16 characters. We do check for this
in the style engine and refuse to style strings that are longer.

However, just returning an default-constructed StyledString() is wrong,
because other places rely on there being at least one format and the
plaintext be initialized. So the proper way of handling this is just
using the baseFormat and the full string as plaintext instead of an
empty StyledString.

Fixes #1257.

10 years agoFix reconnection logic in the client
Manuel Nickschas [Thu, 27 Feb 2014 20:10:40 +0000 (21:10 +0100)]
Fix reconnection logic in the client

Seems like b654b2f broke reconnecting the client to the core; it would
only try once and then stop trying. Thanks to mamarley for noticing that bug
and bisecting the culprit.

The main issue causing this was that CoreConnection called
resetConnection(false) before (re)connecting, thus clearing the reconnect
flag. This call is a remnant from before we refactored out all the socket
handling and should not be needed anymore, now that we have clean disconnected()
semantics. Before b654b2f this was not a problem, because we would always
receive a socket error on failed reconnect that would reinstate the flag.

Because b654b2f worked around another issue by always sending a disconnected()
when the socket goes back into UnconnectedState, and this would happen before
the socket error signal was sent, the error handling would never be called
and the reconnect flag thus not reinstated, causing this bug.

So the second fix is to spin the event loop such that the error signal can
overtake that disconnected() signal and be handled properly (so we also
get the socket error message in the status bar).

10 years agoUse autonegotiation to choose an SSL protocol. 61/head
Michael Marley [Wed, 26 Feb 2014 01:53:36 +0000 (01:53 +0000)]
Use autonegotiation to choose an SSL protocol.
Previously, the user manually configured which SSL protocol to use
when connecting to IRC.  The default was SSLv3.  A better idea is
to allow Qt to automatically negotiate the best protocol out of
the available secure protocols, which this patch implements.

10 years agoUse Snore only if building without KDE
Patrick von Reth [Tue, 25 Feb 2014 23:26:06 +0000 (00:26 +0100)]
Use Snore only if building without KDE

Also use the system tray backend as default.

10 years agoAllow for clients to negotiate whether compression is used
Michael Marley [Mon, 24 Feb 2014 14:12:27 +0000 (14:12 +0000)]
Allow for clients to negotiate whether compression is used

Previously, streaming compression would always be used for the
datastream protocol and never for the legacy protocol, regardless
of whether the client set the compression bit during the handshake.
This patch enables negotiation of compression support and also
allows for streaming compression when using the legacy protocol
with the new handshake.

As is, this patch prevents clients with streaming compression
support but without this patch from connecting to cores with this
patch.  This problem occurs because the above-mentioned clients
never set the compression bit during the handshake, which didn't
cause a problem before because both sides unconditionally enabled
compression.  However, when connecting to a core with this patch,
such a client will request no compression and the core will
disable compression.  However, the client will still enable the
compression anyway, causing the connection to fail.

10 years agoupdate quassel.pot
Daniel Albers [Fri, 21 Feb 2014 12:13:21 +0000 (13:13 +0100)]
update quassel.pot

10 years agoadapt translations to previous change
Daniel Albers [Fri, 21 Feb 2014 12:13:03 +0000 (13:13 +0100)]
adapt translations to previous change

10 years agomove © years out of translatable text in aboutDlg
Daniel Albers [Fri, 21 Feb 2014 11:58:16 +0000 (12:58 +0100)]
move © years out of translatable text in aboutDlg

10 years agoremove old static versionLabel text
Daniel Albers [Fri, 21 Feb 2014 11:55:56 +0000 (12:55 +0100)]
remove old static versionLabel text

10 years agoSilence yet another warning
Manuel Nickschas [Wed, 19 Feb 2014 22:14:37 +0000 (23:14 +0100)]
Silence yet another warning

I have no clue why neither gcc nor clang throw a -Wsign-compare for me
there, but do for some other people, so... *sigh*

10 years agoFix -Wundef warning
Manuel Nickschas [Wed, 19 Feb 2014 21:41:41 +0000 (22:41 +0100)]
Fix -Wundef warning

Was thrown on 32 bit, should be #ifdef instead of #if because the attribute
is only defined on 64 bit machines.

10 years agoUse system zlib if available
Manuel Nickschas [Wed, 19 Feb 2014 20:19:32 +0000 (21:19 +0100)]
Use system zlib if available

Only fall back to miniz if we don't find zlib on the system. Distro
packagers like this much more, and we use code that has seen much
more testing. Incidentally, we've already had one case where miniz was
really slow on a 32 bit box.

Still keeping miniz as fallback for the rare platform/build box that
doesn't ship zlib, since waiting a few seconds for compressing the
backlog is still probably better than transmitting a few MB of extra
data...

10 years agoSilence one more warning in miniz.c
Manuel Nickschas [Wed, 19 Feb 2014 18:47:52 +0000 (19:47 +0100)]
Silence one more warning in miniz.c

Building on 32 bit machines causes some warnings related to undefined
macros; -Wno-undef silences that.

10 years agoupdate quassel.pot
Daniel Albers [Tue, 18 Feb 2014 23:57:54 +0000 (00:57 +0100)]
update quassel.pot

10 years agoUpdate translations from Transifex
Daniel Albers [Mon, 25 Nov 2013 04:00:37 +0000 (05:00 +0100)]
Update translations from Transifex

  24961 translated messages

Many thanks to:
 - es: Adolfo Jayme Barrientos <fitoschido@ubuntu.com>
 - fi: Larso <larso@gmx.com>
 - hi: libregeekingkid <rajuvindane@gmail.com>
 - nl: Simon Philips <simon.philips@gmail.com>
 - pa: A S Alam <apreet.alam@gmail.com>
 - tr: volkangezer <volkangezer@gmail.com>
 - uk: Yuri Chornoivan <yurchor@ukr.net>
 - zh_CN: leonfeng <chaofeng111@gmail.com>

10 years agoi18n: add some statistics to commit messages
Daniel Albers [Mon, 25 Nov 2013 00:27:34 +0000 (01:27 +0100)]
i18n: add some statistics to commit messages

10 years agoBump version.inc for release 0.10-beta1
Manuel Nickschas [Tue, 18 Feb 2014 22:40:06 +0000 (23:40 +0100)]
Bump version.inc for release

10 years agoUpdate ChangeLog
Manuel Nickschas [Tue, 18 Feb 2014 22:28:52 +0000 (23:28 +0100)]
Update ChangeLog

10 years agoUpdate AboutDlg
Manuel Nickschas [Tue, 18 Feb 2014 22:14:02 +0000 (23:14 +0100)]
Update AboutDlg

10 years agoUse a unicode string instead of the escaped version.
Chris H [Sun, 16 Feb 2014 02:26:05 +0000 (21:26 -0500)]
Use a unicode string instead of the escaped version.

Compiling with MSVC Doesn't like unicode literals here.

10 years agoDisable webpreview to avoid user interactaction
Deniz Türkoglu [Thu, 13 Feb 2014 11:44:21 +0000 (12:44 +0100)]
Disable webpreview to avoid user interactaction

If the user interacts with the webview, for instance click a button
or type text in it, it crashes the client.

Disable the webview so we still get the previews but can't interact
with them.

10 years agoUse new snore api and a bug fix
Patrick von Reth [Tue, 21 Jan 2014 11:29:41 +0000 (12:29 +0100)]
Use new snore api and a bug fix

10 years agoAdd option to include read messages in chat monitor
Adam Harwood [Sat, 21 Dec 2013 17:31:13 +0000 (17:31 +0000)]
Add option to include read messages in chat monitor

When the show backlog option is used, give users the option to include previously read messages.

10 years agoAdd option for chat monitor to look in the backlog
Awad Mackie [Sat, 24 Mar 2012 15:54:22 +0000 (15:54 +0000)]
Add option for chat monitor to look in the backlog

See #734. Thanks to Adam Harwood for rebasing this. ~Sput

10 years agoAdd option to enable linewrap mode
Pete Beardmore [Wed, 28 Aug 2013 10:42:36 +0000 (11:42 +0100)]
Add option to enable linewrap mode

Implements #1081.

10 years agoAdd CoreFeatures guard for hiding inactive networks
Chris Le Sueur [Thu, 23 Jan 2014 00:29:04 +0000 (00:29 +0000)]
Add CoreFeatures guard for hiding inactive networks

10 years agoAdd a setting to hide inactive networks in buffer views
Chris Le Sueur [Wed, 15 May 2013 22:44:26 +0000 (23:44 +0100)]
Add a setting to hide inactive networks in buffer views

10 years agoPeerFactory is not a QObject
Manuel Nickschas [Mon, 17 Feb 2014 22:24:20 +0000 (23:24 +0100)]
PeerFactory is not a QObject

warnings--

10 years agoFix CFLAGS for miniz
Manuel Nickschas [Mon, 17 Feb 2014 22:22:17 +0000 (23:22 +0100)]
Fix CFLAGS for miniz

... and make sure KDE doesn't overwrite them with something that
makes miniz not compile (apparently it's not C89 compliant...)

10 years agoEnable the DataStream protocol by default
Manuel Nickschas [Mon, 17 Feb 2014 21:21:29 +0000 (22:21 +0100)]
Enable the DataStream protocol by default

Now that compression works, let's use the DataStream protocol
by default if both sides claim support for it.

10 years agoImplement streaming compression support
Manuel Nickschas [Mon, 17 Feb 2014 21:18:39 +0000 (22:18 +0100)]
Implement streaming compression support

This leverages miniz in order to DEFLATE the data stream between
client and core. This is the standard format supported by zlib.

Note that streaming compression currently is unconditionally enabled
for the DataStream protocol, and unconditionally disabled for the
legacy protocol. We'll make them honor the handshake negotiation
later.

10 years agoAdd miniz, a drop-in replacement for (parts of) zlib
Manuel Nickschas [Mon, 17 Feb 2014 21:13:18 +0000 (22:13 +0100)]
Add miniz, a drop-in replacement for (parts of) zlib

miniz is a single-file drop-in replacement for most of zlib's
functionality. Having this bundled is quite convenient for us, so we
can rely on compression even on platforms where zlib is not readily
available.

miniz allows disabling unneeded functionality at compile time, by changing
some #defines, so we just compile the parts we really need (namely, the
basic DEFLATE routines).

We may use zlib proper in the future if we find it at compile time, though.

10 years agoHook the Compressor into RemotePeer
Manuel Nickschas [Sun, 16 Feb 2014 21:28:21 +0000 (22:28 +0100)]
Hook the Compressor into RemotePeer

Instead of reading from/writing to the socket directly, RemotePeer now
goes through a Compressor instance. At this time, no actual compression
will happen though.

Note that the legacy protocol does not support streaming compression, which
is why it sets a compression level of NoCompression.

10 years agoIntroduce basic (not-yet-compressing) implementation of Compressor
Manuel Nickschas [Sun, 16 Feb 2014 21:22:52 +0000 (22:22 +0100)]
Introduce basic (not-yet-compressing) implementation of Compressor

This class is intended to encapsulate the streaming compression between
the socket and the rest of RemotePeer; however, actual compression is
not yet implemented.

The Compressor class sits on top of the socket, providing a rudimentary API
for reading and writing data, and will transparently handle the (de)compression
once it's finished.

10 years agoMove all socket handling into RemotePeer
Manuel Nickschas [Sun, 16 Feb 2014 16:29:28 +0000 (17:29 +0100)]
Move all socket handling into RemotePeer

Previously we had the RemotePeer subclasses reading from and writing to
the socket themselves, resulting in code duplication and also making it
hard to have a single point for implementing compression support later.

We assume that any protocol we may come up with will send the size of
a datagram followed by the datagram itself, thus there's no need to
implement that part in the individual peers. And if we ever come up
with something else, we can always make some methods virtual and
override them for the special case.

We avoid using QDataStream in RemotePeer, as we are only reading/writing
QByteArrays anyway. That way, we can also replace the direct calls to
the socket by the layer implementing compression later, without it being
a proper QIODevice.

10 years agoDon't select the DataStream protocol by default for now
Manuel Nickschas [Sat, 15 Feb 2014 20:58:46 +0000 (21:58 +0100)]
Don't select the DataStream protocol by default for now

Until we have streaming compression implemented, using the DataStream
is not such a brilliant idea compared to the legacy protocol which
at least individually compresses messages. Thus, we should not select
the DataStream protocol by default.

Clients wanting to play around with the new protocol are still free to
negotiate this during handshake.

10 years agoRemove the STORED attribute from Q_PROPERTY declarations
Manuel Nickschas [Sat, 15 Feb 2014 20:55:30 +0000 (21:55 +0100)]
Remove the STORED attribute from Q_PROPERTY declarations

Due to some lack of documentation reading and consequential misunderstanding
of what the STORED=false attribute means for a QProperty, we still had some
really old headers wrongly declaring those.

I'm not aware of any effect on anything that having those has, but better
to just clean those up.

10 years agoOutput the chosen protocol type on connect
Manuel Nickschas [Sat, 15 Feb 2014 20:49:59 +0000 (21:49 +0100)]
Output the chosen protocol type on connect

Just some debug messages showing which protocol has been selected.

10 years agoDataStreamPeer: Optimize IrcUsersAndChannels init data
Manuel Nickschas [Sat, 15 Feb 2014 20:40:45 +0000 (21:40 +0100)]
DataStreamPeer: Optimize IrcUsersAndChannels init data

This is the only occasion where we change the actual message contents
for the DataStream protocol, as opposed to the legacy protocol.

However, it's worth it, because the init data for IrcUsers is the single
biggest offender in terms of data usage during sync, and we were wasting
lots of space by sending potentially thousands of identically-structured
QVariantMaps (one per IrcUser), each of which contains an indentical set
of key names. The same was true for IrcChannels in that same message,
although the data set tends to be smaller for that one.

We've now changed that by sending the init data for all the users and
channels as lists of attributes, which are then reassembled into individual
initData maps after receiving them. Our benchmarks show space savings
around 56%, which can amount to several megabytes in the uncompressed case,
provided you are in lots of busy channels. With compression it's less
impressive, but we can still save a few hundred kilobytes.

The legacy protocol gains a pair of translation methods for this special case,
thus there are no changes in the legacy format.

10 years agoDataStreamPeer: Optimize the InitData message
Manuel Nickschas [Wed, 29 Jan 2014 00:36:49 +0000 (01:36 +0100)]
DataStreamPeer: Optimize the InitData message

Since an InitData message consists of the usual message header
(serialized as a QVariantList) followed by a QVariantMap, we can
do what we did in a few other places already; transform the map
into a list of key-value pairs, the keys being UTF-8 strings (as
QByteArrays) instead of QStrings, and append that list to the
rest of the message.

This is just a small optimization, but straightforward to do without
changing protocol semantics or introspecting payloads. And
since we send lots of InitData messages, saving even a few bytes
per message may be worth it.

10 years agoDataStreamPeer: Optimize message serialization format
Manuel Nickschas [Tue, 28 Jan 2014 23:08:34 +0000 (00:08 +0100)]
DataStreamPeer: Optimize message serialization format

The legacy protocol serializes all messages as QVariant-in-a-QByteArray.
Except with compression, then it is QVariant-in-a-compressed-
QByteArray-in-a-QByteArray. While the actual messages either
comes as a QVariantList or a QVariantMap which is encapsulated
in above QVariant-in-a-mess.

In other words, this seems a bit excessive and causes unneeded overhead.

So for the DataStreamPeer, we're simplifying this. As all post-handshake messages
are structured as a QVariantList, we're now making this the on-wire format
as well. Since we need to know the message size for deserialization, we
first send the total message size as a quint32, followed by the number of items
as a quint32, followed by the QVariants. [1]

Since handshake messages are QVariantMaps, and we want to avoid over-nesting things,
we now send those as such a QVariantList as well, where the items are key-value
pairs - the key as UTF-8 string (as a QByteArray), and the value as a QVariant.

[1] This happens to be the same format as a QByteArray containing a QVariantList,
    so the code for that gets rather simple.

10 years agoDataStreamPeer: Send QDateTime instead of QTime in heartbeat messages
Manuel Nickschas [Fri, 24 Jan 2014 22:58:51 +0000 (23:58 +0100)]
DataStreamPeer: Send QDateTime instead of QTime in heartbeat messages

This allows the lag detection to work correctly even during a day change.

10 years agoDataStreamPeer: Use UTF-8 QByteArrays instead of QString for message headers
Manuel Nickschas [Fri, 24 Jan 2014 22:54:25 +0000 (23:54 +0100)]
DataStreamPeer: Use UTF-8 QByteArrays instead of QString for message headers

This affects the objectName in SyncMessage, InitRequest and InitData.
While the savings should be rather small in particular with compression
enabled, we shouldn't skip this opportunity; while introspecting all
serialized data for QStrings would be too invasive, we can easily do
it for those clearly defined message fields.

10 years agoDataStreamPeer: Remove per-message compression
Manuel Nickschas [Fri, 24 Jan 2014 22:52:17 +0000 (23:52 +0100)]
DataStreamPeer: Remove per-message compression

With the new handshake, we're going to use streaming compression, which
is negotiated and initiated before the peer is instantiated.

10 years agoDataStreamPeer: Remove obsolete stuff
Manuel Nickschas [Fri, 24 Jan 2014 22:50:59 +0000 (23:50 +0100)]
DataStreamPeer: Remove obsolete stuff

10 years agoIntroduce the DataStreamProtocol
Manuel Nickschas [Fri, 24 Jan 2014 22:15:02 +0000 (23:15 +0100)]
Introduce the DataStreamProtocol

This is going to be a streamlined version of the LegacyProtocol, still
using QDataStream serialization, but with some of the overhead removed
from the message formats and not supporting stuff that's deprecated.
The DataStreamProtocol will be automatically selected if both client
and core support it.

This commit simply adds a copy of the LegacyProtocol with the necessary
changes to make it compile. The optimizations are going to be in separate
commits so that the changes can be easier tracked by others implementing
it.

10 years agoMake LegacyPeer::writeSocketData() private
Manuel Nickschas [Fri, 24 Jan 2014 22:01:12 +0000 (23:01 +0100)]
Make LegacyPeer::writeSocketData() private

No longer used outside of this class.

10 years agoThere won't ever be a Qt 4.9...
Manuel Nickschas [Wed, 29 Jan 2014 20:54:25 +0000 (21:54 +0100)]
There won't ever be a Qt 4.9...

... and this should actually have been a check for Qt 4.7+.

10 years agoMake CTCP PING report the correct millisecond round-trip time
Manuel Nickschas [Wed, 29 Jan 2014 19:27:48 +0000 (20:27 +0100)]
Make CTCP PING report the correct millisecond round-trip time

If we want to display latency in milliseconds, we should also make sure
our payload is set in milliseconds.

Unfortunately, millisecond resolution for QDateTime appeared only in
Qt 4.7, so it'll stay in seconds for cores built against older Qt versions.

10 years agoUse milliseconds for CTCP PING
Bas Pape [Mon, 1 Aug 2011 08:11:02 +0000 (10:11 +0200)]
Use milliseconds for CTCP PING

10 years agoUse PeerFactory instead of creating LegacyPeer directly
Manuel Nickschas [Thu, 23 Jan 2014 21:34:39 +0000 (22:34 +0100)]
Use PeerFactory instead of creating LegacyPeer directly

This means that legacypeer.h needs be included by peerfactory.cpp only,
and we can remove all references to it elsewhere.

10 years agoHave the PeerFactory provide the list of supported protocols
Manuel Nickschas [Thu, 23 Jan 2014 21:30:59 +0000 (22:30 +0100)]
Have the PeerFactory provide the list of supported protocols

... and make use of that in ClientAuthHandler, instead of hardcoding
the available protocols there.

10 years agoMore typedef, less typing
Manuel Nickschas [Thu, 23 Jan 2014 21:15:18 +0000 (22:15 +0100)]
More typedef, less typing

10 years agoImplement protocol detection
Manuel Nickschas [Thu, 23 Jan 2014 19:36:43 +0000 (20:36 +0100)]
Implement protocol detection

This introduces a new initial handshake for negotiating the supported
protocols and connection features on both sides. It is completely
backwards compatible with older releases, in which case we go into
fallback mode.

Arguably, we could've used a nice, verbose, text-based handshake, but
that would've introduced questions around string formats, parsing and so
on. Also I felt like doing some bitbanging, so now the probing only
exchanges a few bytes which are described in the wiki [1]. If we ever
plan to use a more verbose or different format, changing the magic that
starts the whole shebang will be sufficient to indicate a new format.

Immediately after probing, if both core and client support the new format
(and a protocol other than the legacy one),we'll enable SSL and compression [2]
as appropriate, instead of doing it somewhat later in the middle of the legacy
handshake.

To retain compatibility, the magic number sent by the client is designed such
that older cores will immediately close the connection; we'll then reconnect
in compatibility mode. The other way round, if an older client connects to
a new core, we'll figure out that there's no magic being sent and switch to
legacy mode as well.

The unchanged legacy protocol is also the last resort even if both ends speak
the new handshake as long as we don't have an alternative to offer. So for now,
we'll probe for protocol support, get back the legacy protocol as only choice,
and use that as before. This also disables early SSL and compression mentioned above.

This means that 3rd party clients could already implement the handshake in
preparation for the future without changing anything else. Note that they should
also implement the detection of older cores in order to stay compatible with them -
simply detect a disconnect after the first few bytes sent and reconnect again
in compat mode.

[1] http://bugs.quassel-irc.org/projects/quassel-irc/wiki/Doc_quassel_protocols
[2] Not implemented yet.

10 years agoAllow overriding of socket handling methods
Manuel Nickschas [Thu, 23 Jan 2014 19:32:25 +0000 (20:32 +0100)]
Allow overriding of socket handling methods

This is primarily needed for ClientAuthHandler, which does not want
to throw error messages to the outside during protocol detection.

10 years agoAdd PeerFactory
Manuel Nickschas [Thu, 23 Jan 2014 00:47:50 +0000 (01:47 +0100)]
Add PeerFactory

This factory creates an instance of a RemotePeer subclass based on the
given protocol type and peer-specific features. If given a list, it will
select the preferred one (generally the first one that matches an available
peer which accepts the given peer-specific features).

For now, we just have the LegacyPeer (which does not have specific
features, so that value is ignored).

10 years agoLet RemotePeer(s) tell their protocol type and features
Manuel Nickschas [Thu, 23 Jan 2014 00:17:46 +0000 (01:17 +0100)]
Let RemotePeer(s) tell their protocol type and features

Knowing a peer's supported procotol type will come in handy once we
support more than one protocol. Also, peers may support specific
features which they can now report via the new accessor.

10 years agoHandle the readyRead() signal in RemotePeer instead of LegacyPeer
Manuel Nickschas [Thu, 23 Jan 2014 00:05:29 +0000 (01:05 +0100)]
Handle the readyRead() signal in RemotePeer instead of LegacyPeer

That way, the RemotePeer subclasses don't all need to connect to the
signal themselves; also, we can make sure in a central place that
socket data is processed even the socket was handed over to the peer
with unhandled data still in its buffer.

Instead of handling the signal directly, RemotePeer subclasses need
to implement the onSocketDataAvailable() method.

10 years agoUpdate AboutDlg
Manuel Nickschas [Wed, 22 Jan 2014 19:47:04 +0000 (20:47 +0100)]
Update AboutDlg

10 years agoChange ifdefs around Main ToolBar fix to target mac only.
Michael Kedzierski [Fri, 17 Jan 2014 12:52:15 +0000 (23:52 +1100)]
Change ifdefs around Main ToolBar fix to target mac only.

10 years agoSave Main ToolBar state when not built against KDE. Fixes #1116
Michael Kedzierski [Fri, 17 Jan 2014 11:45:49 +0000 (22:45 +1100)]
Save Main ToolBar state when not built against KDE. Fixes #1116

10 years agoFix signedness
Manuel Nickschas [Sun, 19 Jan 2014 02:29:57 +0000 (03:29 +0100)]
Fix signedness

This should actually be unsigned.

10 years agoRemove unused
Manuel Nickschas [Sun, 19 Jan 2014 02:27:14 +0000 (03:27 +0100)]
Remove unused

Thanks Clang.

10 years agoFix header guard
Manuel Nickschas [Sun, 19 Jan 2014 02:11:39 +0000 (03:11 +0100)]
Fix header guard

Thanks Clang.

10 years agoEncapsulate socket state in AuthHandler, properly handle disconnects
Manuel Nickschas [Sat, 18 Jan 2014 18:06:06 +0000 (19:06 +0100)]
Encapsulate socket state in AuthHandler, properly handle disconnects

The actual state of the socket used to connect to the core should be
kept internal to AuthHandler (and RemotePeer), in particular because
we want to handle the detection of legacy cores transparently later.
Also, it does not make sense to handle individual socket states outside
of the classes actually dealing with the socket; handling errors and
disconnection is sufficient. Both AuthHandler and Peer now emit
statusMessage() signals for displaying the socket state in the UI.
Because it was never used nor is it needed, this commits also removes
the AuthHandler::State enum.

While doing this, I also stumbled over the most likely reason for the
problem that the client would sometimes not reconnect to a core even
though it would claim to be disconnected:

QTcpSocket will only emit disconnected() when it had already reached
the Connected state, i.e. not if it was still connecting. While
CoreConnection would detect the socket go back to UnconnectedState,
and set its own state to Disconnected, it would never do its internal
clean-up which was tied to the socket's disconnected() signal, unless
the socket would also emit an error (which it apparently doesn't do
in all cases...). As a result, reconnecting was not possible in these
situations.

With these changes, CoreConnection relies solely on AuthHandler's
disconnected() signal, which is properly emitted even if establishing
the connection fails.

10 years agoUpdate AboutDlg
Manuel Nickschas [Tue, 14 Jan 2014 00:10:41 +0000 (01:10 +0100)]
Update AboutDlg