From: Manuel Nickschas Date: Tue, 19 Feb 2013 22:15:42 +0000 (-0800) Subject: Merge pull request #2 from sandsmark/wii X-Git-Tag: 0.9-beta1~19 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=9fc57dc2c000e80fb8bd746a090e2e8210e1278e;hp=873e91ddf4548f4f97d7fb171f54f28fa71ff4f1 Merge pull request #2 from sandsmark/wii Add irssi's 'wii' as a default alias --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bd917c9..353511d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,8 @@ project(QuasselIRC) include(CheckFunctionExists) include(CheckIncludeFile) -# cmake 2.6.2 is required for KDE >=4.2 and should be widespread enough now # For building against Qt5, we check for an even newer cmake version below! -cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8.1 FATAL_ERROR) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) @@ -69,6 +68,7 @@ option(STATIC "Enable static building (might not be portable)" OFF) if(APPLE) option(DEPLOY "Mac OS X only! Adds required libs to bundle resources and create a dmg. Note: requires Qt to be built with 10.4u SDK" OFF) + option(WITH_NOTIFICATION_CENTER "Enable OS X Notification Center support" ON) endif(APPLE) # Default to embedding data in the static case @@ -371,6 +371,15 @@ if(BUILD_GUI) set(INDICATEQT_LIBRARIES "") endif(WITH_LIBINDICATE AND NOT WITH_QT5) + # Setup OS X notification center support + if(WITH_NOTIFICATION_CENTER AND APPLE) + set(HAVE_NOTIFICATION_CENTER true) + add_definitions(-DHAVE_NOTIFICATION_CENTER) + set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} + /System/Library/Frameworks/Foundation.framework + ) + endif() + endif(BUILD_GUI) # Core-only deps diff --git a/scripts/build/Info.plist b/scripts/build/Info.plist index c0093c62..ccfc721a 100644 --- a/scripts/build/Info.plist +++ b/scripts/build/Info.plist @@ -28,6 +28,8 @@ NSPrincipalClass NSApplication + NSHighResolutionCapable + NSHumanReadableCopyright © 2005-2012, Quassel IRC Team diff --git a/src/client/abstractmessageprocessor.cpp b/src/client/abstractmessageprocessor.cpp index 13a20235..b5fe9544 100644 --- a/src/client/abstractmessageprocessor.cpp +++ b/src/client/abstractmessageprocessor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/abstractmessageprocessor.h b/src/client/abstractmessageprocessor.h index 8d5f5d6f..5a228a2c 100644 --- a/src/client/abstractmessageprocessor.h +++ b/src/client/abstractmessageprocessor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/abstractui.cpp b/src/client/abstractui.cpp index 95b9ee15..5657d793 100644 --- a/src/client/abstractui.cpp +++ b/src/client/abstractui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/abstractui.h b/src/client/abstractui.h index 44b0bf32..7730c643 100644 --- a/src/client/abstractui.h +++ b/src/client/abstractui.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/backlogrequester.cpp b/src/client/backlogrequester.cpp index a512d0d2..32bd887e 100644 --- a/src/client/backlogrequester.cpp +++ b/src/client/backlogrequester.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/backlogrequester.h b/src/client/backlogrequester.h index 14ea1e70..991ea8ac 100644 --- a/src/client/backlogrequester.h +++ b/src/client/backlogrequester.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/backlogsettings.h b/src/client/backlogsettings.h index d0c6d306..30335aee 100644 --- a/src/client/backlogsettings.h +++ b/src/client/backlogsettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index 747325d6..2900403a 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/buffermodel.h b/src/client/buffermodel.h index c1567a06..38a88f6a 100644 --- a/src/client/buffermodel.h +++ b/src/client/buffermodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/buffersettings.cpp b/src/client/buffersettings.cpp index b29e42e2..c940c57d 100644 --- a/src/client/buffersettings.cpp +++ b/src/client/buffersettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/buffersettings.h b/src/client/buffersettings.h index 572f3e1b..15c690af 100644 --- a/src/client/buffersettings.h +++ b/src/client/buffersettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/bufferviewoverlay.cpp b/src/client/bufferviewoverlay.cpp index 3fca89a9..83560229 100644 --- a/src/client/bufferviewoverlay.cpp +++ b/src/client/bufferviewoverlay.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/bufferviewoverlay.h b/src/client/bufferviewoverlay.h index da61b6e6..6be157a6 100644 --- a/src/client/bufferviewoverlay.h +++ b/src/client/bufferviewoverlay.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/client.cpp b/src/client/client.cpp index 7b94d933..fe49f774 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/client.h b/src/client/client.h index ec87b8a4..460bedee 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientaliasmanager.cpp b/src/client/clientaliasmanager.cpp index 224df423..29daabd9 100644 --- a/src/client/clientaliasmanager.cpp +++ b/src/client/clientaliasmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientaliasmanager.h b/src/client/clientaliasmanager.h index d11c61b8..8fd02611 100644 --- a/src/client/clientaliasmanager.h +++ b/src/client/clientaliasmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index d3f4b7a6..8cf96c35 100644 --- a/src/client/clientbacklogmanager.cpp +++ b/src/client/clientbacklogmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbacklogmanager.h b/src/client/clientbacklogmanager.h index f341d770..c526e99b 100644 --- a/src/client/clientbacklogmanager.h +++ b/src/client/clientbacklogmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbufferviewconfig.cpp b/src/client/clientbufferviewconfig.cpp index 578ad490..474828a0 100644 --- a/src/client/clientbufferviewconfig.cpp +++ b/src/client/clientbufferviewconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbufferviewconfig.h b/src/client/clientbufferviewconfig.h index 06205efb..857c3077 100644 --- a/src/client/clientbufferviewconfig.h +++ b/src/client/clientbufferviewconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbufferviewmanager.cpp b/src/client/clientbufferviewmanager.cpp index 98db62c9..7f7cda11 100644 --- a/src/client/clientbufferviewmanager.cpp +++ b/src/client/clientbufferviewmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientbufferviewmanager.h b/src/client/clientbufferviewmanager.h index 63a20a0c..57d26556 100644 --- a/src/client/clientbufferviewmanager.h +++ b/src/client/clientbufferviewmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientcoreinfo.cpp b/src/client/clientcoreinfo.cpp index 1a871d8f..708ab442 100644 --- a/src/client/clientcoreinfo.cpp +++ b/src/client/clientcoreinfo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientcoreinfo.h b/src/client/clientcoreinfo.h index 75e3a41b..3b72c45f 100644 --- a/src/client/clientcoreinfo.h +++ b/src/client/clientcoreinfo.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientidentity.cpp b/src/client/clientidentity.cpp index 671a5878..eb64a12a 100644 --- a/src/client/clientidentity.cpp +++ b/src/client/clientidentity.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientidentity.h b/src/client/clientidentity.h index 02dcd33c..1543d31c 100644 --- a/src/client/clientidentity.h +++ b/src/client/clientidentity.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientignorelistmanager.cpp b/src/client/clientignorelistmanager.cpp index 85cbabe9..02a4e23f 100644 --- a/src/client/clientignorelistmanager.cpp +++ b/src/client/clientignorelistmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientignorelistmanager.h b/src/client/clientignorelistmanager.h index 5174dfbf..557c57a5 100644 --- a/src/client/clientignorelistmanager.h +++ b/src/client/clientignorelistmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientirclisthelper.cpp b/src/client/clientirclisthelper.cpp index faf25f87..3e7a4bdb 100644 --- a/src/client/clientirclisthelper.cpp +++ b/src/client/clientirclisthelper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientirclisthelper.h b/src/client/clientirclisthelper.h index 708fa144..54c76ff9 100644 --- a/src/client/clientirclisthelper.h +++ b/src/client/clientirclisthelper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp index 4e3fd162..b00f6b2a 100644 --- a/src/client/clientsettings.cpp +++ b/src/client/clientsettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientsettings.h b/src/client/clientsettings.h index f2434a20..d2c3c4d7 100644 --- a/src/client/clientsettings.h +++ b/src/client/clientsettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientuserinputhandler.cpp b/src/client/clientuserinputhandler.cpp index e4a0f40b..a8c62fc6 100644 --- a/src/client/clientuserinputhandler.cpp +++ b/src/client/clientuserinputhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/clientuserinputhandler.h b/src/client/clientuserinputhandler.h index 40654087..88f456ce 100644 --- a/src/client/clientuserinputhandler.h +++ b/src/client/clientuserinputhandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/coreaccount.cpp b/src/client/coreaccount.cpp index 37ee473e..237ae70b 100644 --- a/src/client/coreaccount.cpp +++ b/src/client/coreaccount.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/coreaccount.h b/src/client/coreaccount.h index c33afdf6..6da6734c 100644 --- a/src/client/coreaccount.h +++ b/src/client/coreaccount.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/coreaccountmodel.cpp b/src/client/coreaccountmodel.cpp index 06955740..33733461 100644 --- a/src/client/coreaccountmodel.cpp +++ b/src/client/coreaccountmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/coreaccountmodel.h b/src/client/coreaccountmodel.h index 2527007e..24aeffda 100644 --- a/src/client/coreaccountmodel.h +++ b/src/client/coreaccountmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/coreconnection.cpp b/src/client/coreconnection.cpp index 6b498157..fb553fec 100644 --- a/src/client/coreconnection.cpp +++ b/src/client/coreconnection.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -28,23 +28,26 @@ #include "clientsettings.h" #include "coreaccountmodel.h" #include "identity.h" +#include "internalpeer.h" #include "network.h" #include "networkmodel.h" #include "quassel.h" #include "signalproxy.h" #include "util.h" +#include "protocols/legacy/legacypeer.h" + CoreConnection::CoreConnection(CoreAccountModel *model, QObject *parent) : QObject(parent), _model(model), - _blockSize(0), _state(Disconnected), _wantReconnect(false), _progressMinimum(0), _progressMaximum(-1), _progressValue(-1), _wasReconnect(false), - _requestedDisconnect(false) + _requestedDisconnect(false), + _resetting(false) { qRegisterMetaType("CoreConnection::ConnectionState"); } @@ -120,7 +123,7 @@ void CoreConnection::updateProgress(int value, int max) void CoreConnection::reconnectTimeout() { - if (!_socket) { + if (!_peer) { CoreConnectionSettings s; if (_wantReconnect && s.autoReconnect()) { #ifdef HAVE_KDE @@ -198,12 +201,7 @@ void CoreConnection::solidNetworkStatusChanged(Solid::Networking::Status status) bool CoreConnection::isEncrypted() const { -#ifndef HAVE_SSL - return false; -#else - QSslSocket *sock = qobject_cast(_socket); - return isConnected() && sock && sock->isEncrypted(); -#endif + return _peer && _peer->isSecure(); } @@ -213,7 +211,7 @@ bool CoreConnection::isLocalConnection() const return false; if (currentAccount().isInternal()) return true; - if (_socket->peerAddress().isInSubnet(QHostAddress::LocalHost, 0x00ffffff)) + if (_peer->isLocal()) return true; return false; @@ -285,76 +283,74 @@ void CoreConnection::setState(ConnectionState state) void CoreConnection::coreSocketError(QAbstractSocket::SocketError) { - qDebug() << "coreSocketError" << _socket << _socket->errorString(); disconnectFromCore(_socket->errorString(), true); } void CoreConnection::coreSocketDisconnected() { - // qDebug() << Q_FUNC_INFO; _wasReconnect = !_requestedDisconnect; resetConnection(true); // FIXME handle disconnects gracefully } -void CoreConnection::coreHasData() +// note: this still expects the legacy protocol +// note²: after cleaning this up, we can probably get rid of _socket altogether +void CoreConnection::coreHasData(const QVariant &item) { - QVariant item; - while (SignalProxy::readDataFromDevice(_socket, _blockSize, item)) { - QVariantMap msg = item.toMap(); - if (!msg.contains("MsgType")) { - // This core is way too old and does not even speak our init protocol... - emit connectionErrorPopup(tr("The Quassel Core you try to connect to is too old! Please consider upgrading.")); - disconnectFromCore(QString(), false); - return; - } - if (msg["MsgType"] == "ClientInitAck") { - clientInitAck(msg); - } - else if (msg["MsgType"] == "ClientInitReject") { - emit connectionErrorPopup(msg["Error"].toString()); - disconnectFromCore(QString(), false); - return; - } - else if (msg["MsgType"] == "CoreSetupAck") { - emit coreSetupSuccess(); - } - else if (msg["MsgType"] == "CoreSetupReject") { - emit coreSetupFailed(msg["Error"].toString()); - } - else if (msg["MsgType"] == "ClientLoginReject") { - loginFailed(msg["Error"].toString()); - } - else if (msg["MsgType"] == "ClientLoginAck") { - loginSuccess(); - } - else if (msg["MsgType"] == "SessionInit") { - // that's it, let's hand over to the signal proxy - // if the socket is an orphan, the signalProxy adopts it. - // -> we don't need to care about it anymore - _socket->setParent(0); - Client::signalProxy()->addPeer(_socket); - - sessionStateReceived(msg["SessionState"].toMap()); - break; // this is definitively the last message we process here! - } - else { - disconnectFromCore(tr("Invalid data received from core"), false); - return; - } + QVariantMap msg = item.toMap(); + if (!msg.contains("MsgType")) { + // This core is way too old and does not even speak our init protocol... + emit connectionErrorPopup(tr("The Quassel Core you try to connect to is too old! Please consider upgrading.")); + disconnectFromCore(QString(), false); + return; + } + if (msg["MsgType"] == "ClientInitAck") { + clientInitAck(msg); + } + else if (msg["MsgType"] == "ClientInitReject") { + emit connectionErrorPopup(msg["Error"].toString()); + disconnectFromCore(QString(), false); + return; + } + else if (msg["MsgType"] == "CoreSetupAck") { + emit coreSetupSuccess(); + } + else if (msg["MsgType"] == "CoreSetupReject") { + emit coreSetupFailed(msg["Error"].toString()); + } + else if (msg["MsgType"] == "ClientLoginReject") { + loginFailed(msg["Error"].toString()); } - if (_blockSize > 0) { - updateProgress(_socket->bytesAvailable(), _blockSize); + else if (msg["MsgType"] == "ClientLoginAck") { + loginSuccess(); + } + else if (msg["MsgType"] == "SessionInit") { + // that's it, let's hand over to the signal proxy + // if the connection is an orphan, the signalProxy adopts it. + // -> we don't need to care about it anymore + + disconnect(_peer, 0, this, 0); + + _peer->setParent(0); + Client::signalProxy()->addPeer(_peer); + + sessionStateReceived(msg["SessionState"].toMap()); + } + else { + disconnectFromCore(tr("Invalid data received from core"), false); + return; } } void CoreConnection::disconnectFromCore() { - _requestedDisconnect = true; - disconnectFromCore(QString(), false); // requested disconnect, so don't try to reconnect + if (_socket) { + _requestedDisconnect = true; + disconnectFromCore(QString(), false); // requested disconnect, so don't try to reconnect + } } @@ -365,30 +361,42 @@ void CoreConnection::disconnectFromCore(const QString &errorString, bool wantRec _wasReconnect = wantReconnect; // store if disconnect was requested + resetConnection(wantReconnect); + if (errorString.isEmpty()) emit connectionError(tr("Disconnected")); else emit connectionError(errorString); - - Client::signalProxy()->removeAllPeers(); - resetConnection(wantReconnect); } void CoreConnection::resetConnection(bool wantReconnect) { + if (_resetting) + return; + _resetting = true; + _wantReconnect = wantReconnect; - if (_socket) { + if (_peer) { + disconnect(_socket, 0, this, 0); + disconnect(_peer, 0, this, 0); + _peer->close(); + + if (_peer->parent() == this) + _peer->deleteLater(); // if it's not us, it belongs to the sigproxy which will delete it + _socket = 0; // socket is owned and will be deleted by RemoteConnection + _peer = 0; + } + else if (_socket) { disconnect(_socket, 0, this, 0); _socket->deleteLater(); _socket = 0; } + _requestedDisconnect = false; - _blockSize = 0; _coreMsgBuffer.clear(); - _netsToSync.clear(); _numNetsToSync = 0; @@ -404,6 +412,8 @@ void CoreConnection::resetConnection(bool wantReconnect) if (wantReconnect && s.autoReconnect()) { _reconnectTimer.start(); } + + _resetting = false; } @@ -464,7 +474,11 @@ void CoreConnection::connectToCurrentAccount() return; } emit startInternalCore(); - emit connectToInternalCore(Client::instance()->signalProxy()); + + InternalPeer *peer = new InternalPeer(); + Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership + emit connectToInternalCore(peer); + return; } @@ -472,7 +486,7 @@ void CoreConnection::connectToCurrentAccount() Q_ASSERT(!_socket); #ifdef HAVE_SSL - QSslSocket *sock = new QSslSocket(Client::instance()); + QSslSocket *sock = new QSslSocket(this); // make sure the warning is shown if we happen to connect without SSL support later s.setAccountValue("ShowNoClientSslWarning", true); #else @@ -487,7 +501,7 @@ void CoreConnection::connectToCurrentAccount() s.setAccountValue("ShowNoClientSslWarning", false); } } - QTcpSocket *sock = new QTcpSocket(Client::instance()); + QTcpSocket *sock = new QTcpSocket(this); #endif #ifndef QT_NO_NETWORKPROXY @@ -498,7 +512,6 @@ void CoreConnection::connectToCurrentAccount() #endif _socket = sock; - connect(sock, SIGNAL(readyRead()), SLOT(coreHasData())); connect(sock, SIGNAL(connected()), SLOT(coreSocketConnected())); connect(sock, SIGNAL(disconnected()), SLOT(coreSocketDisconnected())); connect(sock, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(coreSocketError(QAbstractSocket::SocketError))); @@ -511,6 +524,12 @@ void CoreConnection::connectToCurrentAccount() void CoreConnection::coreSocketConnected() { + // Create the connection which will handle the incoming data + Q_ASSERT(!_peer); + _peer = new LegacyPeer(_socket, this); + connect(_peer, SIGNAL(dataReceived(QVariant)), SLOT(coreHasData(QVariant))); + connect(_peer, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int))); + // Phase One: Send client info and wait for core info emit connectionMsg(tr("Synchronizing to core...")); @@ -527,7 +546,7 @@ void CoreConnection::coreSocketConnected() clientInit["UseCompression"] = false; #endif - SignalProxy::writeDataToDevice(_socket, clientInit); + qobject_cast(_peer)->writeSocketData(clientInit); } @@ -676,7 +695,7 @@ void CoreConnection::loginToCore(const QString &prevError) clientLogin["MsgType"] = "ClientLogin"; clientLogin["User"] = currentAccount().user(); clientLogin["Password"] = currentAccount().password(); - SignalProxy::writeDataToDevice(_socket, clientLogin); + qobject_cast(_peer)->writeSocketData(clientLogin); } @@ -706,10 +725,6 @@ void CoreConnection::sessionStateReceived(const QVariantMap &state) { updateProgress(100, 100); - // rest of communication happens through SignalProxy... - disconnect(_socket, SIGNAL(readyRead()), this, 0); - disconnect(_socket, SIGNAL(connected()), this, 0); - syncToCore(state); } @@ -794,5 +809,5 @@ void CoreConnection::doCoreSetup(const QVariant &setupData) QVariantMap setup; setup["MsgType"] = "CoreSetupData"; setup["SetupData"] = setupData; - SignalProxy::writeDataToDevice(_socket, setup); + qobject_cast(_peer)->writeSocketData(setup); } diff --git a/src/client/coreconnection.h b/src/client/coreconnection.h index 0b64e9b5..836d8cc2 100644 --- a/src/client/coreconnection.h +++ b/src/client/coreconnection.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -37,9 +37,11 @@ #endif #include "coreaccount.h" +#include "remotepeer.h" #include "types.h" class CoreAccountModel; +class InternalPeer; class Network; class SignalProxy; @@ -60,23 +62,23 @@ public: void init(); - inline bool isConnected() const; - inline ConnectionState state() const; - inline CoreAccount currentAccount() const; + bool isConnected() const; + ConnectionState state() const; + CoreAccount currentAccount() const; bool isEncrypted() const; bool isLocalConnection() const; - inline int progressMinimum() const; - inline int progressMaximum() const; - inline int progressValue() const; - inline QString progressText() const; + int progressMinimum() const; + int progressMaximum() const; + int progressValue() const; + QString progressText() const; //! Check if we consider the last connect as reconnect - inline bool wasReconnect() const { return _wasReconnect; } + bool wasReconnect() const { return _wasReconnect; } #ifdef HAVE_SSL - inline const QSslSocket *sslSocket() const; + const QSslSocket *sslSocket() const; #endif public slots: @@ -105,7 +107,7 @@ signals: void coreSetupFailed(const QString &error); void startInternalCore(); - void connectToInternalCore(SignalProxy *proxy); + void connectToInternalCore(InternalPeer *connection); // These signals MUST be handled synchronously! void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage = QString()); @@ -121,7 +123,7 @@ private slots: void socketStateChanged(QAbstractSocket::SocketState); void coreSocketError(QAbstractSocket::SocketError); - void coreHasData(); + void coreHasData(const QVariant &item); void coreSocketConnected(); void coreSocketDisconnected(); @@ -173,8 +175,8 @@ private: CoreAccount _account; QVariantMap _coreMsgBuffer; - QPointer _socket; - quint32 _blockSize; + QPointer _socket; + QPointer _peer; ConnectionState _state; QTimer _reconnectTimer; @@ -188,6 +190,7 @@ private: QString _coreInfoString(const QVariantMap &); bool _wasReconnect; bool _requestedDisconnect; + bool _resetting; inline CoreAccountModel *accountModel() const; @@ -198,18 +201,18 @@ private: Q_DECLARE_METATYPE(CoreConnection::ConnectionState) // Inlines -int CoreConnection::progressMinimum() const { return _progressMinimum; } -int CoreConnection::progressMaximum() const { return _progressMaximum; } -int CoreConnection::progressValue() const { return _progressValue; } -QString CoreConnection::progressText() const { return _progressText; } +inline int CoreConnection::progressMinimum() const { return _progressMinimum; } +inline int CoreConnection::progressMaximum() const { return _progressMaximum; } +inline int CoreConnection::progressValue() const { return _progressValue; } +inline QString CoreConnection::progressText() const { return _progressText; } -CoreConnection::ConnectionState CoreConnection::state() const { return _state; } -bool CoreConnection::isConnected() const { return state() >= Connected; } -CoreAccount CoreConnection::currentAccount() const { return _account; } -CoreAccountModel *CoreConnection::accountModel() const { return _model; } +inline CoreConnection::ConnectionState CoreConnection::state() const { return _state; } +inline bool CoreConnection::isConnected() const { return state() >= Connected; } +inline CoreAccount CoreConnection::currentAccount() const { return _account; } +inline CoreAccountModel *CoreConnection::accountModel() const { return _model; } #ifdef HAVE_SSL -const QSslSocket *CoreConnection::sslSocket() const { return qobject_cast(_socket); } +inline const QSslSocket *CoreConnection::sslSocket() const { return qobject_cast(_socket); } #endif #endif diff --git a/src/client/execwrapper.cpp b/src/client/execwrapper.cpp index fd1e8c1c..5adc4596 100644 --- a/src/client/execwrapper.cpp +++ b/src/client/execwrapper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/execwrapper.h b/src/client/execwrapper.h index d7aa5c45..91895168 100644 --- a/src/client/execwrapper.h +++ b/src/client/execwrapper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/irclistmodel.cpp b/src/client/irclistmodel.cpp index b3ca23de..349ff727 100644 --- a/src/client/irclistmodel.cpp +++ b/src/client/irclistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/irclistmodel.h b/src/client/irclistmodel.h index 38179be8..9c25bd03 100644 --- a/src/client/irclistmodel.h +++ b/src/client/irclistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/messagefilter.cpp b/src/client/messagefilter.cpp index 241ad0f0..a9d8a7d4 100644 --- a/src/client/messagefilter.cpp +++ b/src/client/messagefilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/messagefilter.h b/src/client/messagefilter.h index 089e0a22..26a3e34e 100644 --- a/src/client/messagefilter.h +++ b/src/client/messagefilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/messagemodel.cpp b/src/client/messagemodel.cpp index c0a633ca..b09a456d 100644 --- a/src/client/messagemodel.cpp +++ b/src/client/messagemodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/messagemodel.h b/src/client/messagemodel.h index 8a3c828e..04e169a5 100644 --- a/src/client/messagemodel.h +++ b/src/client/messagemodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 51a6af6f..1a2da5e8 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 0cd97cdd..f0d4c02a 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/selectionmodelsynchronizer.cpp b/src/client/selectionmodelsynchronizer.cpp index 5494ed2f..5f22e4a4 100644 --- a/src/client/selectionmodelsynchronizer.cpp +++ b/src/client/selectionmodelsynchronizer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/selectionmodelsynchronizer.h b/src/client/selectionmodelsynchronizer.h index e6f08eb5..c40cc5c5 100644 --- a/src/client/selectionmodelsynchronizer.h +++ b/src/client/selectionmodelsynchronizer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index e481ea8d..05c9e5bc 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/client/treemodel.h b/src/client/treemodel.h index 26775330..574dc6a5 100644 --- a/src/client/treemodel.h +++ b/src/client/treemodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 2ddd926b..fe1d4f97 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -17,6 +17,7 @@ set(SOURCES eventmanager.cpp identity.cpp ignorelistmanager.cpp + internalpeer.cpp ircchannel.cpp ircevent.cpp irclisthelper.cpp @@ -28,10 +29,14 @@ set(SOURCES networkconfig.cpp networkevent.cpp quassel.cpp + remotepeer.cpp settings.cpp signalproxy.cpp syncableobject.cpp - util.cpp) + util.cpp + + protocols/legacy/legacypeer.cpp +) set(MOC_HDRS aliasmanager.h @@ -44,14 +49,19 @@ set(MOC_HDRS eventmanager.h identity.h ignorelistmanager.h + internalpeer.h ircchannel.h irclisthelper.h ircuser.h network.h networkconfig.h + remotepeer.h settings.h signalproxy.h - syncableobject.h) + syncableobject.h + + protocols/legacy/legacypeer.h +) set(HEADERS ${MOC_HDRS} abstractcliparser.h @@ -64,6 +74,7 @@ set(HEADERS ${MOC_HDRS} networkevent.h logger.h message.h + protocol.h types.h util.h) diff --git a/src/common/abstractcliparser.h b/src/common/abstractcliparser.h index c4b6adad..bce6ef48 100644 --- a/src/common/abstractcliparser.h +++ b/src/common/abstractcliparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/aliasmanager.cpp b/src/common/aliasmanager.cpp index 46e2afe0..d4e02a24 100644 --- a/src/common/aliasmanager.cpp +++ b/src/common/aliasmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/aliasmanager.h b/src/common/aliasmanager.h index 9c17f79b..a5646d85 100644 --- a/src/common/aliasmanager.h +++ b/src/common/aliasmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/backlogmanager.cpp b/src/common/backlogmanager.cpp index 64dab66b..c4527566 100644 --- a/src/common/backlogmanager.cpp +++ b/src/common/backlogmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/backlogmanager.h b/src/common/backlogmanager.h index 6c0dadba..9d11a322 100644 --- a/src/common/backlogmanager.h +++ b/src/common/backlogmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/basichandler.cpp b/src/common/basichandler.cpp index b705d550..341b7294 100644 --- a/src/common/basichandler.cpp +++ b/src/common/basichandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/basichandler.h b/src/common/basichandler.h index 827e74a0..663f487b 100644 --- a/src/common/basichandler.h +++ b/src/common/basichandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferinfo.cpp b/src/common/bufferinfo.cpp index ae569efa..da013e38 100644 --- a/src/common/bufferinfo.cpp +++ b/src/common/bufferinfo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferinfo.h b/src/common/bufferinfo.h index 22bf9332..c816a8b2 100644 --- a/src/common/bufferinfo.h +++ b/src/common/bufferinfo.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/buffersyncer.cpp b/src/common/buffersyncer.cpp index b685f088..5fdc34cc 100644 --- a/src/common/buffersyncer.cpp +++ b/src/common/buffersyncer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/buffersyncer.h b/src/common/buffersyncer.h index de0b50e5..99a90846 100644 --- a/src/common/buffersyncer.h +++ b/src/common/buffersyncer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 2fff951f..3607d0fc 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferviewconfig.h b/src/common/bufferviewconfig.h index 5b506e5c..6d024529 100644 --- a/src/common/bufferviewconfig.h +++ b/src/common/bufferviewconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferviewmanager.cpp b/src/common/bufferviewmanager.cpp index 01529dfc..bae7fe4b 100644 --- a/src/common/bufferviewmanager.cpp +++ b/src/common/bufferviewmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/bufferviewmanager.h b/src/common/bufferviewmanager.h index fcc01201..bf3f95fe 100644 --- a/src/common/bufferviewmanager.h +++ b/src/common/bufferviewmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/cliparser.cpp b/src/common/cliparser.cpp index ffaee234..30d98911 100644 --- a/src/common/cliparser.cpp +++ b/src/common/cliparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/cliparser.h b/src/common/cliparser.h index a0b4fa99..dc8528ab 100644 --- a/src/common/cliparser.h +++ b/src/common/cliparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/coreinfo.cpp b/src/common/coreinfo.cpp index f32a5a81..2d35f42d 100644 --- a/src/common/coreinfo.cpp +++ b/src/common/coreinfo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/coreinfo.h b/src/common/coreinfo.h index 506af59c..16df9574 100644 --- a/src/common/coreinfo.h +++ b/src/common/coreinfo.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ctcpevent.cpp b/src/common/ctcpevent.cpp index 2524ff28..099627b9 100644 --- a/src/common/ctcpevent.cpp +++ b/src/common/ctcpevent.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ctcpevent.h b/src/common/ctcpevent.h index 91e7bbb6..54e26ecd 100644 --- a/src/common/ctcpevent.h +++ b/src/common/ctcpevent.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/event.cpp b/src/common/event.cpp index 157460e5..4b916e54 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/event.h b/src/common/event.h index 23aaa10b..1abe0fac 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/eventmanager.cpp b/src/common/eventmanager.cpp index ca1a95f8..370f3a3b 100644 --- a/src/common/eventmanager.cpp +++ b/src/common/eventmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/eventmanager.h b/src/common/eventmanager.h index 57d7aff2..3dbd7262 100644 --- a/src/common/eventmanager.h +++ b/src/common/eventmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -101,6 +101,7 @@ public : IrcEventPrivmsg, IrcEventQuit, IrcEventTopic, + IrcEventWallops, IrcEventRawPrivmsg, ///< Undecoded privmsg (still needs CTCP parsing) IrcEventRawNotice, ///< Undecoded notice (still needs CTCP parsing) IrcEventUnknown, ///< Unknown non-numeric cmd diff --git a/src/common/genversion.cpp b/src/common/genversion.cpp index a939e9e3..64a1da68 100644 --- a/src/common/genversion.cpp +++ b/src/common/genversion.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/identity.cpp b/src/common/identity.cpp index b7181106..afdff7dd 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/identity.h b/src/common/identity.h index 12e56777..4de98751 100644 --- a/src/common/identity.h +++ b/src/common/identity.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ignorelistmanager.cpp b/src/common/ignorelistmanager.cpp index 2e9316bc..92052915 100644 --- a/src/common/ignorelistmanager.cpp +++ b/src/common/ignorelistmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ignorelistmanager.h b/src/common/ignorelistmanager.h index fabded7a..efa007fc 100644 --- a/src/common/ignorelistmanager.h +++ b/src/common/ignorelistmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/internalpeer.cpp b/src/common/internalpeer.cpp new file mode 100644 index 00000000..15e67ed3 --- /dev/null +++ b/src/common/internalpeer.cpp @@ -0,0 +1,217 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include +#include + +#include "internalpeer.h" + +using namespace Protocol; + +template +class PeerMessageEvent : public QEvent +{ +public: + PeerMessageEvent(InternalPeer *sender, InternalPeer::EventType eventType, const T &message) + : QEvent(QEvent::Type(eventType)), sender(sender), message(message) {} + InternalPeer *sender; + T message; +}; + + +InternalPeer::InternalPeer(QObject *parent) + : SignalProxy::AbstractPeer(parent), + _proxy(0), + _peer(0), + _isOpen(true) +{ + +} + + +InternalPeer::~InternalPeer() +{ + if (_isOpen) + emit disconnected(); +} + + +QString InternalPeer::description() const +{ + return tr("internal connection"); +} + + +bool InternalPeer::isOpen() const +{ + return true; +} + + +bool InternalPeer::isSecure() const +{ + return true; +} + + +bool InternalPeer::isLocal() const +{ + return true; +} + + +void InternalPeer::close(const QString &reason) +{ + // FIXME + Q_UNUSED(reason) + qWarning() << "closing not implemented!"; +} + + +int InternalPeer::lag() const +{ + return 0; +} + + +void InternalPeer::setSignalProxy(::SignalProxy *proxy) +{ + if (!proxy && _proxy) { + _proxy = 0; + if (_isOpen) { + _isOpen = false; + emit disconnected(); + } + return; + } + + if (proxy && !_proxy) { + _proxy = proxy; + return; + } + + qWarning() << Q_FUNC_INFO << "Changing the SignalProxy is not supported!"; +} + + +void InternalPeer::setPeer(InternalPeer *peer) +{ + if (_peer) { + qWarning() << Q_FUNC_INFO << "Peer already set, ignoring!"; + return; + } + _peer = peer; + connect(peer, SIGNAL(disconnected()), SLOT(peerDisconnected())); +} + + +void InternalPeer::peerDisconnected() +{ + disconnect(_peer, 0, this, 0); + _peer = 0; + if (_isOpen) { + _isOpen = false; + emit disconnected(); + } +} + + +void InternalPeer::dispatch(const SyncMessage &msg) +{ + dispatch(SyncMessageEvent, msg); +} + + +void InternalPeer::dispatch(const RpcCall &msg) +{ + dispatch(RpcCallEvent, msg); +} + + +void InternalPeer::dispatch(const InitRequest &msg) +{ + dispatch(InitRequestEvent, msg); +} + + +void InternalPeer::dispatch(const InitData &msg) +{ + dispatch(InitDataEvent, msg); +} + + +template +void InternalPeer::dispatch(EventType eventType, const T &msg) +{ + if (!_peer) { + qWarning() << Q_FUNC_INFO << "Cannot dispatch a message without a peer!"; + return; + } + + if(QThread::currentThread() == _peer->thread()) + _peer->handle(msg); + else + QCoreApplication::postEvent(_peer, new PeerMessageEvent(this, eventType, msg)); +} + + +template +void InternalPeer::handle(const T &msg) +{ + if (!_proxy) { + qWarning() << Q_FUNC_INFO << "Cannot handle a message without having a signal proxy set!"; + return; + } + + _proxy->handle(this, msg); +} + + +void InternalPeer::customEvent(QEvent *event) +{ + switch ((int)event->type()) { + case SyncMessageEvent: { + PeerMessageEvent *e = static_cast *>(event); + handle(e->message); + break; + } + case RpcCallEvent: { + PeerMessageEvent *e = static_cast *>(event); + handle(e->message); + break; + } + case InitRequestEvent: { + PeerMessageEvent *e = static_cast *>(event); + handle(e->message); + break; + } + case InitDataEvent: { + PeerMessageEvent *e = static_cast *>(event); + handle(e->message); + break; + } + + default: + qWarning() << Q_FUNC_INFO << "Received unknown custom event:" << event->type(); + return; + } + + event->accept(); +} diff --git a/src/common/internalpeer.h b/src/common/internalpeer.h new file mode 100644 index 00000000..4c82ceb3 --- /dev/null +++ b/src/common/internalpeer.h @@ -0,0 +1,93 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef INTERNALPEER_H +#define INTERNALPEER_H + +#include + +#include "protocol.h" +#include "signalproxy.h" + +class QEvent; + +class InternalPeer : public SignalProxy::AbstractPeer +{ + Q_OBJECT + +public: + enum EventType { + SyncMessageEvent = QEvent::User, + RpcCallEvent, + InitRequestEvent, + InitDataEvent + }; + + InternalPeer(QObject *parent = 0); + virtual ~InternalPeer(); + + QString description() const; + + SignalProxy *signalProxy() const; + void setSignalProxy(SignalProxy *proxy); + + InternalPeer *peer() const; + void setPeer(InternalPeer *peer); + + bool isOpen() const; + bool isSecure() const; + bool isLocal() const; + + int lag() const; + + void dispatch(const Protocol::SyncMessage &msg); + void dispatch(const Protocol::RpcCall &msg); + void dispatch(const Protocol::InitRequest &msg); + void dispatch(const Protocol::InitData &msg); + +public slots: + void close(const QString &reason = QString()); + +signals: + + void disconnected(); + void error(QAbstractSocket::SocketError); + +protected: + void customEvent(QEvent *event); + +private slots: + void peerDisconnected(); + +private: + template + void dispatch(EventType eventType, const T &msg); + + template + void handle(const T &msg); + +private: + SignalProxy *_proxy; + InternalPeer *_peer; + bool _isOpen; +}; + + +#endif diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 4acc23a7..3fc34610 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ircchannel.h b/src/common/ircchannel.h index f2a716fd..c0ee0705 100644 --- a/src/common/ircchannel.h +++ b/src/common/ircchannel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ircevent.cpp b/src/common/ircevent.cpp index 26b8b6a8..c002a97a 100644 --- a/src/common/ircevent.cpp +++ b/src/common/ircevent.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ircevent.h b/src/common/ircevent.h index b9501365..a9d7880c 100644 --- a/src/common/ircevent.h +++ b/src/common/ircevent.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/irclisthelper.cpp b/src/common/irclisthelper.cpp index 42b0c3f4..ed0e4314 100644 --- a/src/common/irclisthelper.cpp +++ b/src/common/irclisthelper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/irclisthelper.h b/src/common/irclisthelper.h index 18c71a69..87def608 100644 --- a/src/common/irclisthelper.h +++ b/src/common/irclisthelper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 4d5f5726..b9f359e1 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/ircuser.h b/src/common/ircuser.h index daa59e51..3ff272dd 100644 --- a/src/common/ircuser.h +++ b/src/common/ircuser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/logbacktrace_unix.cpp b/src/common/logbacktrace_unix.cpp index eae97dc1..11e2550e 100644 --- a/src/common/logbacktrace_unix.cpp +++ b/src/common/logbacktrace_unix.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/logbacktrace_win.cpp b/src/common/logbacktrace_win.cpp index 7b795882..7d552c94 100644 --- a/src/common/logbacktrace_win.cpp +++ b/src/common/logbacktrace_win.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/logger.cpp b/src/common/logger.cpp index 97783fb6..8e35dcaf 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/logger.h b/src/common/logger.h index 9a561307..ea5b01be 100644 --- a/src/common/logger.h +++ b/src/common/logger.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/mac_utils.cpp b/src/common/mac_utils.cpp index 2ceb7051..49d9a2dd 100644 --- a/src/common/mac_utils.cpp +++ b/src/common/mac_utils.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/mac_utils.h b/src/common/mac_utils.h index 09394da1..90e5f580 100644 --- a/src/common/mac_utils.h +++ b/src/common/mac_utils.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/main.cpp b/src/common/main.cpp index eafb1597..c0ffabff 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/message.cpp b/src/common/message.cpp index b0759141..f4016f5b 100644 --- a/src/common/message.cpp +++ b/src/common/message.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/message.h b/src/common/message.h index 5be33fb6..5125c664 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/messageevent.cpp b/src/common/messageevent.cpp index b9db573f..0efb85cb 100644 --- a/src/common/messageevent.cpp +++ b/src/common/messageevent.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/messageevent.h b/src/common/messageevent.h index b9bcdc52..b18225b7 100644 --- a/src/common/messageevent.h +++ b/src/common/messageevent.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/network.cpp b/src/common/network.cpp index 4ce07fea..170069a8 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/network.h b/src/common/network.h index b83c6998..5b24fbf3 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/networkconfig.cpp b/src/common/networkconfig.cpp index 4c60d3a6..066988f8 100644 --- a/src/common/networkconfig.cpp +++ b/src/common/networkconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -29,7 +29,8 @@ NetworkConfig::NetworkConfig(const QString &objectName, QObject *parent) _autoWhoEnabled(true), _autoWhoInterval(90), _autoWhoNickLimit(200), - _autoWhoDelay(5) + _autoWhoDelay(5), + _standardCtcp(false) { } @@ -107,3 +108,14 @@ void NetworkConfig::setAutoWhoDelay(int delay) SYNC(ARG(delay)) emit autoWhoDelaySet(delay); } + + +void NetworkConfig::setStandardCtcp(bool enabled) +{ + if (_standardCtcp == enabled) + return; + + _standardCtcp = enabled; + SYNC(ARG(enabled)) + emit standardCtcpSet(enabled); +} diff --git a/src/common/networkconfig.h b/src/common/networkconfig.h index 4c6adba9..ae121aa5 100644 --- a/src/common/networkconfig.h +++ b/src/common/networkconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -35,6 +35,7 @@ class NetworkConfig : public SyncableObject Q_PROPERTY(int autoWhoInterval READ autoWhoInterval WRITE setAutoWhoInterval) Q_PROPERTY(int autoWhoNickLimit READ autoWhoNickLimit WRITE setAutoWhoNickLimit) Q_PROPERTY(int autoWhoDelay READ autoWhoDelay WRITE setAutoWhoDelay) + Q_PROPERTY(bool standardCtcp READ standardCtcp WRITE setStandardCtcp) public : NetworkConfig(const QString &objectName = "GlobalNetworkConfig", QObject *parent = 0); @@ -70,6 +71,10 @@ public slots: void setAutoWhoDelay(int); virtual inline void requestSetAutoWhoDelay(int i) { REQUEST(ARG(i)) } + inline bool standardCtcp() const { return _standardCtcp; } + void setStandardCtcp(bool); + virtual inline void requestSetStandardCtcp(bool b) { REQUEST(ARG(b)) } + signals: void pingTimeoutEnabledSet(bool); void pingIntervalSet(int); @@ -78,6 +83,7 @@ signals: void autoWhoIntervalSet(int); // void autoWhoNickLimitSet(int); void autoWhoDelaySet(int); + void standardCtcpSet(bool); // void setPingTimeoutEnabledRequested(bool); // void setPingIntervalRequested(int); @@ -96,6 +102,8 @@ private: int _autoWhoInterval; int _autoWhoNickLimit; int _autoWhoDelay; + + bool _standardCtcp; }; diff --git a/src/common/networkevent.cpp b/src/common/networkevent.cpp index 80b15321..ec8947b0 100644 --- a/src/common/networkevent.cpp +++ b/src/common/networkevent.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/networkevent.h b/src/common/networkevent.h index b55a9251..3bad605a 100644 --- a/src/common/networkevent.h +++ b/src/common/networkevent.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/protocol.h b/src/common/protocol.h new file mode 100644 index 00000000..af98b8b7 --- /dev/null +++ b/src/common/protocol.h @@ -0,0 +1,128 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef PROTOCOL_H_ +#define PROTOCOL_H_ + +#include +#include +#include + +namespace Protocol { + +/*** handled by SignalProxy ***/ + +class SyncMessage +{ +public: + inline SyncMessage(const QByteArray &className, const QString &objectName, const QByteArray &slotName, const QVariantList ¶ms) + : _className(className), _objectName(objectName), _slotName(slotName), _params(params) {} + + inline QByteArray className() const { return _className; } + inline QString objectName() const { return _objectName; } + inline QByteArray slotName() const { return _slotName; } + + inline QVariantList params() const { return _params; } + +private: + QByteArray _className; + QString _objectName; + QByteArray _slotName; + QVariantList _params; +}; + + +class RpcCall +{ +public: + inline RpcCall(const QByteArray &slotName, const QVariantList ¶ms) + : _slotName(slotName), _params(params) {} + + inline QByteArray slotName() const { return _slotName; } + inline QVariantList params() const { return _params; } + +private: + QByteArray _slotName; + QVariantList _params; +}; + + +class InitRequest +{ +public: + inline InitRequest(const QByteArray &className, const QString &objectName) + : _className(className), _objectName(objectName) {} + + inline QByteArray className() const { return _className; } + inline QString objectName() const { return _objectName; } + +private: + QByteArray _className; + QString _objectName; +}; + + +class InitData +{ +public: + inline InitData(const QByteArray &className, const QString &objectName, const QVariantMap &initData) + : _className(className), _objectName(objectName), _initData(initData) {} + + inline QByteArray className() const { return _className; } + inline QString objectName() const { return _objectName; } + + inline QVariantMap initData() const { return _initData; } + +private: + QByteArray _className; + QString _objectName; + QVariantMap _initData; +}; + + +/*** handled by RemoteConnection ***/ + +class HeartBeat +{ +public: + inline HeartBeat(const QDateTime ×tamp) : _timestamp(timestamp) {} + + inline QDateTime timestamp() const { return _timestamp; } + +private: + QDateTime _timestamp; +}; + + +class HeartBeatReply +{ +public: + inline HeartBeatReply(const QDateTime ×tamp) : _timestamp(timestamp) {} + + inline QDateTime timestamp() const { return _timestamp; } + +private: + QDateTime _timestamp; +}; + + +}; + +#endif diff --git a/src/common/protocols/legacy/legacypeer.cpp b/src/common/protocols/legacy/legacypeer.cpp new file mode 100644 index 00000000..709291f5 --- /dev/null +++ b/src/common/protocols/legacy/legacypeer.cpp @@ -0,0 +1,270 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "legacypeer.h" + +using namespace Protocol; + +LegacyPeer::LegacyPeer(QTcpSocket *socket, QObject *parent) + : RemotePeer(socket, parent), + _blockSize(0), + _useCompression(false) +{ + _stream.setDevice(socket); + _stream.setVersion(QDataStream::Qt_4_2); + + connect(socket, SIGNAL(readyRead()), SLOT(socketDataAvailable())); +} + + +void LegacyPeer::setSignalProxy(::SignalProxy *proxy) +{ + RemotePeer::setSignalProxy(proxy); + + if (proxy) { + // enable compression now if requested - the initial handshake is uncompressed in the legacy protocol! + _useCompression = socket()->property("UseCompression").toBool(); + } + +} + + +void LegacyPeer::socketDataAvailable() +{ + QVariant item; + while (readSocketData(item)) { + // if no sigproxy is set, we're in handshake mode and let the data be handled elsewhere + if (!signalProxy()) + emit dataReceived(item); + else + handlePackedFunc(item); + } +} + + +bool LegacyPeer::readSocketData(QVariant &item) +{ + if (_blockSize == 0) { + if (socket()->bytesAvailable() < 4) + return false; + _stream >> _blockSize; + } + + if (_blockSize > 1 << 22) { + close("Peer tried to send package larger than max package size!"); + return false; + } + + if (_blockSize == 0) { + close("Peer tried to send 0 byte package!"); + return false; + } + + if (socket()->bytesAvailable() < _blockSize) { + emit transferProgress(socket()->bytesAvailable(), _blockSize); + return false; + } + + emit transferProgress(_blockSize, _blockSize); + + _blockSize = 0; + + if (_useCompression) { + QByteArray rawItem; + _stream >> rawItem; + + int nbytes = rawItem.size(); + if (nbytes <= 4) { + const char *data = rawItem.constData(); + if (nbytes < 4 || (data[0] != 0 || data[1] != 0 || data[2] != 0 || data[3] != 0)) { + close("Peer sent corrupted compressed data!"); + return false; + } + } + + rawItem = qUncompress(rawItem); + + QDataStream itemStream(&rawItem, QIODevice::ReadOnly); + itemStream.setVersion(QDataStream::Qt_4_2); + itemStream >> item; + } + else { + _stream >> item; + } + + if (!item.isValid()) { + close("Peer sent corrupt data: unable to load QVariant!"); + return false; + } + + return true; +} + + +void LegacyPeer::writeSocketData(const QVariant &item) +{ + if (!socket()->isOpen()) { + qWarning() << Q_FUNC_INFO << "Can't write to a closed socket!"; + return; + } + + QByteArray block; + QDataStream out(&block, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_4_2); + + if (_useCompression) { + QByteArray rawItem; + QDataStream itemStream(&rawItem, QIODevice::WriteOnly); + itemStream.setVersion(QDataStream::Qt_4_2); + itemStream << item; + + rawItem = qCompress(rawItem); + + out << rawItem; + } + else { + out << item; + } + + _stream << block; // also writes the length as part of the serialization format +} + + +void LegacyPeer::handlePackedFunc(const QVariant &packedFunc) +{ + QVariantList params(packedFunc.toList()); + + if (params.isEmpty()) { + qWarning() << Q_FUNC_INFO << "Received incompatible data:" << packedFunc; + return; + } + + RequestType requestType = (RequestType)params.takeFirst().value(); + switch (requestType) { + case Sync: { + if (params.count() < 3) { + qWarning() << Q_FUNC_INFO << "Received invalid sync call:" << params; + return; + } + QByteArray className = params.takeFirst().toByteArray(); + QString objectName = params.takeFirst().toString(); + QByteArray slotName = params.takeFirst().toByteArray(); + handle(Protocol::SyncMessage(className, objectName, slotName, params)); + break; + } + case RpcCall: { + if (params.empty()) { + qWarning() << Q_FUNC_INFO << "Received empty RPC call!"; + return; + } + QByteArray slotName = params.takeFirst().toByteArray(); + handle(Protocol::RpcCall(slotName, params)); + break; + } + case InitRequest: { + if (params.count() != 2) { + qWarning() << Q_FUNC_INFO << "Received invalid InitRequest:" << params; + return; + } + QByteArray className = params[0].toByteArray(); + QString objectName = params[1].toString(); + handle(Protocol::InitRequest(className, objectName)); + break; + } + case InitData: { + if (params.count() != 3) { + qWarning() << Q_FUNC_INFO << "Received invalid InitData:" << params; + return; + } + QByteArray className = params[0].toByteArray(); + QString objectName = params[1].toString(); + QVariantMap initData = params[2].toMap(); + handle(Protocol::InitData(className, objectName, initData)); + break; + } + case HeartBeat: { + if (params.count() != 1) { + qWarning() << Q_FUNC_INFO << "Received invalid HeartBeat:" << params; + return; + } + // The legacy protocol would only send a QTime, no QDateTime + // so we assume it's sent today, which works in exactly the same cases as it did in the old implementation + QDateTime dateTime = QDateTime::currentDateTimeUtc(); + dateTime.setTime(params[0].toTime()); + handle(Protocol::HeartBeat(dateTime)); + break; + } + case HeartBeatReply: { + if (params.count() != 1) { + qWarning() << Q_FUNC_INFO << "Received invalid HeartBeat:" << params; + return; + } + // The legacy protocol would only send a QTime, no QDateTime + // so we assume it's sent today, which works in exactly the same cases as it did in the old implementation + QDateTime dateTime = QDateTime::currentDateTimeUtc(); + dateTime.setTime(params[0].toTime()); + handle(Protocol::HeartBeatReply(dateTime)); + break; + } + + } +} + + +void LegacyPeer::dispatch(const Protocol::SyncMessage &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)Sync << msg.className() << msg.objectName() << msg.slotName() << msg.params()); +} + + +void LegacyPeer::dispatch(const Protocol::RpcCall &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)RpcCall << msg.slotName() << msg.params()); +} + + +void LegacyPeer::dispatch(const Protocol::InitRequest &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)InitRequest << msg.className() << msg.objectName()); +} + + +void LegacyPeer::dispatch(const Protocol::InitData &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)InitData << msg.className() << msg.objectName() << msg.initData()); +} + + +void LegacyPeer::dispatch(const Protocol::HeartBeat &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)HeartBeat << msg.timestamp().time()); +} + + +void LegacyPeer::dispatch(const Protocol::HeartBeatReply &msg) +{ + dispatchPackedFunc(QVariantList() << (qint16)HeartBeatReply << msg.timestamp().time()); +} + + +void LegacyPeer::dispatchPackedFunc(const QVariantList &packedFunc) +{ + writeSocketData(QVariant(packedFunc)); +} diff --git a/src/common/protocols/legacy/legacypeer.h b/src/common/protocols/legacy/legacypeer.h new file mode 100644 index 00000000..a3aa178b --- /dev/null +++ b/src/common/protocols/legacy/legacypeer.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef LEGACYPEER_H +#define LEGACYPEER_H + +#include + +#include "../../remotepeer.h" + +class QDataStream; + +class LegacyPeer : public RemotePeer +{ + Q_OBJECT + +public: + enum RequestType { + Sync = 1, + RpcCall, + InitRequest, + InitData, + HeartBeat, + HeartBeatReply + }; + + LegacyPeer(QTcpSocket *socket, QObject *parent = 0); + ~LegacyPeer() {} + + void setSignalProxy(SignalProxy *proxy); + + void dispatch(const Protocol::SyncMessage &msg); + void dispatch(const Protocol::RpcCall &msg); + void dispatch(const Protocol::InitRequest &msg); + void dispatch(const Protocol::InitData &msg); + + void dispatch(const Protocol::HeartBeat &msg); + void dispatch(const Protocol::HeartBeatReply &msg); + + // FIXME: this is only used for the auth phase and should be replaced by something more generic + void writeSocketData(const QVariant &item); + +private slots: + void socketDataAvailable(); + +private: + bool readSocketData(QVariant &item); + void handlePackedFunc(const QVariant &packedFunc); + void dispatchPackedFunc(const QVariantList &packedFunc); + + QDataStream _stream; + qint32 _blockSize; + bool _useCompression; +}; + +#endif diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 89470d59..c60f5ec1 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -40,6 +40,7 @@ #include "bufferinfo.h" #include "types.h" #include "syncableobject.h" +#include "logger.h" Quassel::BuildInfo Quassel::_buildInfo; AbstractCliParser *Quassel::_cliParser = 0; @@ -494,10 +495,32 @@ void Quassel::loadTranslation(const QLocale &locale) quasselTranslator->setObjectName("QuasselTr"); qApp->installTranslator(quasselTranslator); - QLocale::setDefault(locale); +#if QT_VERSION >= 0x040800 + bool success = qtTranslator->load(locale, QString("qt_%1"), translationDirPath()); + if (!success) + qtTranslator->load(locale, QString("qt_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + quasselTranslator->load(locale, QString(""), translationDirPath()); +#else + QString localeName = locale.name(); + + // if the user did not specify a language in the settings, the system locale + // is used, but Qt < 4.8 does not respect language settings. This bit is + // based on QLocale::uiLanguages() as in Qt 4.8.3 + if (locale == QLocale::system()) { + // FIXME: does it make sense to set the locale to the system locale? + QLocale::setDefault(locale); + QVariant res = QSystemLocale().query(QSystemLocale::UILanguages, QVariant()); + if (!res.isNull()) { + QString newName = res.toStringList()[0]; + if (!newName.isEmpty()) { + localeName = newName.replace('-', "_"); // silly Qt. + } + } + } - bool success = qtTranslator->load(QString("qt_%1").arg(locale.name()), translationDirPath()); + bool success = qtTranslator->load(QString("qt_%1").arg(localeName), translationDirPath()); if (!success) - qtTranslator->load(QString("qt_%1").arg(locale.name()), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - quasselTranslator->load(QString("%1").arg(locale.name()), translationDirPath()); + qtTranslator->load(QString("qt_%1").arg(localeName), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + quasselTranslator->load(QString("%1").arg(localeName), translationDirPath()); +#endif } diff --git a/src/common/quassel.h b/src/common/quassel.h index e070bae1..6089ac03 100644 --- a/src/common/quassel.h +++ b/src/common/quassel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -71,8 +71,9 @@ public: enum Feature { SynchronizedMarkerLine = 0x0001, SaslAuthentication = 0x0002, + SaslExternal = 0x0004, - NumFeatures = 0x0002 + NumFeatures = 0x0004 }; Q_DECLARE_FLAGS(Features, Feature); diff --git a/src/common/remotepeer.cpp b/src/common/remotepeer.cpp new file mode 100644 index 00000000..e33f56a9 --- /dev/null +++ b/src/common/remotepeer.cpp @@ -0,0 +1,196 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include +#include + +#ifdef HAVE_SSL +# include +#endif + +#include "remotepeer.h" + +using namespace Protocol; + +RemotePeer::RemotePeer(QTcpSocket *socket, QObject *parent) + : SignalProxy::AbstractPeer(parent), + _socket(socket), + _signalProxy(0), + _heartBeatTimer(new QTimer(this)), + _heartBeatCount(0), + _lag(0) +{ + socket->setParent(this); + connect(socket, SIGNAL(disconnected()), SIGNAL(disconnected())); + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SIGNAL(error(QAbstractSocket::SocketError))); + +#ifdef HAVE_SSL + QSslSocket *sslSocket = qobject_cast(socket); + if (sslSocket) + connect(sslSocket, SIGNAL(encrypted()), SIGNAL(secureStateChanged())); +#endif + + connect(_heartBeatTimer, SIGNAL(timeout()), SLOT(sendHeartBeat())); +} + + +QString RemotePeer::description() const +{ + if (socket()) + return socket()->peerAddress().toString(); + + return QString(); +} + + +::SignalProxy *RemotePeer::signalProxy() const +{ + return _signalProxy; +} + + +void RemotePeer::setSignalProxy(::SignalProxy *proxy) +{ + if (proxy == _signalProxy) + return; + + if (!proxy) { + _heartBeatTimer->stop(); + disconnect(signalProxy(), 0, this, 0); + _signalProxy = 0; + if (isOpen()) + close(); + } + else { + if (signalProxy()) { + qWarning() << Q_FUNC_INFO << "Setting another SignalProxy not supported, ignoring!"; + return; + } + _signalProxy = proxy; + connect(proxy, SIGNAL(heartBeatIntervalChanged(int)), SLOT(changeHeartBeatInterval(int))); + _heartBeatTimer->setInterval(proxy->heartBeatInterval() * 1000); + _heartBeatTimer->start(); + } +} + + +void RemotePeer::changeHeartBeatInterval(int secs) +{ + if(secs <= 0) + _heartBeatTimer->stop(); + else { + _heartBeatTimer->setInterval(secs * 1000); + _heartBeatTimer->start(); + } +} + + +int RemotePeer::lag() const +{ + return _lag; +} + + +QTcpSocket *RemotePeer::socket() const +{ + return _socket; +} + + +bool RemotePeer::isSecure() const +{ + if (socket()) { + if (isLocal()) + return true; +#ifdef HAVE_SSL + QSslSocket *sslSocket = qobject_cast(socket()); + if (sslSocket && sslSocket->isEncrypted()) + return true; +#endif + } + return false; +} + + +bool RemotePeer::isLocal() const +{ + if (socket()) { + if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6) + return true; + } + return false; +} + + +bool RemotePeer::isOpen() const +{ + return socket() && socket()->state() == QTcpSocket::ConnectedState; +} + + +void RemotePeer::close(const QString &reason) +{ + if (!reason.isEmpty()) { + qWarning() << "Disconnecting:" << reason; + } + + if (socket() && socket()->state() != QTcpSocket::UnconnectedState) { + socket()->disconnectFromHost(); + } +} + + +void RemotePeer::handle(const HeartBeat &heartBeat) +{ + dispatch(HeartBeatReply(heartBeat.timestamp())); +} + + +void RemotePeer::handle(const HeartBeatReply &heartBeatReply) +{ + _heartBeatCount = 0; +#if QT_VERSION < 0x040700 + emit lagUpdated(heartBeatReply.timestamp().time().msecsTo(QTime::currentTime()) / 2); +#else + emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTime()) / 2); +#endif +} + + +void RemotePeer::sendHeartBeat() +{ + if (signalProxy()->maxHeartBeatCount() > 0 && _heartBeatCount >= signalProxy()->maxHeartBeatCount()) { + qWarning() << "Disconnecting peer:" << description() + << "(didn't receive a heartbeat for over" << _heartBeatCount *_heartBeatTimer->interval() / 1000 << "seconds)"; + socket()->close(); + _heartBeatTimer->stop(); + return; + } + + if (_heartBeatCount > 0) { + _lag = _heartBeatCount * _heartBeatTimer->interval(); + emit lagUpdated(_lag); + } + + dispatch(HeartBeat(QDateTime::currentDateTime())); + ++_heartBeatCount; +} + + diff --git a/src/common/remotepeer.h b/src/common/remotepeer.h new file mode 100644 index 00000000..e41a6a3b --- /dev/null +++ b/src/common/remotepeer.h @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (C) 2005-2013 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef REMOTEPEER_H +#define REMOTEPEER_H + +#include +#include + +#include "protocol.h" +#include "signalproxy.h" + +class QTimer; + +class RemotePeer : public SignalProxy::AbstractPeer +{ + Q_OBJECT + +public: + RemotePeer(QTcpSocket *socket, QObject *parent = 0); + virtual ~RemotePeer() {}; + + void setSignalProxy(SignalProxy *proxy); + + QString description() const; + + bool isOpen() const; + bool isSecure() const; + bool isLocal() const; + + int lag() const; + + bool compressionEnabled() const; + void setCompressionEnabled(bool enabled); + + QTcpSocket *socket() const; + + // this is only used for the auth phase and should be replaced by something more generic + virtual void writeSocketData(const QVariant &item) = 0; + +public slots: + void close(const QString &reason = QString()); + +signals: + // this is only used for the auth phase and should be replaced by something more generic + void dataReceived(const QVariant &item); + + void disconnected(); + void error(QAbstractSocket::SocketError); + + void transferProgress(int current, int max); + +protected: + SignalProxy *signalProxy() const; + + template + void handle(const T &protoMessage); + + // These protocol messages get handled internally and won't reach SignalProxy + void handle(const Protocol::HeartBeat &heartBeat); + void handle(const Protocol::HeartBeatReply &heartBeatReply); + virtual void dispatch(const Protocol::HeartBeat &msg) = 0; + virtual void dispatch(const Protocol::HeartBeatReply &msg) = 0; + +private slots: + void sendHeartBeat(); + void changeHeartBeatInterval(int secs); + +private: + QTcpSocket *_socket; + SignalProxy *_signalProxy; + QTimer *_heartBeatTimer; + int _heartBeatCount; + int _lag; +}; + +// Template methods we need in the header +template inline +void RemotePeer::handle(const T &protoMessage) +{ + if (!signalProxy()) { + qWarning() << Q_FUNC_INFO << "Cannot handle messages without a SignalProxy!"; + return; + } + + // _heartBeatCount = 0; + + signalProxy()->handle(this, protoMessage); +} + + +#endif diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 7656a580..334d1972 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/settings.h b/src/common/settings.h index b98a2c11..8df2d525 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index 98364082..f05a509f 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -40,27 +40,17 @@ #include #include +#include "protocol.h" #include "syncableobject.h" #include "util.h" -// ================================================== -// PeerSignalEvent -// ================================================== -class PeerSignalEvent : public QEvent -{ -public: - PeerSignalEvent(SignalProxy *sender, SignalProxy::RequestType requestType, const QVariantList ¶ms) : QEvent(QEvent::Type(SignalProxy::PeerSignal)), sender(sender), requestType(requestType), params(params) {} - SignalProxy *sender; - SignalProxy::RequestType requestType; - QVariantList params; -}; - +using namespace Protocol; class RemovePeerEvent : public QEvent { public: - RemovePeerEvent(QObject *peer) : QEvent(QEvent::Type(SignalProxy::RemovePeer)), peer(peer) {} - QObject *peer; + RemovePeerEvent(SignalProxy::AbstractPeer *peer) : QEvent(QEvent::Type(SignalProxy::RemovePeerEvent)), peer(peer) {} + SignalProxy::AbstractPeer *peer; }; @@ -155,7 +145,6 @@ int SignalProxy::SignalRelay::qt_metacall(QMetaObject::Call _c, int _id, void ** const Signal &signal = _slots[_id]; QVariantList params; - params << signal.signature; const QList &argTypes = eMeta->argTypes(signal.signalId); for (int i = 0; i < argTypes.size(); i++) { @@ -167,7 +156,7 @@ int SignalProxy::SignalRelay::qt_metacall(QMetaObject::Call _c, int _id, void ** params << QVariant(argTypes[i], _a[i+1]); } - proxy()->dispatchSignal(SignalProxy::RpcCall, params); + proxy()->dispatch(RpcCall(signal.signature, params)); } _id -= _slots.count(); } @@ -175,59 +164,6 @@ int SignalProxy::SignalRelay::qt_metacall(QMetaObject::Call _c, int _id, void ** } -// ================================================== -// Peers -// ================================================== -void SignalProxy::IODevicePeer::dispatchSignal(const RequestType &requestType, const QVariantList ¶ms) -{ - QVariantList packedFunc; - packedFunc << (qint16)requestType - << params; - dispatchPackedFunc(QVariant(packedFunc)); -} - - -bool SignalProxy::IODevicePeer::isSecure() const -{ -#ifdef HAVE_SSL - QSslSocket *sslSocket = qobject_cast(_device); - if (sslSocket) - return sslSocket->isEncrypted() || sslSocket->localAddress() == QHostAddress::LocalHost || sslSocket->localAddress() == QHostAddress::LocalHostIPv6; -#endif - - QAbstractSocket *socket = qobject_cast(_device); - if (socket) - return socket->localAddress() == QHostAddress::LocalHost || socket->localAddress() == QHostAddress::LocalHostIPv6; - - return false; -} - - -QString SignalProxy::IODevicePeer::address() const -{ - QAbstractSocket *socket = qobject_cast(_device); - if (socket) - return socket->peerAddress().toString(); - else - return QString(); -} - - -void SignalProxy::SignalProxyPeer::dispatchSignal(const RequestType &requestType, const QVariantList ¶ms) -{ - Qt::ConnectionType type = QThread::currentThread() == receiver->thread() - ? Qt::DirectConnection - : Qt::QueuedConnection; - - if (type == Qt::DirectConnection) { - receiver->receivePeerSignal(sender, requestType, params); - } - else { - QCoreApplication::postEvent(receiver, new PeerSignalEvent(sender, requestType, params)); - } -} - - // ================================================== // SignalProxy // ================================================== @@ -247,15 +183,6 @@ SignalProxy::SignalProxy(ProxyMode mode, QObject *parent) } -SignalProxy::SignalProxy(ProxyMode mode, QIODevice *device, QObject *parent) - : QObject(parent) -{ - setProxyMode(mode); - addPeer(device); - init(); -} - - SignalProxy::~SignalProxy() { QHash::iterator classIter = _syncSlave.begin(); @@ -276,20 +203,9 @@ SignalProxy::~SignalProxy() void SignalProxy::setProxyMode(ProxyMode mode) { - PeerHash::iterator peer = _peers.begin(); - while (peer != _peers.end()) { - if ((*peer)->type() != AbstractPeer::IODevicePeer) { - IODevicePeer *ioPeer = static_cast(*peer); - if (ioPeer->isOpen()) { - qWarning() << "SignalProxy: Cannot change proxy mode while connected"; - return; - } - } - if ((*peer)->type() != AbstractPeer::SignalProxyPeer) { - qWarning() << "SignalProxy: Cannot change proxy mode while connected to another internal SignalProxy"; - return; - } - peer++; + if (_peers.count()) { + qWarning() << Q_FUNC_INFO << "Cannot change proxy mode while connected"; + return; } _proxyMode = mode; @@ -305,10 +221,8 @@ void SignalProxy::init() _heartBeatInterval = 0; _maxHeartBeatCount = 0; _signalRelay = new SignalRelay(this); - connect(&_heartBeatTimer, SIGNAL(timeout()), this, SLOT(sendHeartBeat())); setHeartBeatInterval(30); setMaxHeartBeatCount(2); - _heartBeatTimer.start(); _secure = false; updateSecureState(); } @@ -321,87 +235,58 @@ void SignalProxy::initServer() void SignalProxy::initClient() { - attachSlot("__objectRenamed__", this, SLOT(objectRenamed(QByteArray, QString, QString))); -} - - -bool SignalProxy::addPeer(QIODevice *iodev) -{ - if (!iodev) - return false; - - if (_peers.contains(iodev)) - return true; - - if (proxyMode() == Client && !_peers.isEmpty()) { - qWarning("SignalProxy: only one peer allowed in client mode!"); - return false; - } - - if (!iodev->isOpen()) { - qWarning("SignalProxy::addPeer(QIODevice *iodev): iodev needs to be open!"); - return false; - } - - connect(iodev, SIGNAL(disconnected()), this, SLOT(removePeerBySender())); - connect(iodev, SIGNAL(readyRead()), this, SLOT(dataAvailable())); - -#ifdef HAVE_SSL - QSslSocket *sslSocket = qobject_cast(iodev); - if (sslSocket) { - connect(iodev, SIGNAL(encrypted()), this, SLOT(updateSecureState())); - } -#endif - - if (!iodev->parent()) - iodev->setParent(this); - - _peers[iodev] = new IODevicePeer(iodev, iodev->property("UseCompression").toBool()); - - if (_peers.count() == 1) - emit connected(); - - updateSecureState(); - return true; + attachSlot("__objectRenamed__", this, SLOT(objectRenamed(QByteArray,QString,QString))); } void SignalProxy::setHeartBeatInterval(int secs) { - if (secs != _heartBeatInterval) { + if (_heartBeatInterval != secs) { _heartBeatInterval = secs; - _heartBeatTimer.setInterval(secs * 1000); + emit heartBeatIntervalChanged(secs); } } void SignalProxy::setMaxHeartBeatCount(int max) { - _maxHeartBeatCount = max; + if (_maxHeartBeatCount != max) { + _maxHeartBeatCount = max; + emit maxHeartBeatCountChanged(max); + } } -bool SignalProxy::addPeer(SignalProxy *proxy) +bool SignalProxy::addPeer(AbstractPeer *peer) { - if (!proxy) + if (!peer) return false; - if (proxyMode() == proxy->proxyMode()) { - qWarning() << "SignalProxy::addPeer(): adding a SignalProxy as peer requires one proxy to be server and one client!"; + if (_peers.contains(peer)) + return true; + + if (!peer->isOpen()) { + qWarning("SignalProxy: peer needs to be open!"); return false; } - if (_peers.contains(proxy)) { - return true; + if (proxyMode() == Client) { + if (!_peers.isEmpty()) { + qWarning("SignalProxy: only one peer allowed in client mode!"); + return false; + } + connect(peer, SIGNAL(lagUpdated(int)), SIGNAL(lagUpdated(int))); } - if (proxyMode() == Client && !_peers.isEmpty()) { - qWarning("SignalProxy: only one peer allowed in client mode!"); - return false; - } + connect(peer, SIGNAL(disconnected()), SLOT(removePeerBySender())); + connect(peer, SIGNAL(secureStateChanged(bool)), SLOT(updateSecureState())); + + if (!peer->parent()) + peer->setParent(this); - _peers[proxy] = new SignalProxyPeer(this, proxy); - proxy->addPeer(this); + _peers.insert(peer); + + peer->setSignalProxy(this); if (_peers.count() == 1) emit connected(); @@ -415,43 +300,38 @@ void SignalProxy::removeAllPeers() { Q_ASSERT(proxyMode() == Server || _peers.count() <= 1); // wee need to copy that list since we modify it in the loop - QList peers = _peers.keys(); - foreach(QObject *peer, peers) { + QSet peers = _peers; + foreach(AbstractPeer *peer, peers) { removePeer(peer); } } -void SignalProxy::removePeer(QObject *dev) +void SignalProxy::removePeer(AbstractPeer *peer) { + if (!peer) { + qWarning() << Q_FUNC_INFO << "Trying to remove a null peer!"; + return; + } + if (_peers.isEmpty()) { qWarning() << "SignalProxy::removePeer(): No peers in use!"; return; } - Q_ASSERT(dev); - if (!_peers.contains(dev)) { - qWarning() << "SignalProxy: unknown Peer" << dev; + if (!_peers.contains(peer)) { + qWarning() << "SignalProxy: unknown Peer" << peer; return; } - AbstractPeer *peer = _peers[dev]; - _peers.remove(dev); - - disconnect(dev, 0, this, 0); - if (peer->type() == AbstractPeer::IODevicePeer) - emit peerRemoved(static_cast(dev)); - - if (peer->type() == AbstractPeer::SignalProxyPeer) { - SignalProxy *proxy = static_cast(dev); - if (proxy->_peers.contains(this)) - proxy->removePeer(this); - } + disconnect(peer, 0, this, 0); + peer->setSignalProxy(0); - if (dev->parent() == this) - dev->deleteLater(); + _peers.remove(peer); + emit peerRemoved(peer); - delete peer; + if (peer->parent() == this) + peer->deleteLater(); updateSecureState(); @@ -462,7 +342,7 @@ void SignalProxy::removePeer(QObject *dev) void SignalProxy::removePeerBySender() { - removePeer(sender()); + removePeer(qobject_cast(sender())); } @@ -475,9 +355,7 @@ void SignalProxy::renameObject(const SyncableObject *obj, const QString &newname const QByteArray className(meta->className()); objectRenamed(className, newname, oldname); - QVariantList params; - params << "__objectRenamed__" << className << newname << oldname; - dispatchSignal(RpcCall, params); + dispatch(RpcCall("__objectRenamed__", QVariantList() << className << newname << oldname)); } @@ -621,139 +499,42 @@ void SignalProxy::stopSynchronize(SyncableObject *obj) } -void SignalProxy::dispatchSignal(const RequestType &requestType, const QVariantList ¶ms) +template +void SignalProxy::dispatch(const T &protoMessage) { - QVariant packedFunc(QVariantList() << (qint16)requestType << params); - PeerHash::iterator peer = _peers.begin(); - while (peer != _peers.end()) { - switch ((*peer)->type()) { - case AbstractPeer::IODevicePeer: - { - IODevicePeer *ioPeer = static_cast(*peer); - if (ioPeer->isOpen()) - ioPeer->dispatchPackedFunc(packedFunc); - else - QCoreApplication::postEvent(this, new RemovePeerEvent(peer.key())); - } - break; - case AbstractPeer::SignalProxyPeer: - (*peer)->dispatchSignal(requestType, params); - break; - default: - Q_ASSERT(false); // there shouldn't be any peers with wrong / unknown type - } - peer++; - } -} - - -void SignalProxy::receivePackedFunc(AbstractPeer *sender, const QVariant &packedFunc) -{ - QVariantList params(packedFunc.toList()); - - if (params.isEmpty()) { - qWarning() << "SignalProxy::receivePeerSignal(): received incompatible Data:" << packedFunc; - return; - } - - RequestType requestType = (RequestType)params.takeFirst().value(); - receivePeerSignal(sender, requestType, params); -} - - -void SignalProxy::receivePeerSignal(AbstractPeer *sender, const RequestType &requestType, const QVariantList ¶ms) -{ - switch (requestType) { - // list all RequestTypes that shouldnot trigger a heartbeat counter reset here - case HeartBeatReply: - break; - default: - if (sender->type() == AbstractPeer::IODevicePeer) { - IODevicePeer *ioPeer = static_cast(sender); - ioPeer->sentHeartBeats = 0; - } - } - - // qDebug() << "SignalProxy::receivePeerSignal)" << requestType << params; - switch (requestType) { - case RpcCall: - if (params.empty()) - qWarning() << "SignalProxy::receivePeerSignal(): received empty RPC-Call"; + foreach (AbstractPeer *peer, _peers) { + if (peer->isOpen()) + peer->dispatch(protoMessage); else - handleSignal(params); - //handleSignal(params.takeFirst().toByteArray(), params); - break; - - case Sync: - handleSync(sender, params); - break; - - case InitRequest: - handleInitRequest(sender, params); - break; - - case InitData: - handleInitData(sender, params); - break; - - case HeartBeat: - receiveHeartBeat(sender, params); - break; - - case HeartBeatReply: - receiveHeartBeatReply(sender, params); - break; - - default: - qWarning() << "SignalProxy::receivePeerSignal(): received undefined CallType" << requestType << params; - } -} - - -void SignalProxy::receivePeerSignal(SignalProxy *sender, const RequestType &requestType, const QVariantList ¶ms) -{ - if (!_peers.contains(sender)) { - // we output only the pointer value. otherwise Qt would try to pretty print. As the object might already been destroyed, this is not a good idea. - qWarning() << "SignalProxy::receivePeerSignal(): received Signal from unknown Proxy" << reinterpret_cast(sender); - return; + QCoreApplication::postEvent(this, new ::RemovePeerEvent(peer)); } - receivePeerSignal(_peers[sender], requestType, params); } -void SignalProxy::handleSync(AbstractPeer *sender, QVariantList params) +void SignalProxy::handle(SignalProxy::AbstractPeer *peer, const SyncMessage &syncMessage) { - if (params.count() < 3) { - qWarning() << "received invalid Sync call" << params; - return; - } - - QByteArray className = params.takeFirst().toByteArray(); - QString objectName = params.takeFirst().toString(); - QByteArray slot = params.takeFirst().toByteArray(); - - if (!_syncSlave.contains(className) || !_syncSlave[className].contains(objectName)) { - qWarning() << QString("no registered receiver for sync call: %1::%2 (objectName=\"%3\"). Params are:").arg(QString(className)).arg(QString(slot)).arg(objectName) - << params; + if (!_syncSlave.contains(syncMessage.className()) || !_syncSlave[syncMessage.className()].contains(syncMessage.objectName())) { + qWarning() << QString("no registered receiver for sync call: %1::%2 (objectName=\"%3\"). Params are:").arg(syncMessage.className(), syncMessage.slotName(), syncMessage.objectName()) + << syncMessage.params(); return; } - SyncableObject *receiver = _syncSlave[className][objectName]; + SyncableObject *receiver = _syncSlave[syncMessage.className()][syncMessage.objectName()]; ExtendedMetaObject *eMeta = extendedMetaObject(receiver); - if (!eMeta->slotMap().contains(slot)) { - qWarning() << QString("no matching slot for sync call: %1::%2 (objectName=\"%3\"). Params are:").arg(QString(className)).arg(QString(slot)).arg(objectName) - << params; + if (!eMeta->slotMap().contains(syncMessage.slotName())) { + qWarning() << QString("no matching slot for sync call: %1::%2 (objectName=\"%3\"). Params are:").arg(syncMessage.className(), syncMessage.slotName(), syncMessage.objectName()) + << syncMessage.params(); return; } - int slotId = eMeta->slotMap()[slot]; + int slotId = eMeta->slotMap()[syncMessage.slotName()]; if (proxyMode() != eMeta->receiverMode(slotId)) { qWarning("SignalProxy::handleSync(): invokeMethod for \"%s\" failed. Wrong ProxyMode!", eMeta->methodName(slotId).constData()); return; } QVariant returnValue((QVariant::Type)eMeta->returnType(slotId)); - if (!invokeSlot(receiver, slotId, params, returnValue)) { + if (!invokeSlot(receiver, slotId, syncMessage.params(), returnValue)) { qWarning("SignalProxy::handleSync(): invokeMethod for \"%s\" failed ", eMeta->methodName(slotId).constData()); return; } @@ -761,14 +542,10 @@ void SignalProxy::handleSync(AbstractPeer *sender, QVariantList params) if (returnValue.type() != QVariant::Invalid && eMeta->receiveMap().contains(slotId)) { int receiverId = eMeta->receiveMap()[slotId]; QVariantList returnParams; - returnParams << className - << objectName - << eMeta->methodName(receiverId); - //QByteArray(receiver->metaObject()->method(receiverId).signature()); if (eMeta->argTypes(receiverId).count() > 1) - returnParams << params; + returnParams << syncMessage.params(); returnParams << returnValue; - sender->dispatchSignal(Sync, returnParams); + peer->dispatch(SyncMessage(syncMessage.className(), syncMessage.objectName(), eMeta->methodName(receiverId), returnParams)); } // send emit update signal @@ -776,87 +553,61 @@ void SignalProxy::handleSync(AbstractPeer *sender, QVariantList params) } -void SignalProxy::handleInitRequest(AbstractPeer *sender, const QVariantList ¶ms) +void SignalProxy::handle(SignalProxy::AbstractPeer *peer, const InitRequest &initRequest) { - if (params.count() != 2) { - qWarning() << "SignalProxy::handleInitRequest() received initRequest with invalid param Count:" - << params; - return; - } - - QByteArray className(params[0].toByteArray()); - QString objectName(params[1].toString()); - - if (!_syncSlave.contains(className)) { + if (!_syncSlave.contains(initRequest.className())) { qWarning() << "SignalProxy::handleInitRequest() received initRequest for unregistered Class:" - << className; + << initRequest.className(); return; } - if (!_syncSlave[className].contains(objectName)) { + if (!_syncSlave[initRequest.className()].contains(initRequest.objectName())) { qWarning() << "SignalProxy::handleInitRequest() received initRequest for unregistered Object:" - << className << objectName; + << initRequest.className() << initRequest.objectName(); return; } - SyncableObject *obj = _syncSlave[className][objectName]; - - QVariantList params_; - params_ << className - << objectName - << initData(obj); - - sender->dispatchSignal(InitData, params_); + SyncableObject *obj = _syncSlave[initRequest.className()][initRequest.objectName()]; + peer->dispatch(InitData(initRequest.className(), initRequest.objectName(), initData(obj))); } -void SignalProxy::handleInitData(AbstractPeer *sender, const QVariantList ¶ms) +void SignalProxy::handle(SignalProxy::AbstractPeer *peer, const InitData &initData) { - Q_UNUSED(sender) - if (params.count() != 3) { - qWarning() << "SignalProxy::handleInitData() received initData with invalid param Count:" - << params; - return; - } - - QByteArray className(params[0].toByteArray()); - QString objectName(params[1].toString()); - QVariantMap propertyMap(params[2].toMap()); + Q_UNUSED(peer) - if (!_syncSlave.contains(className)) { + if (!_syncSlave.contains(initData.className())) { qWarning() << "SignalProxy::handleInitData() received initData for unregistered Class:" - << className; + << initData.className(); return; } - if (!_syncSlave[className].contains(objectName)) { + if (!_syncSlave[initData.className()].contains(initData.objectName())) { qWarning() << "SignalProxy::handleInitData() received initData for unregistered Object:" - << className << objectName; + << initData.className() << initData.objectName(); return; } - SyncableObject *obj = _syncSlave[className][objectName]; - setInitData(obj, propertyMap); + SyncableObject *obj = _syncSlave[initData.className()][initData.objectName()]; + setInitData(obj, initData.initData()); } -//void SignalProxy::handleSignal(const QByteArray &funcName, const QVariantList ¶ms) { -void SignalProxy::handleSignal(const QVariantList &data) +void SignalProxy::handle(SignalProxy::AbstractPeer *peer, const RpcCall &rpcCall) { - QVariantList params = data; - QByteArray funcName = params.takeFirst().toByteArray(); + Q_UNUSED(peer) QObject *receiver; int methodId; - SlotHash::const_iterator slot = _attachedSlots.constFind(funcName); - while (slot != _attachedSlots.constEnd() && slot.key() == funcName) { + SlotHash::const_iterator slot = _attachedSlots.constFind(rpcCall.slotName()); + while (slot != _attachedSlots.constEnd() && slot.key() == rpcCall.slotName()) { receiver = (*slot).first; methodId = (*slot).second; - if (!invokeSlot(receiver, methodId, params)) { + if (!invokeSlot(receiver, methodId, rpcCall.params())) { ExtendedMetaObject *eMeta = extendedMetaObject(receiver); qWarning("SignalProxy::handleSignal(): invokeMethod for \"%s\" failed ", eMeta->methodName(methodId).constData()); } - slot++; + ++slot; } } @@ -917,122 +668,12 @@ bool SignalProxy::invokeSlot(QObject *receiver, int methodId, const QVariantList } -void SignalProxy::dataAvailable() -{ - // yet again. it's a private slot. no need for checks. - QIODevice *ioDev = qobject_cast(sender()); - Q_ASSERT(_peers.contains(ioDev) && _peers[ioDev]->type() == AbstractPeer::IODevicePeer); - IODevicePeer *peer = static_cast(_peers[ioDev]); - QVariant var; - while (peer->readData(var)) - receivePackedFunc(peer, var); -} - - -void SignalProxy::writeDataToDevice(QIODevice *dev, const QVariant &item, bool compressed) -{ - QAbstractSocket *sock = qobject_cast(dev); - if (!dev->isOpen() || (sock && sock->state() != QAbstractSocket::ConnectedState)) { - qWarning("SignalProxy: Can't call write on a closed device"); - return; - } - - QByteArray block; - QDataStream out(&block, QIODevice::WriteOnly); - out.setVersion(QDataStream::Qt_4_2); - out << (quint32)0; - - if (compressed) { - QByteArray rawItem; - QDataStream itemStream(&rawItem, QIODevice::WriteOnly); - - itemStream.setVersion(QDataStream::Qt_4_2); - itemStream << item; - - rawItem = qCompress(rawItem); - - out << rawItem; - } - else { - out << item; - } - - out.device()->seek(0); - out << (quint32)(block.size() - sizeof(quint32)); - - dev->write(block); -} - - -bool SignalProxy::readDataFromDevice(QIODevice *dev, quint32 &blockSize, QVariant &item, bool compressed) -{ - if (!dev) - return false; - - QDataStream in(dev); - in.setVersion(QDataStream::Qt_4_2); - - if (blockSize == 0) { - if (dev->bytesAvailable() < (int)sizeof(quint32)) return false; - in >> blockSize; - } - - if (blockSize > 1 << 22) { - disconnectDevice(dev, tr("Peer tried to send package larger than max package size!")); - return false; - } - - if (blockSize == 0) { - disconnectDevice(dev, tr("Peer tried to send 0 byte package!")); - return false; - } - - if (dev->bytesAvailable() < blockSize) - return false; - - blockSize = 0; - - if (compressed) { - QByteArray rawItem; - in >> rawItem; - - int nbytes = rawItem.size(); - if (nbytes <= 4) { - const char *data = rawItem.constData(); - if (nbytes < 4 || (data[0] != 0 || data[1] != 0 || data[2] != 0 || data[3] != 0)) { - disconnectDevice(dev, tr("Peer sent corrupted compressed data!")); - return false; - } - } - - rawItem = qUncompress(rawItem); - - QDataStream itemStream(&rawItem, QIODevice::ReadOnly); - itemStream.setVersion(QDataStream::Qt_4_2); - itemStream >> item; - } - else { - in >> item; - } - - if (!item.isValid()) { - disconnectDevice(dev, tr("Peer sent corrupt data: unable to load QVariant!")); - return false; - } - - return true; -} - - void SignalProxy::requestInit(SyncableObject *obj) { if (proxyMode() == Server || obj->isInitialized()) return; - QVariantList params; - params << obj->syncMetaObject()->className() - << obj->objectName(); - dispatchSignal(InitRequest, params); + dispatch(InitRequest(obj->syncMetaObject()->className(), obj->objectName())); } @@ -1053,79 +694,18 @@ void SignalProxy::setInitData(SyncableObject *obj, const QVariantMap &properties } -void SignalProxy::sendHeartBeat() -{ - QVariantList heartBeatParams; - heartBeatParams << QTime::currentTime(); - QList toClose; - - PeerHash::iterator peer = _peers.begin(); - while (peer != _peers.end()) { - if ((*peer)->type() == AbstractPeer::IODevicePeer) { - IODevicePeer *ioPeer = static_cast(*peer); - ioPeer->dispatchSignal(SignalProxy::HeartBeat, heartBeatParams); - if (ioPeer->sentHeartBeats > 0) { - updateLag(ioPeer, ioPeer->sentHeartBeats * _heartBeatTimer.interval()); - } - if (maxHeartBeatCount() >= 0 && ioPeer->sentHeartBeats >= maxHeartBeatCount()) - toClose.append(ioPeer); - else - ioPeer->sentHeartBeats++; - } - ++peer; - } - - foreach(IODevicePeer *ioPeer, toClose) { - qWarning() << "SignalProxy: Disconnecting peer:" << ioPeer->address() - << "(didn't receive a heartbeat for over" << ioPeer->sentHeartBeats *_heartBeatTimer.interval() / 1000 << "seconds)"; - ioPeer->close(); - } -} - - -void SignalProxy::receiveHeartBeat(AbstractPeer *peer, const QVariantList ¶ms) -{ - peer->dispatchSignal(SignalProxy::HeartBeatReply, params); -} - - -void SignalProxy::receiveHeartBeatReply(AbstractPeer *peer, const QVariantList ¶ms) -{ - if (peer->type() != AbstractPeer::IODevicePeer) { - qWarning() << "SignalProxy::receiveHeartBeatReply: received heart beat from a non IODevicePeer!"; - return; - } - - IODevicePeer *ioPeer = static_cast(peer); - ioPeer->sentHeartBeats = 0; - - if (params.isEmpty()) { - qWarning() << "SignalProxy: received heart beat reply with less params then sent from:" << ioPeer->address(); - return; - } - - QTime sendTime = params[0].value(); - updateLag(ioPeer, sendTime.msecsTo(QTime::currentTime()) / 2); -} - - void SignalProxy::customEvent(QEvent *event) { - switch (+event->type()) { - case PeerSignal: - { - PeerSignalEvent *e = static_cast(event); - receivePeerSignal(e->sender, e->requestType, e->params); - } + switch ((int)event->type()) { + case RemovePeerEvent: { + ::RemovePeerEvent *e = static_cast< ::RemovePeerEvent *>(event); + removePeer(e->peer); event->accept(); break; - case RemovePeer: - { - RemovePeerEvent *e = static_cast(event); - removePeer(e->peer); } - event->accept(); + default: + qWarning() << Q_FUNC_INFO << "Received unknown custom event:" << event->type(); return; } } @@ -1140,9 +720,6 @@ void SignalProxy::sync_call__(const SyncableObject *obj, SignalProxy::ProxyMode ExtendedMetaObject *eMeta = extendedMetaObject(obj); QVariantList params; - params << eMeta->metaObject()->className() - << obj->objectName() - << QByteArray(funcname); const QList &argTypes = eMeta->argTypes(eMeta->methodId(QByteArray(funcname))); @@ -1155,7 +732,7 @@ void SignalProxy::sync_call__(const SyncableObject *obj, SignalProxy::ProxyMode params << QVariant(argTypes[i], va_arg(ap, void *)); } - dispatchSignal(Sync, params); + dispatch(SyncMessage(eMeta->metaObject()->className(), obj->objectName(), QByteArray(funcname), params)); } @@ -1170,15 +747,6 @@ void SignalProxy::disconnectDevice(QIODevice *dev, const QString &reason) } -void SignalProxy::updateLag(IODevicePeer *peer, int lag) -{ - peer->lag = lag; - if (proxyMode() == Client) { - emit lagUpdated(lag); - } -} - - void SignalProxy::dumpProxyStats() { QString mode; @@ -1204,9 +772,8 @@ void SignalProxy::updateSecureState() bool wasSecure = _secure; _secure = !_peers.isEmpty(); - PeerHash::const_iterator peerIter; - for (peerIter = _peers.constBegin(); peerIter != _peers.constEnd(); peerIter++) { - _secure &= (*peerIter)->isSecure(); + foreach (const AbstractPeer *peer, _peers) { + _secure &= peer->isSecure(); } if (wasSecure != _secure) diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index 83b2f4a3..d446fefc 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,57 +21,44 @@ #ifndef SIGNALPROXY_H #define SIGNALPROXY_H +#include #include #include #include #include #include #include +#include #include #include #include +#include "protocol.h" + class SyncableObject; struct QMetaObject; + class SignalProxy : public QObject { Q_OBJECT - class AbstractPeer; - class IODevicePeer; - class SignalProxyPeer; - class SignalRelay; public: + class AbstractPeer; + enum ProxyMode { Server, Client }; - enum RequestType { - Sync = 1, - RpcCall, - InitRequest, - InitData, - HeartBeat, - HeartBeatReply - }; - - enum ClientConnectionType { - SignalProxyConnection, - IODeviceConnection - }; - - enum CustomEvents { - PeerSignal = QEvent::User, - RemovePeer + enum EventType { + RemovePeerEvent = QEvent::User }; SignalProxy(QObject *parent); SignalProxy(ProxyMode mode, QObject *parent); - SignalProxy(ProxyMode mode, QIODevice *device, QObject *parent); virtual ~SignalProxy(); void setProxyMode(ProxyMode mode); @@ -82,10 +69,7 @@ public: void setMaxHeartBeatCount(int max); inline int maxHeartBeatCount() const { return _maxHeartBeatCount; } - bool addPeer(QIODevice *iodev); - bool addPeer(SignalProxy *proxy); - void removePeer(QObject *peer); - void removeAllPeers(); + bool addPeer(AbstractPeer *peer); bool attachSignal(QObject *sender, const char *signal, const QByteArray &sigName = QByteArray()); bool attachSlot(const QByteArray &sigName, QObject *recv, const char *slot); @@ -93,19 +77,6 @@ public: void synchronize(SyncableObject *obj); void stopSynchronize(SyncableObject *obj); - //! Writes a QVariant to a device. - /** The data item is prefixed with the resulting blocksize, - * so the corresponding function readDataFromDevice() can check if enough data is available - * at the device to reread the item. - */ - static void writeDataToDevice(QIODevice *dev, const QVariant &item, bool compressed = false); - - //! Reads a data item from a device that has been written by writeDataToDevice(). - /** If not enough data bytes are available, the function returns false and the QVariant reference - * remains untouched. - */ - static bool readDataFromDevice(QIODevice *dev, quint32 &blockSize, QVariant &item, bool compressed = false); - class ExtendedMetaObject; ExtendedMetaObject *extendedMetaObject(const QMetaObject *meta) const; ExtendedMetaObject *createExtendedMetaObject(const QMetaObject *meta, bool checkConflicts = false); @@ -114,6 +85,8 @@ public: bool isSecure() const { return _secure; } void dumpProxyStats(); + void dumpSyncMap(SyncableObject *object); + inline int peerCount() const { return _peers.size(); } public slots: void detachObject(QObject *obj); @@ -126,41 +99,40 @@ protected: void renameObject(const SyncableObject *obj, const QString &newname, const QString &oldname); private slots: - void dataAvailable(); void removePeerBySender(); void objectRenamed(const QByteArray &classname, const QString &newname, const QString &oldname); - void sendHeartBeat(); - void receiveHeartBeat(AbstractPeer *peer, const QVariantList ¶ms); - void receiveHeartBeatReply(AbstractPeer *peer, const QVariantList ¶ms); - void updateSecureState(); signals: - void peerRemoved(QIODevice *dev); + void peerRemoved(SignalProxy::AbstractPeer *peer); void connected(); void disconnected(); void objectInitialized(SyncableObject *); + void heartBeatIntervalChanged(int secs); + void maxHeartBeatCountChanged(int max); void lagUpdated(int lag); - void securityChanged(bool); void secureStateChanged(bool); private: + template + class PeerMessageEvent; + void init(); void initServer(); void initClient(); static const QMetaObject *metaObject(const QObject *obj); - void dispatchSignal(QIODevice *receiver, const RequestType &requestType, const QVariantList ¶ms); - void dispatchSignal(const RequestType &requestType, const QVariantList ¶ms); + void removePeer(AbstractPeer *peer); + void removeAllPeers(); + + template + void dispatch(const T &protoMessage); - void receivePackedFunc(AbstractPeer *sender, const QVariant &packedFunc); - void receivePeerSignal(AbstractPeer *sender, const RequestType &requestType, const QVariantList ¶ms); - void receivePeerSignal(SignalProxy *sender, const RequestType &requestType, const QVariantList ¶ms); - void handleSync(AbstractPeer *sender, QVariantList params); - void handleInitRequest(AbstractPeer *sender, const QVariantList ¶ms); - void handleInitData(AbstractPeer *sender, const QVariantList ¶ms); - void handleSignal(const QVariantList &data); + void handle(AbstractPeer *peer, const Protocol::SyncMessage &syncMessage); + void handle(AbstractPeer *peer, const Protocol::RpcCall &rpcCall); + void handle(AbstractPeer *peer, const Protocol::InitRequest &initRequest); + void handle(AbstractPeer *peer, const Protocol::InitData &initData); bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms, QVariant &returnValue); bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms = QVariantList()); @@ -169,19 +141,9 @@ private: QVariantMap initData(SyncableObject *obj) const; void setInitData(SyncableObject *obj, const QVariantMap &properties); - void updateLag(IODevicePeer *peer, int lag); - -public: - void dumpSyncMap(SyncableObject *object); - inline int peerCount() const { return _peers.size(); } - -private: static void disconnectDevice(QIODevice *dev, const QString &reason = QString()); - // a Hash of the actual used communication object to it's corresponding peer - // currently a communication object can either be an arbitrary QIODevice or another SignalProxy - typedef QHash PeerHash; - PeerHash _peers; + QSet _peers; // containg a list of argtypes for fast access QHash _extendedMetaObjects; @@ -199,7 +161,6 @@ private: QHash _syncSlave; ProxyMode _proxyMode; - QTimer _heartBeatTimer; int _heartBeatInterval; int _maxHeartBeatCount; @@ -207,6 +168,8 @@ private: friend class SignalRelay; friend class SyncableObject; + friend class InternalPeer; + friend class RemotePeer; }; @@ -217,7 +180,7 @@ class SignalProxy::ExtendedMetaObject { class MethodDescriptor { -public: + public: MethodDescriptor(const QMetaMethod &method); MethodDescriptor() : _returnType(-1), _minArgCount(-1), _receiverMode(SignalProxy::Client) {} @@ -227,7 +190,7 @@ public: inline int minArgCount() const { return _minArgCount; } inline SignalProxy::ProxyMode receiverMode() const { return _receiverMode; } -private: + private: QByteArray _methodName; QList _argTypes; int _returnType; @@ -270,58 +233,40 @@ private: // ================================================== -// Peers +// AbstractPeer // ================================================== -class SignalProxy::AbstractPeer +class SignalProxy::AbstractPeer : public QObject { + Q_OBJECT + public: - enum PeerType { - NotAPeer = 0, - IODevicePeer = 1, - SignalProxyPeer = 2 - }; - AbstractPeer() : _type(NotAPeer) {} - AbstractPeer(PeerType type) : _type(type) {} - virtual ~AbstractPeer() {} - inline PeerType type() const { return _type; } - virtual void dispatchSignal(const RequestType &requestType, const QVariantList ¶ms) = 0; + AbstractPeer(QObject *parent = 0) : QObject(parent) {} + + virtual QString description() const = 0; + + virtual void setSignalProxy(SignalProxy *proxy) = 0; + + virtual bool isOpen() const = 0; virtual bool isSecure() const = 0; -private: - PeerType _type; -}; + virtual bool isLocal() const = 0; + virtual QString errorString() const { return QString(); } -class SignalProxy::IODevicePeer : public SignalProxy::AbstractPeer -{ -public: - IODevicePeer(QIODevice *device, bool compress) : AbstractPeer(AbstractPeer::IODevicePeer), _device(device), byteCount(0), usesCompression(compress), sentHeartBeats(0), lag(0) {} - virtual void dispatchSignal(const RequestType &requestType, const QVariantList ¶ms); - virtual bool isSecure() const; - inline void dispatchPackedFunc(const QVariant &packedFunc) { SignalProxy::writeDataToDevice(_device, packedFunc, usesCompression); } - QString address() const; - inline bool isOpen() const { return _device->isOpen(); } - inline void close() const { _device->close(); } - inline bool readData(QVariant &item) { return SignalProxy::readDataFromDevice(_device, byteCount, item, usesCompression); } -private: - QIODevice *_device; - quint32 byteCount; - bool usesCompression; -public: - int sentHeartBeats; - int lag; -}; + virtual int lag() const = 0; +public slots: + virtual void dispatch(const Protocol::SyncMessage &msg) = 0; + virtual void dispatch(const Protocol::RpcCall &msg) = 0; + virtual void dispatch(const Protocol::InitRequest &msg) = 0; + virtual void dispatch(const Protocol::InitData &msg) = 0; -class SignalProxy::SignalProxyPeer : public SignalProxy::AbstractPeer -{ -public: - SignalProxyPeer(SignalProxy *sender, SignalProxy *receiver) : AbstractPeer(AbstractPeer::SignalProxyPeer), sender(sender), receiver(receiver) {} - virtual void dispatchSignal(const RequestType &requestType, const QVariantList ¶ms); - virtual inline bool isSecure() const { return true; } -private: - SignalProxy *sender; - SignalProxy *receiver; -}; + virtual void close(const QString &reason = QString()) = 0; +signals: + void disconnected(); + void error(QAbstractSocket::SocketError); + void secureStateChanged(bool secure = true); + void lagUpdated(int msecs); +}; #endif diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index a9417b10..2db7e469 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/syncableobject.h b/src/common/syncableobject.h index 0042c507..895d6576 100644 --- a/src/common/syncableobject.h +++ b/src/common/syncableobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/types.h b/src/common/types.h index aa0521b7..0fbb2b77 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/util.cpp b/src/common/util.cpp index e7f531b4..75f32f2e 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/common/util.h b/src/common/util.h index 2b5e7839..bb90355e 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index e721e4d9..ad08947d 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/abstractsqlstorage.h b/src/core/abstractsqlstorage.h index 104c0561..0cf91b96 100644 --- a/src/core/abstractsqlstorage.h +++ b/src/core/abstractsqlstorage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/core.cpp b/src/core/core.cpp index 46c28930..4413211e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -23,15 +23,17 @@ #include "core.h" #include "coresession.h" #include "coresettings.h" +#include "internalpeer.h" #include "postgresqlstorage.h" #include "quassel.h" -#include "signalproxy.h" #include "sqlitestorage.h" #include "network.h" #include "logger.h" #include "util.h" +#include "protocols/legacy/legacypeer.h" + // migration related #include #ifdef Q_OS_WIN32 @@ -54,8 +56,8 @@ const int Core::AddClientEventId = QEvent::registerEventType(); class AddClientEvent : public QEvent { public: - AddClientEvent(QTcpSocket *socket, UserId uid) : QEvent(QEvent::Type(Core::AddClientEventId)), socket(socket), userId(uid) {} - QTcpSocket *socket; + AddClientEvent(RemotePeer *p, UserId uid) : QEvent(QEvent::Type(Core::AddClientEventId)), peer(p), userId(uid) {} + RemotePeer *peer; UserId userId; }; @@ -215,8 +217,8 @@ void Core::init() Core::~Core() { - foreach(QTcpSocket *socket, blocksizes.keys()) { - socket->disconnectFromHost(); // disconnect non authed clients + foreach(RemotePeer *peer, clientInfo.keys()) { + peer->close(); // disconnect non authed clients } qDeleteAll(sessions); qDeleteAll(_storageBackends); @@ -515,12 +517,13 @@ void Core::incomingConnection() Q_ASSERT(server); while (server->hasPendingConnections()) { QTcpSocket *socket = server->nextPendingConnection(); - connect(socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected())); - connect(socket, SIGNAL(readyRead()), this, SLOT(clientHasData())); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); + RemotePeer *peer = new LegacyPeer(socket, this); + + connect(peer, SIGNAL(disconnected()), SLOT(clientDisconnected())); + connect(peer, SIGNAL(dataReceived(QVariant)), SLOT(processClientMessage(QVariant))); + connect(peer, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError))); - QVariantMap clientInfo; - blocksizes.insert(socket, (quint32)0); + clientInfo.insert(peer, QVariantMap()); quInfo() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString()); if (!_configured) { @@ -530,27 +533,22 @@ void Core::incomingConnection() } -void Core::clientHasData() +void Core::processClientMessage(const QVariant &data) { - QTcpSocket *socket = dynamic_cast(sender()); - Q_ASSERT(socket && blocksizes.contains(socket)); - QVariant item; - while (SignalProxy::readDataFromDevice(socket, blocksizes[socket], item)) { - QVariantMap msg = item.toMap(); - processClientMessage(socket, msg); - if (!blocksizes.contains(socket)) break; // this socket is no longer ours to handle! + RemotePeer *peer = qobject_cast(sender()); + if (!peer) { + qWarning() << Q_FUNC_INFO << "Message not sent by RemoteConnection!"; + return; } -} - -void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) -{ + QVariantMap msg = data.toMap(); if (!msg.contains("MsgType")) { // Client is way too old, does not even use the current init format qWarning() << qPrintable(tr("Antique client trying to connect... refusing.")); - socket->close(); + peer->close(); return; } + // OK, so we have at least an init message format we can understand if (msg["MsgType"] == "ClientInit") { QVariantMap reply; @@ -562,9 +560,10 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) reply["Error"] = tr("Your Quassel Client is too old!
" "This core needs at least client/core protocol version %1.
" "Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol); - SignalProxy::writeDataToDevice(socket, reply); - qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting.")); - socket->close(); return; + peer->writeSocketData(reply); + qWarning() << qPrintable(tr("Client")) << peer->description() << qPrintable(tr("too old, rejecting.")); + peer->close(); + return; } reply["ProtocolVersion"] = Quassel::buildInfo().protocolVersion; @@ -590,8 +589,8 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) #ifdef HAVE_SSL SslServer *sslServer = qobject_cast(&_server); - QSslSocket *sslSocket = qobject_cast(socket); - bool supportSsl = (bool)sslServer && (bool)sslSocket && sslServer->isCertValid(); + QSslSocket *sslSocket = qobject_cast(peer->socket()); + bool supportSsl = sslServer && sslSocket && sslServer->isCertValid(); #else bool supportSsl = false; #endif @@ -626,36 +625,36 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) else { reply["Configured"] = true; } - clientInfo[socket] = msg; // store for future reference + clientInfo[peer] = msg; // store for future reference reply["MsgType"] = "ClientInitAck"; - SignalProxy::writeDataToDevice(socket, reply); - socket->flush(); // ensure that the write cache is flushed before we switch to ssl + peer->writeSocketData(reply); + peer->socket()->flush(); // ensure that the write cache is flushed before we switch to ssl #ifdef HAVE_SSL // after we told the client that we are ssl capable we switch to ssl mode if (supportSsl && msg["UseSsl"].toBool()) { - qDebug() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString()); - connect(sslSocket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); + qDebug() << qPrintable(tr("Starting TLS for Client:")) << peer->description(); + connect(sslSocket, SIGNAL(sslErrors(const QList &)), SLOT(sslErrors(const QList &))); sslSocket->startServerEncryption(); } #endif #ifndef QT_NO_COMPRESS if (supportsCompression && msg["UseCompression"].toBool()) { - socket->setProperty("UseCompression", true); - qDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString()); + peer->socket()->setProperty("UseCompression", true); + qDebug() << "Using compression for Client:" << qPrintable(peer->socket()->peerAddress().toString()); } #endif } else { // for the rest, we need an initialized connection - if (!clientInfo.contains(socket)) { + if (!clientInfo.contains(peer)) { QVariantMap reply; reply["MsgType"] = "ClientLoginReject"; reply["Error"] = tr("Client not initialized!
You need to send an init message before trying to login."); - SignalProxy::writeDataToDevice(socket, reply); - qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting.")); - socket->close(); return; + peer->writeSocketData(reply); + qWarning() << qPrintable(tr("Client")) << qPrintable(peer->socket()->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting.")); + peer->close(); return; } if (msg["MsgType"] == "CoreSetupData") { QVariantMap reply; @@ -667,7 +666,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) else { reply["MsgType"] = "CoreSetupAck"; } - SignalProxy::writeDataToDevice(socket, reply); + peer->writeSocketData(reply); } else if (msg["MsgType"] == "ClientLogin") { QVariantMap reply; @@ -675,13 +674,13 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) if (uid == 0) { reply["MsgType"] = "ClientLoginReject"; reply["Error"] = tr("Invalid username or password!
The username/password combination you supplied could not be found in the database."); - SignalProxy::writeDataToDevice(socket, reply); + peer->writeSocketData(reply); return; } reply["MsgType"] = "ClientLoginAck"; - SignalProxy::writeDataToDevice(socket, reply); - quInfo() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("initialized and authenticated successfully as \"%1\" (UserId: %2).").arg(msg["User"].toString()).arg(uid.toInt())); - setupClientSession(socket, uid); + peer->writeSocketData(reply); + quInfo() << qPrintable(tr("Client")) << qPrintable(peer->socket()->peerAddress().toString()) << qPrintable(tr("initialized and authenticated successfully as \"%1\" (UserId: %2).").arg(msg["User"].toString()).arg(uid.toInt())); + setupClientSession(peer, uid); } } } @@ -690,41 +689,12 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) // Potentially called during the initialization phase (before handing the connection off to the session) void Core::clientDisconnected() { - QTcpSocket *socket = qobject_cast(sender()); - if (socket) { - // here it's safe to call methods on socket! - quInfo() << qPrintable(tr("Non-authed client disconnected.")) << qPrintable(socket->peerAddress().toString()); - blocksizes.remove(socket); - clientInfo.remove(socket); - socket->deleteLater(); - } - else { - // we have to crawl through the hashes and see if we find a victim to remove - qDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)")); + RemotePeer *peer = qobject_cast(sender()); + Q_ASSERT(peer); - // DO NOT CALL ANY METHODS ON socket!! - socket = static_cast(sender()); - - QHash::iterator blockSizeIter = blocksizes.begin(); - while (blockSizeIter != blocksizes.end()) { - if (blockSizeIter.key() == socket) { - blockSizeIter = blocksizes.erase(blockSizeIter); - } - else { - blockSizeIter++; - } - } - - QHash::iterator clientInfoIter = clientInfo.begin(); - while (clientInfoIter != clientInfo.end()) { - if (clientInfoIter.key() == socket) { - clientInfoIter = clientInfo.erase(clientInfoIter); - } - else { - clientInfoIter++; - } - } - } + quInfo() << qPrintable(tr("Non-authed client disconnected.")) << qPrintable(peer->socket()->peerAddress().toString()); + clientInfo.remove(peer); + peer->deleteLater(); // make server listen again if still not configured if (!_configured) { @@ -736,13 +706,12 @@ void Core::clientDisconnected() } -void Core::setupClientSession(QTcpSocket *socket, UserId uid) +void Core::setupClientSession(RemotePeer *peer, UserId uid) { // From now on everything is handled by the client session - disconnect(socket, 0, this, 0); - socket->flush(); - blocksizes.remove(socket); - clientInfo.remove(socket); + disconnect(peer, 0, this, 0); + peer->socket()->flush(); + clientInfo.remove(peer); // Find or create session for validated user SessionThread *session; @@ -752,15 +721,15 @@ void Core::setupClientSession(QTcpSocket *socket, UserId uid) else { session = createSession(uid); if (!session) { - qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString()); - socket->close(); + qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(peer->socket()->peerAddress().toString()); + peer->close(); return; } } // as we are currently handling an event triggered by incoming data on this socket // it is unsafe to directly move the socket to the client thread. - QCoreApplication::postEvent(this, new AddClientEvent(socket, uid)); + QCoreApplication::postEvent(this, new AddClientEvent(peer, uid)); } @@ -768,27 +737,27 @@ void Core::customEvent(QEvent *event) { if (event->type() == AddClientEventId) { AddClientEvent *addClientEvent = static_cast(event); - addClientHelper(addClientEvent->socket, addClientEvent->userId); + addClientHelper(addClientEvent->peer, addClientEvent->userId); return; } } -void Core::addClientHelper(QTcpSocket *socket, UserId uid) +void Core::addClientHelper(RemotePeer *peer, UserId uid) { // Find or create session for validated user if (!sessions.contains(uid)) { - qWarning() << qPrintable(tr("Could not find a session for client:")) << qPrintable(socket->peerAddress().toString()); - socket->close(); + qWarning() << qPrintable(tr("Could not find a session for client:")) << qPrintable(peer->socket()->peerAddress().toString()); + peer->close(); return; } SessionThread *session = sessions[uid]; - session->addClient(socket); + session->addClient(peer); } -void Core::setupInternalClientSession(SignalProxy *proxy) +void Core::setupInternalClientSession(InternalPeer *clientPeer) { if (!_configured) { stopListening(); @@ -804,13 +773,18 @@ void Core::setupInternalClientSession(SignalProxy *proxy) return; } + InternalPeer *corePeer = new InternalPeer(this); + corePeer->setPeer(clientPeer); + clientPeer->setPeer(corePeer); + // Find or create session for validated user - SessionThread *sess; + SessionThread *sessionThread; if (sessions.contains(uid)) - sess = sessions[uid]; + sessionThread = sessions[uid]; else - sess = createSession(uid); - sess->addClient(proxy); + sessionThread = createSession(uid); + + sessionThread->addClient(corePeer); } @@ -841,9 +815,9 @@ void Core::sslErrors(const QList &errors) void Core::socketError(QAbstractSocket::SocketError err) { - QAbstractSocket *socket = qobject_cast(sender()); - if (socket && err != QAbstractSocket::RemoteHostClosedError) - qWarning() << "Core::socketError()" << socket << err << socket->errorString(); + RemotePeer *peer = qobject_cast(sender()); + if (peer && err != QAbstractSocket::RemoteHostClosedError) + qWarning() << "Core::socketError()" << peer->socket() << err << peer->socket()->errorString(); } diff --git a/src/core/core.h b/src/core/core.h index 45a37b61..ebe80619 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -42,9 +42,10 @@ #include "types.h" class CoreSession; +class RemotePeer; +struct NetworkInfo; class SessionThread; class SignalProxy; -struct NetworkInfo; class AbstractSqlMigrationReader; class AbstractSqlMigrationWriter; @@ -484,7 +485,7 @@ public slots: /** \note This method is threadsafe. */ void syncStorage(); - void setupInternalClientSession(SignalProxy *proxy); + void setupInternalClientSession(InternalPeer *clientConnection); signals: //! Sent when a BufferInfo is updated in storage. @@ -500,7 +501,6 @@ private slots: bool startListening(); void stopListening(const QString &msg = QString()); void incomingConnection(); - void clientHasData(); void clientDisconnected(); bool initStorage(const QString &backend, QVariantMap settings, bool setup = false); @@ -511,6 +511,8 @@ private slots: #endif void socketError(QAbstractSocket::SocketError); + void processClientMessage(const QVariant &data); + private: Core(); ~Core(); @@ -518,9 +520,8 @@ private: static Core *instanceptr; SessionThread *createSession(UserId userId, bool restoreState = false); - void setupClientSession(QTcpSocket *socket, UserId uid); - void addClientHelper(QTcpSocket *socket, UserId uid); - void processClientMessage(QTcpSocket *socket, const QVariantMap &msg); + void setupClientSession(RemotePeer *peer, UserId uid); + void addClientHelper(RemotePeer *peer, UserId uid); //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg); QString setupCoreForInternalUsage(); QString setupCore(QVariantMap setupData); @@ -547,8 +548,7 @@ private: OidentdConfigGenerator *_oidentdConfigGenerator; - QHash blocksizes; - QHash clientInfo; + QHash clientInfo; QHash _storageBackends; diff --git a/src/core/corealiasmanager.cpp b/src/core/corealiasmanager.cpp index f7f5cf6b..d811ea15 100644 --- a/src/core/corealiasmanager.cpp +++ b/src/core/corealiasmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corealiasmanager.h b/src/core/corealiasmanager.h index 25b9ddfc..814bf924 100644 --- a/src/core/corealiasmanager.h +++ b/src/core/corealiasmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreapplication.cpp b/src/core/coreapplication.cpp index 3dabe76b..3e3f9d17 100644 --- a/src/core/coreapplication.cpp +++ b/src/core/coreapplication.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreapplication.h b/src/core/coreapplication.h index e2f8ccfd..2bd53868 100644 --- a/src/core/coreapplication.h +++ b/src/core/coreapplication.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebacklogmanager.cpp b/src/core/corebacklogmanager.cpp index d380db86..371ae602 100644 --- a/src/core/corebacklogmanager.cpp +++ b/src/core/corebacklogmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebacklogmanager.h b/src/core/corebacklogmanager.h index 6b76b090..d1f225c0 100644 --- a/src/core/corebacklogmanager.h +++ b/src/core/corebacklogmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebasichandler.cpp b/src/core/corebasichandler.cpp index f12b6422..c08b1c73 100644 --- a/src/core/corebasichandler.cpp +++ b/src/core/corebasichandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebasichandler.h b/src/core/corebasichandler.h index 95f3c709..53f0de48 100644 --- a/src/core/corebasichandler.h +++ b/src/core/corebasichandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebuffersyncer.cpp b/src/core/corebuffersyncer.cpp index af5794a0..847148ba 100644 --- a/src/core/corebuffersyncer.cpp +++ b/src/core/corebuffersyncer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebuffersyncer.h b/src/core/corebuffersyncer.h index bea39cf2..46b06dc0 100644 --- a/src/core/corebuffersyncer.h +++ b/src/core/corebuffersyncer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebufferviewconfig.cpp b/src/core/corebufferviewconfig.cpp index 46b13055..efb73562 100644 --- a/src/core/corebufferviewconfig.cpp +++ b/src/core/corebufferviewconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebufferviewconfig.h b/src/core/corebufferviewconfig.h index ae974d9e..8248e28e 100644 --- a/src/core/corebufferviewconfig.h +++ b/src/core/corebufferviewconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebufferviewmanager.cpp b/src/core/corebufferviewmanager.cpp index 5832807a..b0cbe4ce 100644 --- a/src/core/corebufferviewmanager.cpp +++ b/src/core/corebufferviewmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corebufferviewmanager.h b/src/core/corebufferviewmanager.h index f232156f..0e1b4dfd 100644 --- a/src/core/corebufferviewmanager.h +++ b/src/core/corebufferviewmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corecoreinfo.cpp b/src/core/corecoreinfo.cpp index a7fb4ad5..549e503f 100644 --- a/src/core/corecoreinfo.cpp +++ b/src/core/corecoreinfo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corecoreinfo.h b/src/core/corecoreinfo.h index 719a3517..05ba7bb8 100644 --- a/src/core/corecoreinfo.h +++ b/src/core/corecoreinfo.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreeventmanager.h b/src/core/coreeventmanager.h index de4878e6..b64e7bf9 100644 --- a/src/core/coreeventmanager.h +++ b/src/core/coreeventmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreidentity.cpp b/src/core/coreidentity.cpp index bdd4f18a..8e6fc596 100644 --- a/src/core/coreidentity.cpp +++ b/src/core/coreidentity.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreidentity.h b/src/core/coreidentity.h index 80db0d0e..39ee2a45 100644 --- a/src/core/coreidentity.h +++ b/src/core/coreidentity.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreignorelistmanager.cpp b/src/core/coreignorelistmanager.cpp index 42cfee5e..c1de5e2a 100644 --- a/src/core/coreignorelistmanager.cpp +++ b/src/core/coreignorelistmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreignorelistmanager.h b/src/core/coreignorelistmanager.h index 7904e167..40abe951 100644 --- a/src/core/coreignorelistmanager.h +++ b/src/core/coreignorelistmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreircchannel.cpp b/src/core/coreircchannel.cpp index f0e65ff6..a7e1b6c6 100644 --- a/src/core/coreircchannel.cpp +++ b/src/core/coreircchannel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreircchannel.h b/src/core/coreircchannel.h index 84932d5d..c7746044 100644 --- a/src/core/coreircchannel.h +++ b/src/core/coreircchannel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreirclisthelper.cpp b/src/core/coreirclisthelper.cpp index dfbba297..bb7d1dec 100644 --- a/src/core/coreirclisthelper.cpp +++ b/src/core/coreirclisthelper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreirclisthelper.h b/src/core/coreirclisthelper.h index 4e65918c..301d3e95 100644 --- a/src/core/coreirclisthelper.h +++ b/src/core/coreirclisthelper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreircuser.cpp b/src/core/coreircuser.cpp index 5bb0bcf4..79f5d38a 100644 --- a/src/core/coreircuser.cpp +++ b/src/core/coreircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreircuser.h b/src/core/coreircuser.h index 751e86f6..cc5a9f8a 100644 --- a/src/core/coreircuser.h +++ b/src/core/coreircuser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index ed3b39e7..b734312b 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -375,7 +375,8 @@ void CoreNetwork::setMyNick(const QString &mynick) void CoreNetwork::socketHasData() { while (socket.canReadLine()) { - QByteArray s = socket.readLine().trimmed(); + QByteArray s = socket.readLine(); + s.chop(2); NetworkDataEvent *event = new NetworkDataEvent(EventManager::NetworkIncoming, this, s); #if QT_VERSION >= 0x040700 event->setTimestamp(QDateTime::currentDateTimeUtc()); diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h index e58945a5..47575782 100644 --- a/src/core/corenetwork.h +++ b/src/core/corenetwork.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corenetworkconfig.cpp b/src/core/corenetworkconfig.cpp index a18f231c..c654d521 100644 --- a/src/core/corenetworkconfig.cpp +++ b/src/core/corenetworkconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/corenetworkconfig.h b/src/core/corenetworkconfig.h index f9558828..e045697c 100644 --- a/src/core/corenetworkconfig.h +++ b/src/core/corenetworkconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -45,6 +45,7 @@ public slots: virtual inline void requestSetAutoWhoInterval(int interval) { setAutoWhoInterval(interval); } virtual inline void requestSetAutoWhoNickLimit(int nickLimit) { setAutoWhoNickLimit(nickLimit); } virtual inline void requestSetAutoWhoDelay(int delay) { setAutoWhoDelay(delay); } + virtual inline void requestSetStandardCtcp(bool enabled) { setStandardCtcp(enabled); } }; diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 6abf631f..d44cf2b5 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -37,15 +37,17 @@ #include "coreusersettings.h" #include "ctcpparser.h" #include "eventstringifier.h" +#include "internalpeer.h" #include "ircchannel.h" #include "ircparser.h" #include "ircuser.h" #include "logger.h" #include "messageevent.h" -#include "signalproxy.h" #include "storage.h" #include "util.h" +#include "protocols/legacy/legacypeer.h" + class ProcessMessagesEvent : public QEvent { public: @@ -56,7 +58,7 @@ public: CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) : QObject(parent), _user(uid), - _signalProxy(new SignalProxy(SignalProxy::Server, 0, this)), + _signalProxy(new SignalProxy(SignalProxy::Server, this)), _aliasManager(this), _bufferSyncer(new CoreBufferSyncer(this)), _backlogManager(new CoreBacklogManager(this)), @@ -77,10 +79,10 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->setHeartBeatInterval(30); p->setMaxHeartBeatCount(60); // 30 mins until we throw a dead socket out - connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *))); + connect(p, SIGNAL(peerRemoved(SignalProxy::AbstractPeer*)), SLOT(removeClient(SignalProxy::AbstractPeer*))); - connect(p, SIGNAL(connected()), this, SLOT(clientsConnected())); - connect(p, SIGNAL(disconnected()), this, SLOT(clientsDisconnected())); + connect(p, SIGNAL(connected()), SLOT(clientsConnected())); + connect(p, SIGNAL(disconnected()), SLOT(clientsDisconnected())); p->attachSlot(SIGNAL(sendInput(BufferInfo, QString)), this, SLOT(msgFromClient(BufferInfo, QString))); p->attachSignal(this, SIGNAL(displayMsg(Message))); @@ -204,36 +206,28 @@ void CoreSession::restoreSessionState() } -void CoreSession::addClient(QIODevice *device) +void CoreSession::addClient(RemotePeer *peer) { - if (!device) { - qCritical() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!"; - } - else { - // if the socket is an orphan, the signalProxy adopts it. - // -> we don't need to care about it anymore - device->setParent(0); - signalProxy()->addPeer(device); - QVariantMap reply; - reply["MsgType"] = "SessionInit"; - reply["SessionState"] = sessionState(); - SignalProxy::writeDataToDevice(device, reply); - } + QVariantMap reply; + reply["MsgType"] = "SessionInit"; + reply["SessionState"] = sessionState(); + peer->writeSocketData(reply); + signalProxy()->addPeer(peer); } -void CoreSession::addClient(SignalProxy *proxy) +void CoreSession::addClient(InternalPeer *peer) { - signalProxy()->addPeer(proxy); + signalProxy()->addPeer(peer); emit sessionState(sessionState()); } -void CoreSession::removeClient(QIODevice *iodev) +void CoreSession::removeClient(SignalProxy::AbstractPeer *peer) { - QTcpSocket *socket = qobject_cast(iodev); - if (socket) - quInfo() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); + RemotePeer *p = qobject_cast(peer); + if (p) + quInfo() << qPrintable(tr("Client")) << p->description() << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); } diff --git a/src/core/coresession.h b/src/core/coresession.h index 98d60d4e..fdb952f7 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -28,6 +28,7 @@ #include "corealiasmanager.h" #include "coreignorelistmanager.h" #include "message.h" +#include "signalproxy.h" #include "storage.h" class CoreBacklogManager; @@ -41,10 +42,11 @@ class CoreSessionEventProcessor; class CtcpParser; class EventManager; class EventStringifier; +class InternalPeer; class IrcParser; class MessageEvent; class NetworkConnection; -class SignalProxy; +class RemotePeer; struct NetworkInfo; @@ -87,8 +89,8 @@ public: void restoreSessionState(); public slots: - void addClient(QIODevice *device); - void addClient(SignalProxy *proxy); + void addClient(RemotePeer *peer); + void addClient(InternalPeer *peer); void msgFromClient(BufferInfo, QString message); @@ -155,7 +157,7 @@ protected: virtual void customEvent(QEvent *event); private slots: - void removeClient(QIODevice *dev); + void removeClient(SignalProxy::AbstractPeer *peer); void recvStatusMsgFromServer(QString msg); void recvMessageFromServer(NetworkId networkId, Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None); diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index d0c75971..e2edd083 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -112,14 +112,22 @@ void CoreSessionEventProcessor::processIrcEventAuthenticate(IrcEvent *e) CoreNetwork *net = coreNetwork(e); - QString construct = net->saslAccount(); - construct.append(QChar(QChar::Null)); - construct.append(net->saslAccount()); - construct.append(QChar(QChar::Null)); - construct.append(net->saslPassword()); - QByteArray saslData = QByteArray(construct.toAscii().toBase64()); - saslData.prepend("AUTHENTICATE "); - net->putRawLine(saslData); +#ifdef HAVE_SSL + if (net->identityPtr()->sslCert().isNull()) { +#endif + QString construct = net->saslAccount(); + construct.append(QChar(QChar::Null)); + construct.append(net->saslAccount()); + construct.append(QChar(QChar::Null)); + construct.append(net->saslPassword()); + QByteArray saslData = QByteArray(construct.toAscii().toBase64()); + saslData.prepend("AUTHENTICATE "); + net->putRawLine(saslData); +#ifdef HAVE_SSL + } else { + net->putRawLine("AUTHENTICATE +"); + } +#endif } @@ -129,9 +137,19 @@ void CoreSessionEventProcessor::processIrcEventCap(IrcEvent *e) // additional CAP messages (ls, multi-prefix, et cetera). if (e->params().count() == 3) { - if (e->params().at(2) == "sasl") { + if (e->params().at(2).startsWith("sasl")) { // Freenode (at least) sends "sasl " with a trailing space for some reason! // FIXME use event - coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE PLAIN")); // Only working with PLAIN atm, blowfish later + // if the current identity has a cert set, use SASL EXTERNAL +#ifdef HAVE_SSL + if (!coreNetwork(e)->identityPtr()->sslCert().isNull()) { + coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE EXTERNAL")); + } else { +#endif + // Only working with PLAIN atm, blowfish later + coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE PLAIN")); +#ifdef HAVE_SSL + } +#endif } } } diff --git a/src/core/coresessioneventprocessor.h b/src/core/coresessioneventprocessor.h index 1d255d8e..680917ac 100644 --- a/src/core/coresessioneventprocessor.h +++ b/src/core/coresessioneventprocessor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coresettings.cpp b/src/core/coresettings.cpp index a740942f..8d0e4b98 100644 --- a/src/core/coresettings.cpp +++ b/src/core/coresettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coresettings.h b/src/core/coresettings.h index d8f533ee..22a88706 100644 --- a/src/core/coresettings.h +++ b/src/core/coresettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp index 930be966..05424a6b 100644 --- a/src/core/coreuserinputhandler.cpp +++ b/src/core/coreuserinputhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreuserinputhandler.h b/src/core/coreuserinputhandler.h index 6f559c59..b6ebac1b 100644 --- a/src/core/coreuserinputhandler.h +++ b/src/core/coreuserinputhandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreusersettings.cpp b/src/core/coreusersettings.cpp index 64ac7ea4..d9c26089 100644 --- a/src/core/coreusersettings.cpp +++ b/src/core/coreusersettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/coreusersettings.h b/src/core/coreusersettings.h index db75535a..bcc9d543 100644 --- a/src/core/coreusersettings.h +++ b/src/core/coreusersettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/ctcpparser.cpp b/src/core/ctcpparser.cpp index 1f1660fc..7517db6f 100644 --- a/src/core/ctcpparser.cpp +++ b/src/core/ctcpparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,6 +20,7 @@ #include "ctcpparser.h" +#include "corenetworkconfig.h" #include "coresession.h" #include "ctcpevent.h" #include "messageevent.h" @@ -36,14 +37,24 @@ CtcpParser::CtcpParser(CoreSession *coreSession, QObject *parent) _ctcpMDequoteHash[MQUOTE + 'r'] = QByteArray(1, '\r'); _ctcpMDequoteHash[MQUOTE + MQUOTE] = MQUOTE; - QByteArray XQUOTE = QByteArray("\134"); - _ctcpXDelimDequoteHash[XQUOTE + XQUOTE] = XQUOTE; - _ctcpXDelimDequoteHash[XQUOTE + QByteArray("a")] = XDELIM; + setStandardCtcp(_coreSession->networkConfig()->standardCtcp()); + connect(_coreSession->networkConfig(), SIGNAL(standardCtcpSet(bool)), this, SLOT(setStandardCtcp(bool))); connect(this, SIGNAL(newEvent(Event *)), _coreSession->eventManager(), SLOT(postEvent(Event *))); } +void CtcpParser::setStandardCtcp(bool enabled) +{ + QByteArray XQUOTE = QByteArray("\134"); + if (enabled) + _ctcpXDelimDequoteHash[XQUOTE + XQUOTE] = XQUOTE; + else + _ctcpXDelimDequoteHash.remove(XQUOTE + XQUOTE); + _ctcpXDelimDequoteHash[XQUOTE + QByteArray("a")] = XDELIM; +} + + void CtcpParser::displayMsg(NetworkEvent *event, Message::Type msgType, const QString &msg, const QString &sender, const QString &target, Message::Flags msgFlags) { @@ -148,8 +159,6 @@ void CtcpParser::processIrcEventRawPrivmsg(IrcEventRawMessage *event) void CtcpParser::parse(IrcEventRawMessage *e, Message::Type messagetype) { - QByteArray ctcp; - //lowlevel message dequote QByteArray dequotedMessage = lowLevelDequote(e->rawMessage()); @@ -161,6 +170,53 @@ void CtcpParser::parse(IrcEventRawMessage *e, Message::Type messagetype) ? Message::Redirected : Message::None; + if (coreSession()->networkConfig()->standardCtcp()) + parseStandard(e, messagetype, dequotedMessage, ctcptype, flags); + else + parseSimple(e, messagetype, dequotedMessage, ctcptype, flags); +} + + +// only accept CTCPs in their simplest form, i.e. one ctcp, from start to +// end, no text around it; not as per the 'specs', but makes people happier +void CtcpParser::parseSimple(IrcEventRawMessage *e, Message::Type messagetype, QByteArray dequotedMessage, CtcpEvent::CtcpType ctcptype, Message::Flags flags) +{ + if (dequotedMessage.count(XDELIM) != 2 || dequotedMessage[0] != '\001' || dequotedMessage[dequotedMessage.count() -1] != '\001') { + displayMsg(e, messagetype, targetDecode(e, dequotedMessage), e->prefix(), e->target(), flags); + } else { + int spacePos = -1; + QString ctcpcmd, ctcpparam; + + QByteArray ctcp = xdelimDequote(dequotedMessage.mid(1, dequotedMessage.count() - 2)); + spacePos = ctcp.indexOf(' '); + if (spacePos != -1) { + ctcpcmd = targetDecode(e, ctcp.left(spacePos)); + ctcpparam = targetDecode(e, ctcp.mid(spacePos + 1)); + } else { + ctcpcmd = targetDecode(e, ctcp); + ctcpparam = QString(); + } + ctcpcmd = ctcpcmd.toUpper(); + + // we don't want to block /me messages by the CTCP ignore list + if (ctcpcmd == QLatin1String("ACTION") || !coreSession()->ignoreListManager()->ctcpMatch(e->prefix(), e->network()->networkName(), ctcpcmd)) { + QUuid uuid = QUuid::createUuid(); + _replies.insert(uuid, CtcpReply(coreNetwork(e), nickFromMask(e->prefix()))); + CtcpEvent *event = new CtcpEvent(EventManager::CtcpEvent, e->network(), e->prefix(), e->target(), + ctcptype, ctcpcmd, ctcpparam, e->timestamp(), uuid); + emit newEvent(event); + CtcpEvent *flushEvent = new CtcpEvent(EventManager::CtcpEventFlush, e->network(), e->prefix(), e->target(), + ctcptype, "INVALID", QString(), e->timestamp(), uuid); + emit newEvent(flushEvent); + } + } +} + + +void CtcpParser::parseStandard(IrcEventRawMessage *e, Message::Type messagetype, QByteArray dequotedMessage, CtcpEvent::CtcpType ctcptype, Message::Flags flags) +{ + QByteArray ctcp; + QList ctcpEvents; QUuid uuid; // needed to group all replies together diff --git a/src/core/ctcpparser.h b/src/core/ctcpparser.h index a33751fb..5847785b 100644 --- a/src/core/ctcpparser.h +++ b/src/core/ctcpparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -26,6 +26,7 @@ #include "corenetwork.h" #include "eventmanager.h" #include "ircevent.h" +#include "ctcpevent.h" class CoreSession; class CtcpEvent; @@ -63,6 +64,8 @@ protected: Message::Flags msgFlags = Message::None); void parse(IrcEventRawMessage *event, Message::Type msgType); + void parseSimple(IrcEventRawMessage *e, Message::Type messagetype, QByteArray dequotedMessage, CtcpEvent::CtcpType ctcptype, Message::Flags flags); + void parseStandard(IrcEventRawMessage *e, Message::Type messagetype, QByteArray dequotedMessage, CtcpEvent::CtcpType ctcptype, Message::Flags flags); QByteArray lowLevelQuote(const QByteArray &); QByteArray lowLevelDequote(const QByteArray &); @@ -72,6 +75,9 @@ protected: QByteArray pack(const QByteArray &ctcpTag, const QByteArray &message); void packedReply(CoreNetwork *network, const QString &bufname, const QList &replies); +private slots: + void setStandardCtcp(bool enabled); + private: inline QString targetDecode(IrcEventRawMessage *e, const QByteArray &msg) { return coreNetwork(e)->userDecode(e->target(), msg); } diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index dcf48aa7..26a2bbe6 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -337,6 +337,11 @@ void EventStringifier::processIrcEventTopic(IrcEvent *e) .arg(e->nick(), e->params().at(0), e->params().at(1)), QString(), e->params().at(0)); } +void EventStringifier::processIrcEventWallops(IrcEvent *e) +{ + displayMsg(e, Message::Server, tr("[Operwall] %1: %2").arg(e->nick(), e->params().join(" "))); +} + /* RPL_ISUPPORT */ void EventStringifier::processIrcEvent005(IrcEvent *e) @@ -457,10 +462,13 @@ void EventStringifier::processIrcEvent317(IrcEvent *e) if (e->params().count() > 3) { // if we have more then 3 params we have the above mentioned "real life" situation QDateTime loginTime = QDateTime::fromTime_t(e->params()[2].toInt()); - displayMsg(e, Message::Server, tr("[Whois] %1 is logged in since %2").arg(e->params()[0], loginTime.toString())); + displayMsg(e, Message::Server, tr("[Whois] %1 is logged in since %2") + .arg(e->params()[0], QLocale().toString(loginTime, QLocale().dateTimeFormat()))); } + QDateTime idlingSince = e->timestamp().toLocalTime().addSecs(-idleSecs); displayMsg(e, Message::Server, tr("[Whois] %1 is idling for %2 (since %3)") - .arg(e->params()[0], secondsToString(idleSecs), e->timestamp().toLocalTime().addSecs(-idleSecs).toString())); + .arg(e->params()[0], secondsToString(idleSecs), + QLocale().toString(idlingSince, QLocale().dateTimeFormat()))); } @@ -559,7 +567,9 @@ void EventStringifier::processIrcEvent329(IrcEvent *e) return; } QDateTime time = QDateTime::fromTime_t(unixtime); - displayMsg(e, Message::Topic, tr("Channel %1 created on %2").arg(channel, time.toString()), QString(), channel); + displayMsg(e, Message::Topic, tr("Channel %1 created on %2") + .arg(channel, QLocale().toString(time, QLocale().dateTimeFormat())), + QString(), channel); } @@ -602,8 +612,10 @@ void EventStringifier::processIrcEvent333(IrcEvent *e) return; QString channel = e->params().first(); + QDateTime topicSetTime = QDateTime::fromTime_t(e->params()[2].toInt()); displayMsg(e, Message::Topic, tr("Topic set by %1 on %2") - .arg(e->params()[1], QDateTime::fromTime_t(e->params()[2].toInt()).toString()), QString(), channel); + .arg(e->params()[1], + QLocale().toString(topicSetTime, QLocale().dateTimeFormat())), QString(), channel); } diff --git a/src/core/eventstringifier.h b/src/core/eventstringifier.h index 9d86ad01..f3cfd468 100644 --- a/src/core/eventstringifier.h +++ b/src/core/eventstringifier.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -64,6 +64,7 @@ public: Q_INVOKABLE void processIrcEventPong(IrcEvent *event); Q_INVOKABLE void processIrcEventQuit(IrcEvent *event); Q_INVOKABLE void processIrcEventTopic(IrcEvent *event); + Q_INVOKABLE void processIrcEventWallops(IrcEvent *event); Q_INVOKABLE void processIrcEvent005(IrcEvent *event); // RPL_ISUPPORT Q_INVOKABLE void processIrcEvent301(IrcEvent *event); // RPL_AWAY diff --git a/src/core/ircparser.cpp b/src/core/ircparser.cpp index 69603c1c..e69336fb 100644 --- a/src/core/ircparser.cpp +++ b/src/core/ircparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/ircparser.h b/src/core/ircparser.h index 67016c20..04b7d06e 100644 --- a/src/core/ircparser.h +++ b/src/core/ircparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/netsplit.cpp b/src/core/netsplit.cpp index cd38cc77..ce2eef86 100644 --- a/src/core/netsplit.cpp +++ b/src/core/netsplit.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/netsplit.h b/src/core/netsplit.h index da636784..1838c0fc 100644 --- a/src/core/netsplit.h +++ b/src/core/netsplit.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/oidentdconfiggenerator.cpp b/src/core/oidentdconfiggenerator.cpp index 3d9a0550..6a77665e 100644 --- a/src/core/oidentdconfiggenerator.cpp +++ b/src/core/oidentdconfiggenerator.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/oidentdconfiggenerator.h b/src/core/oidentdconfiggenerator.h index 4d097cb0..0612ae0f 100644 --- a/src/core/oidentdconfiggenerator.h +++ b/src/core/oidentdconfiggenerator.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index c13a5aab..39657046 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -279,21 +279,26 @@ void PostgreSqlStorage::setUserSetting(UserId userId, const QString &settingName out << data; QSqlDatabase db = logDb(); - QSqlQuery query(db); - query.prepare(queryString("insert_user_setting")); - query.bindValue(":userid", userId.toInt()); - query.bindValue(":settingname", settingName); - query.bindValue(":settingvalue", rawData); - safeExec(query); + QSqlQuery selectQuery(db); + selectQuery.prepare(queryString("select_user_setting")); + selectQuery.bindValue(":userid", userId.toInt()); + selectQuery.bindValue(":settingname", settingName); + safeExec(selectQuery); - if (query.lastError().isValid()) { - QSqlQuery updateQuery(db); - updateQuery.prepare(queryString("update_user_setting")); - updateQuery.bindValue(":userid", userId.toInt()); - updateQuery.bindValue(":settingname", settingName); - updateQuery.bindValue(":settingvalue", rawData); - safeExec(updateQuery); + QString setQueryString; + if (!selectQuery.first()) { + setQueryString = queryString("insert_user_setting"); + } + else { + setQueryString = queryString("update_user_setting"); } + + QSqlQuery setQuery(db); + setQuery.prepare(setQueryString); + setQuery.bindValue(":userid", userId.toInt()); + setQuery.bindValue(":settingname", settingName); + setQuery.bindValue(":settingvalue", rawData); + safeExec(setQuery); } diff --git a/src/core/postgresqlstorage.h b/src/core/postgresqlstorage.h index 79ec9c58..5be3f80f 100644 --- a/src/core/postgresqlstorage.h +++ b/src/core/postgresqlstorage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/sessionthread.cpp b/src/core/sessionthread.cpp index a56c42b2..e886db5a 100644 --- a/src/core/sessionthread.cpp +++ b/src/core/sessionthread.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,12 +18,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include - +#include "core.h" +#include "coresession.h" +#include "internalpeer.h" +#include "remotepeer.h" #include "sessionthread.h" #include "signalproxy.h" -#include "coresession.h" -#include "core.h" SessionThread::SessionThread(UserId uid, bool restoreState, QObject *parent) : QThread(parent), @@ -72,6 +72,7 @@ void SessionThread::setSessionInitialized() } +// this and the following related methods are executed in the Core thread! void SessionThread::addClient(QObject *peer) { if (isSessionInitialized()) { @@ -85,42 +86,44 @@ void SessionThread::addClient(QObject *peer) void SessionThread::addClientToSession(QObject *peer) { - QIODevice *socket = qobject_cast(peer); - if (socket) { - addRemoteClientToSession(socket); + RemotePeer *remote = qobject_cast(peer); + if (remote) { + addRemoteClientToSession(remote); return; } - SignalProxy *proxy = qobject_cast(peer); - if (proxy) { - addInternalClientToSession(proxy); + InternalPeer *internal = qobject_cast(peer); + if (internal) { + addInternalClientToSession(internal); return; } - qWarning() << "SessionThread::addClient() received neither QIODevice nor SignalProxy as peer!" << peer; + qWarning() << "SessionThread::addClient() received invalid peer!" << peer; } -void SessionThread::addRemoteClientToSession(QIODevice *socket) +void SessionThread::addRemoteClientToSession(RemotePeer *remotePeer) { - socket->setParent(0); - socket->moveToThread(session()->thread()); - emit addRemoteClient(socket); + remotePeer->setParent(0); + remotePeer->moveToThread(session()->thread()); + emit addRemoteClient(remotePeer); } -void SessionThread::addInternalClientToSession(SignalProxy *proxy) +void SessionThread::addInternalClientToSession(InternalPeer *internalPeer) { - emit addInternalClient(proxy); + internalPeer->setParent(0); + internalPeer->moveToThread(session()->thread()); + emit addInternalClient(internalPeer); } void SessionThread::run() { _session = new CoreSession(user(), _restoreState); - connect(this, SIGNAL(addRemoteClient(QIODevice *)), _session, SLOT(addClient(QIODevice *))); - connect(this, SIGNAL(addInternalClient(SignalProxy *)), _session, SLOT(addClient(SignalProxy *))); - connect(_session, SIGNAL(sessionState(const QVariant &)), Core::instance(), SIGNAL(sessionState(const QVariant &))); + connect(this, SIGNAL(addRemoteClient(RemotePeer*)), _session, SLOT(addClient(RemotePeer*))); + connect(this, SIGNAL(addInternalClient(InternalPeer*)), _session, SLOT(addClient(InternalPeer*))); + connect(_session, SIGNAL(sessionState(QVariant)), Core::instance(), SIGNAL(sessionState(QVariant))); emit initialized(); exec(); delete _session; diff --git a/src/core/sessionthread.h b/src/core/sessionthread.h index 75402633..b36b2433 100644 --- a/src/core/sessionthread.h +++ b/src/core/sessionthread.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -27,8 +27,9 @@ #include "types.h" class CoreSession; +class InternalPeer; +class RemotePeer; class QIODevice; -class SignalProxy; class SessionThread : public QThread { @@ -53,8 +54,8 @@ signals: void initialized(); void shutdown(); - void addRemoteClient(QIODevice *); - void addInternalClient(SignalProxy *); + void addRemoteClient(RemotePeer *peer); + void addInternalClient(InternalPeer *peer); private: CoreSession *_session; @@ -65,8 +66,8 @@ private: bool isSessionInitialized(); void addClientToSession(QObject *peer); - void addRemoteClientToSession(QIODevice *socket); - void addInternalClientToSession(SignalProxy *proxy); + void addRemoteClientToSession(RemotePeer *remotePeer); + void addInternalClientToSession(InternalPeer *internalPeer); }; diff --git a/src/core/sqlitestorage.cpp b/src/core/sqlitestorage.cpp index 3df55d54..7dc5fea7 100644 --- a/src/core/sqlitestorage.cpp +++ b/src/core/sqlitestorage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/sqlitestorage.h b/src/core/sqlitestorage.h index fb84b342..ea3c578f 100644 --- a/src/core/sqlitestorage.h +++ b/src/core/sqlitestorage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index e8bfe3b0..ee19c20d 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/sslserver.h b/src/core/sslserver.h index d8a8bba6..dbf28025 100644 --- a/src/core/sslserver.h +++ b/src/core/sslserver.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/storage.cpp b/src/core/storage.cpp index 49c6d337..38cb1004 100644 --- a/src/core/storage.cpp +++ b/src/core/storage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/core/storage.h b/src/core/storage.h index 62de488d..4654dddc 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 86217b8f..8d8dce05 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -182,6 +182,11 @@ if(INDICATEQT_FOUND) include_directories(${INDICATEQT_INCLUDE_DIRS}) endif(INDICATEQT_FOUND) +if(HAVE_NOTIFICATION_CENTER) + set(SOURCES ${SOURCES} osxnotificationbackend.mm) + set(MOC_HDRS ${MOC_HDRS} osxnotificationbackend.h) +endif() + foreach(FORM ${FORMS}) set(FORMPATH ${FORMPATH} ui/${FORM}) endforeach(FORM ${FORMS}) diff --git a/src/qtui/aboutdlg.cpp b/src/qtui/aboutdlg.cpp index 7dabe231..e6721c6b 100644 --- a/src/qtui/aboutdlg.cpp +++ b/src/qtui/aboutdlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -47,7 +47,7 @@ QString AboutDlg::about() const { QString res; res = tr("A modern, distributed IRC Client

" - "©2005-2012 by the Quassel Project
" + "©2005-2013 by the Quassel Project
" "http://quassel-irc.org
" "#quassel on Freenode

" "Quassel IRC is dual-licensed under GPLv2 and " diff --git a/src/qtui/aboutdlg.h b/src/qtui/aboutdlg.h index a2e76ac5..f2f85421 100644 --- a/src/qtui/aboutdlg.h +++ b/src/qtui/aboutdlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/awaylogfilter.cpp b/src/qtui/awaylogfilter.cpp index f916e759..6016c7db 100644 --- a/src/qtui/awaylogfilter.cpp +++ b/src/qtui/awaylogfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/awaylogfilter.h b/src/qtui/awaylogfilter.h index 0c7f7c4e..dccaa833 100644 --- a/src/qtui/awaylogfilter.h +++ b/src/qtui/awaylogfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/awaylogview.cpp b/src/qtui/awaylogview.cpp index e841ffdd..bc98ea93 100644 --- a/src/qtui/awaylogview.cpp +++ b/src/qtui/awaylogview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/awaylogview.h b/src/qtui/awaylogview.h index 0288fbe0..60bae8b6 100644 --- a/src/qtui/awaylogview.h +++ b/src/qtui/awaylogview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/bufferwidget.cpp b/src/qtui/bufferwidget.cpp index b0448e41..d6324201 100644 --- a/src/qtui/bufferwidget.cpp +++ b/src/qtui/bufferwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/bufferwidget.h b/src/qtui/bufferwidget.h index d03327e0..0ad7faf6 100644 --- a/src/qtui/bufferwidget.h +++ b/src/qtui/bufferwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index 8014ca90..97db2203 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/channellistdlg.h b/src/qtui/channellistdlg.h index 74985a23..bb25fb22 100644 --- a/src/qtui/channellistdlg.h +++ b/src/qtui/channellistdlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 85642666..cbbb54bb 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 59f027b0..0bf8ee27 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index addb2f1f..ed931bd3 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatline.h b/src/qtui/chatline.h index 96b0718c..8fde09d6 100644 --- a/src/qtui/chatline.h +++ b/src/qtui/chatline.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatlinemodel.cpp b/src/qtui/chatlinemodel.cpp index 17cdfd3b..42dd04e0 100644 --- a/src/qtui/chatlinemodel.cpp +++ b/src/qtui/chatlinemodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatlinemodel.h b/src/qtui/chatlinemodel.h index e8901e5d..92aadc55 100644 --- a/src/qtui/chatlinemodel.h +++ b/src/qtui/chatlinemodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatlinemodelitem.cpp b/src/qtui/chatlinemodelitem.cpp index 7d23b3d3..480c1b55 100644 --- a/src/qtui/chatlinemodelitem.cpp +++ b/src/qtui/chatlinemodelitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatlinemodelitem.h b/src/qtui/chatlinemodelitem.h index 6e798250..36e659c7 100644 --- a/src/qtui/chatlinemodelitem.h +++ b/src/qtui/chatlinemodelitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatmonitorfilter.cpp b/src/qtui/chatmonitorfilter.cpp index 3622634a..7605d6b9 100644 --- a/src/qtui/chatmonitorfilter.cpp +++ b/src/qtui/chatmonitorfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatmonitorfilter.h b/src/qtui/chatmonitorfilter.h index 52a9c089..3fd5a2d3 100644 --- a/src/qtui/chatmonitorfilter.h +++ b/src/qtui/chatmonitorfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index efa6c49f..2c73e35f 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatmonitorview.h b/src/qtui/chatmonitorview.h index 899758d1..464c6d50 100644 --- a/src/qtui/chatmonitorview.h +++ b/src/qtui/chatmonitorview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 631e10de..2ae3d88b 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatscene.h b/src/qtui/chatscene.h index 4f6fcaec..1de870ef 100644 --- a/src/qtui/chatscene.h +++ b/src/qtui/chatscene.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index ebd81b84..17dc0740 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatview.h b/src/qtui/chatview.h index b1756606..7869ab2d 100644 --- a/src/qtui/chatview.h +++ b/src/qtui/chatview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsearchbar.cpp b/src/qtui/chatviewsearchbar.cpp index 321ebdd7..2e43559c 100644 --- a/src/qtui/chatviewsearchbar.cpp +++ b/src/qtui/chatviewsearchbar.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsearchbar.h b/src/qtui/chatviewsearchbar.h index 1a126908..fe822849 100644 --- a/src/qtui/chatviewsearchbar.h +++ b/src/qtui/chatviewsearchbar.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsearchcontroller.cpp b/src/qtui/chatviewsearchcontroller.cpp index cbbdcbb0..8f3423d5 100644 --- a/src/qtui/chatviewsearchcontroller.cpp +++ b/src/qtui/chatviewsearchcontroller.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsearchcontroller.h b/src/qtui/chatviewsearchcontroller.h index 6d8b8e8a..fc67a76f 100644 --- a/src/qtui/chatviewsearchcontroller.h +++ b/src/qtui/chatviewsearchcontroller.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsettings.cpp b/src/qtui/chatviewsettings.cpp index 06240804..0b50be82 100644 --- a/src/qtui/chatviewsettings.cpp +++ b/src/qtui/chatviewsettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/chatviewsettings.h b/src/qtui/chatviewsettings.h index 723ed9ab..66c0db52 100644 --- a/src/qtui/chatviewsettings.h +++ b/src/qtui/chatviewsettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/columnhandleitem.cpp b/src/qtui/columnhandleitem.cpp index 6f791387..676ce948 100644 --- a/src/qtui/columnhandleitem.cpp +++ b/src/qtui/columnhandleitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/columnhandleitem.h b/src/qtui/columnhandleitem.h index ce15c31c..b9846577 100644 --- a/src/qtui/columnhandleitem.h +++ b/src/qtui/columnhandleitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 97fb6d81..9fbc0741 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconfigwizard.h b/src/qtui/coreconfigwizard.h index e5f66a2c..bed887bd 100644 --- a/src/qtui/coreconfigwizard.h +++ b/src/qtui/coreconfigwizard.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index d28971ef..fa57976e 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconnectdlg.h b/src/qtui/coreconnectdlg.h index cea9304e..a458578a 100644 --- a/src/qtui/coreconnectdlg.h +++ b/src/qtui/coreconnectdlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconnectionstatuswidget.cpp b/src/qtui/coreconnectionstatuswidget.cpp index f43d6ebe..ac4642ee 100644 --- a/src/qtui/coreconnectionstatuswidget.cpp +++ b/src/qtui/coreconnectionstatuswidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreconnectionstatuswidget.h b/src/qtui/coreconnectionstatuswidget.h index e204b9c2..f6432e66 100644 --- a/src/qtui/coreconnectionstatuswidget.h +++ b/src/qtui/coreconnectionstatuswidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index 2ab087e5..0ab8a814 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/coreinfodlg.h b/src/qtui/coreinfodlg.h index b1783a90..24ba25fa 100644 --- a/src/qtui/coreinfodlg.h +++ b/src/qtui/coreinfodlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugbufferviewoverlay.cpp b/src/qtui/debugbufferviewoverlay.cpp index e1430f26..81372dcd 100644 --- a/src/qtui/debugbufferviewoverlay.cpp +++ b/src/qtui/debugbufferviewoverlay.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugbufferviewoverlay.h b/src/qtui/debugbufferviewoverlay.h index 3ce70e20..7703fb8a 100644 --- a/src/qtui/debugbufferviewoverlay.h +++ b/src/qtui/debugbufferviewoverlay.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugconsole.cpp b/src/qtui/debugconsole.cpp index 59851808..66588ce5 100644 --- a/src/qtui/debugconsole.cpp +++ b/src/qtui/debugconsole.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugconsole.h b/src/qtui/debugconsole.h index 106db0bb..c2050922 100644 --- a/src/qtui/debugconsole.h +++ b/src/qtui/debugconsole.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debuglogwidget.cpp b/src/qtui/debuglogwidget.cpp index eeffe7c2..90716d54 100644 --- a/src/qtui/debuglogwidget.cpp +++ b/src/qtui/debuglogwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debuglogwidget.h b/src/qtui/debuglogwidget.h index 61e17a98..513c674b 100644 --- a/src/qtui/debuglogwidget.h +++ b/src/qtui/debuglogwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugmessagemodelfilter.cpp b/src/qtui/debugmessagemodelfilter.cpp index 9074b165..655fd00e 100644 --- a/src/qtui/debugmessagemodelfilter.cpp +++ b/src/qtui/debugmessagemodelfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/debugmessagemodelfilter.h b/src/qtui/debugmessagemodelfilter.h index 60f5bd06..b8fbe04e 100644 --- a/src/qtui/debugmessagemodelfilter.h +++ b/src/qtui/debugmessagemodelfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index bfc0a226..c246f2e7 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/inputwidget.h b/src/qtui/inputwidget.h index dac21789..5fa41930 100644 --- a/src/qtui/inputwidget.h +++ b/src/qtui/inputwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/ircconnectionwizard.cpp b/src/qtui/ircconnectionwizard.cpp index de6d0c6e..2665f015 100644 --- a/src/qtui/ircconnectionwizard.cpp +++ b/src/qtui/ircconnectionwizard.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/ircconnectionwizard.h b/src/qtui/ircconnectionwizard.h index a81e5fa6..c545536e 100644 --- a/src/qtui/ircconnectionwizard.h +++ b/src/qtui/ircconnectionwizard.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/knotificationbackend.cpp b/src/qtui/knotificationbackend.cpp index da55338d..4c508ecd 100644 --- a/src/qtui/knotificationbackend.cpp +++ b/src/qtui/knotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/knotificationbackend.h b/src/qtui/knotificationbackend.h index b9b387d4..394cdc98 100644 --- a/src/qtui/knotificationbackend.h +++ b/src/qtui/knotificationbackend.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/legacysystemtray.cpp b/src/qtui/legacysystemtray.cpp index 280c7dd2..a3e706aa 100644 --- a/src/qtui/legacysystemtray.cpp +++ b/src/qtui/legacysystemtray.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index 6fec76c4..370b1ab1 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/mainpage.cpp b/src/qtui/mainpage.cpp index 702e60ef..d32e49ba 100644 --- a/src/qtui/mainpage.cpp +++ b/src/qtui/mainpage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/mainpage.h b/src/qtui/mainpage.h index 1e37a5ba..290f0121 100644 --- a/src/qtui/mainpage.h +++ b/src/qtui/mainpage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index a3048b22..bf7cda34 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -108,6 +108,10 @@ #include "indicatornotificationbackend.h" #endif +#ifdef HAVE_NOTIFICATION_CENTER + #include "osxnotificationbackend.h" +#endif + #include "settingspages/aliasessettingspage.h" #include "settingspages/appearancesettingspage.h" #include "settingspages/backlogsettingspage.h" @@ -218,6 +222,10 @@ void MainWin::init() QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this)); #endif +#ifdef HAVE_NOTIFICATION_CENTER + QtUi::registerNotificationBackend(new OSXNotificationBackend(this)); +#endif + // we assume that at this point, all configurable actions are defined! QtUi::loadShortcuts(); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 07e4e634..9104654e 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/markerlineitem.cpp b/src/qtui/markerlineitem.cpp index dc3aee37..96290cec 100644 --- a/src/qtui/markerlineitem.cpp +++ b/src/qtui/markerlineitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/markerlineitem.h b/src/qtui/markerlineitem.h index 79fb7201..b739fae5 100644 --- a/src/qtui/markerlineitem.h +++ b/src/qtui/markerlineitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/monoapplication.cpp b/src/qtui/monoapplication.cpp index 1ad4f034..69ca4482 100644 --- a/src/qtui/monoapplication.cpp +++ b/src/qtui/monoapplication.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,6 +24,8 @@ #include "core.h" #include "qtui.h" +class InternalPeer; + MonolithicApplication::MonolithicApplication(int &argc, char **argv) : QtUiApplication(argc, argv), _internalInitDone(false) @@ -43,6 +45,7 @@ bool MonolithicApplication::init() connect(Client::coreConnection(), SIGNAL(startInternalCore()), SLOT(startInternalCore())); + // FIXME what's this for? if (isOptionSet("port")) { startInternalCore(); } @@ -67,6 +70,6 @@ void MonolithicApplication::startInternalCore() } Core *core = Core::instance(); CoreConnection *connection = Client::coreConnection(); - connect(connection, SIGNAL(connectToInternalCore(SignalProxy *)), core, SLOT(setupInternalClientSession(SignalProxy *))); - connect(core, SIGNAL(sessionState(const QVariant &)), connection, SLOT(internalSessionStateReceived(const QVariant &))); + connect(connection, SIGNAL(connectToInternalCore(InternalPeer*)), core, SLOT(setupInternalClientSession(InternalPeer*))); + connect(core, SIGNAL(sessionState(QVariant)), connection, SLOT(internalSessionStateReceived(QVariant))); } diff --git a/src/qtui/monoapplication.h b/src/qtui/monoapplication.h index 198f07df..1ef8254c 100644 --- a/src/qtui/monoapplication.h +++ b/src/qtui/monoapplication.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/msgprocessorstatuswidget.cpp b/src/qtui/msgprocessorstatuswidget.cpp index 0c8dfe00..8c719d8e 100644 --- a/src/qtui/msgprocessorstatuswidget.cpp +++ b/src/qtui/msgprocessorstatuswidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/msgprocessorstatuswidget.h b/src/qtui/msgprocessorstatuswidget.h index 10c74fdb..e1a73076 100644 --- a/src/qtui/msgprocessorstatuswidget.h +++ b/src/qtui/msgprocessorstatuswidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp index 0b67a9e6..674e89d1 100644 --- a/src/qtui/nicklistwidget.cpp +++ b/src/qtui/nicklistwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/nicklistwidget.h b/src/qtui/nicklistwidget.h index f144e778..15b5a585 100644 --- a/src/qtui/nicklistwidget.h +++ b/src/qtui/nicklistwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/osxnotificationbackend.h b/src/qtui/osxnotificationbackend.h new file mode 100644 index 00000000..55a8d58e --- /dev/null +++ b/src/qtui/osxnotificationbackend.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2005-2012 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef OSXNOTIFICATIONBACKEND_H_ +#define OSXNOTIFICATIONBACKEND_H_ + +#include "abstractnotificationbackend.h" +#include "settingspage.h" + +class OSXNotificationBackend : public AbstractNotificationBackend +{ + Q_OBJECT + +public: + OSXNotificationBackend(QObject *parent = 0); + + void notify(const Notification &); + void close(uint notificationId); + virtual SettingsPage *createConfigWidget() const; + +private slots: + void enabledChanged(const QVariant &value); + +private: + class ConfigWidget; + + bool _enabled; +}; + +class OSXNotificationBackend::ConfigWidget : public SettingsPage +{ + Q_OBJECT + +public: + ConfigWidget(QWidget *parent = 0); + void save(); + void load(); + bool hasDefaults() const; + void defaults(); + +private slots: + void widgetChanged(); + +private: + QCheckBox *_enabledBox; + bool _enabled; +}; + +#endif // OSXNOTIFICATIONBACKEND_H_ diff --git a/src/qtui/osxnotificationbackend.mm b/src/qtui/osxnotificationbackend.mm new file mode 100644 index 00000000..738ee265 --- /dev/null +++ b/src/qtui/osxnotificationbackend.mm @@ -0,0 +1,126 @@ +/*************************************************************************** + * Copyright (C) 2005-2012 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "clientsettings.h" +#include "osxnotificationbackend.h" + +#include +#include + +#import + +namespace { + +void SendNotificationCenterMessage(NSString* title, NSString* subtitle) { + NSUserNotificationCenter* center = + [NSUserNotificationCenter defaultUserNotificationCenter]; + NSUserNotification* notification = + [[NSUserNotification alloc] init]; + + [notification setTitle: title]; + [notification setSubtitle: subtitle]; + + [center deliverNotification: notification]; + + [notification release]; +} + +} + +OSXNotificationBackend::OSXNotificationBackend(QObject *parent) + : AbstractNotificationBackend(parent), + _enabled(true) +{ + NotificationSettings notificationSettings; + notificationSettings.initAndNotify("OSXNotification/Enabled", this, SLOT(enabledChanged(QVariant)), true); +} + +void OSXNotificationBackend::enabledChanged(const QVariant &value) +{ + _enabled = value.toBool(); +} + +void OSXNotificationBackend::notify(const Notification ¬ification) +{ + if (!_enabled) + { + return; + } + + NSString* message = [[NSString alloc] initWithUTF8String:notification.sender.toUtf8().constData()]; + NSString* summary = [[NSString alloc] initWithUTF8String:notification.message.toUtf8().constData()]; + + SendNotificationCenterMessage(message, summary); + + [message release]; + [summary release]; +} + +void OSXNotificationBackend::close(uint notificationId) +{ +} + +SettingsPage *OSXNotificationBackend::createConfigWidget() const +{ + return new ConfigWidget(); +} + +OSXNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) + : SettingsPage("Internal", "OSXNotification", parent) +{ + _enabledBox = new QCheckBox(tr("Show OS X notifications")); + connect(_enabledBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); + QHBoxLayout *layout = new QHBoxLayout(this); + layout->addWidget(_enabledBox); +} + +void OSXNotificationBackend::ConfigWidget::widgetChanged() +{ + bool changed = (_enabled != _enabledBox->isChecked()); + if (changed != hasChanged()) + setChangedState(changed); +} + +bool OSXNotificationBackend::ConfigWidget::hasDefaults() const +{ + return true; +} + +void OSXNotificationBackend::ConfigWidget::defaults() +{ + _enabledBox->setChecked(true); + widgetChanged(); +} + +void OSXNotificationBackend::ConfigWidget::load() +{ + NotificationSettings s; + _enabled = s.value("OSXNotification/Enabled", false).toBool(); + _enabledBox->setChecked(_enabled); + setChangedState(false); +} + + +void OSXNotificationBackend::ConfigWidget::save() +{ + NotificationSettings s; + s.setValue("OSXNotification/Enabled", _enabledBox->isChecked()); + load(); +} diff --git a/src/qtui/phononnotificationbackend.cpp b/src/qtui/phononnotificationbackend.cpp index 72270a8c..bcc7c76d 100644 --- a/src/qtui/phononnotificationbackend.cpp +++ b/src/qtui/phononnotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,7 +20,8 @@ #include -#include +#include +#include #include "phononnotificationbackend.h" @@ -33,6 +34,7 @@ PhononNotificationBackend::PhononNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent), _media(0) { + _audioAvailable = !Phonon::BackendCapabilities::availableAudioOutputDevices().isEmpty(); NotificationSettings notificationSettings; _enabled = notificationSettings.value("Phonon/Enabled", true).toBool(); createMediaObject(notificationSettings.value("Phonon/AudioFile", QString()).toString()); @@ -51,9 +53,13 @@ PhononNotificationBackend::~PhononNotificationBackend() void PhononNotificationBackend::notify(const Notification ¬ification) { - if (_enabled && _media && (notification.type == Highlight || notification.type == PrivMsg)) { - _media->stop(); - _media->play(); + if (_enabled && (notification.type == Highlight || notification.type == PrivMsg)) { + if (_audioAvailable) { + _media->stop(); + _media->play(); + } + else + QApplication::beep(); } } @@ -92,8 +98,7 @@ void PhononNotificationBackend::createMediaObject(const QString &file) return; } - _media = Phonon::createPlayer(Phonon::NotificationCategory, - Phonon::MediaSource(file)); + _media = Phonon::createPlayer(Phonon::NotificationCategory, Phonon::MediaSource(file)); } @@ -104,6 +109,7 @@ PhononNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) audioPreview(0) { ui.setupUi(this); + _audioAvailable = !Phonon::BackendCapabilities::availableAudioOutputDevices().isEmpty(); ui.enabled->setIcon(SmallIcon("media-playback-start")); ui.play->setIcon(SmallIcon("media-playback-start")); ui.open->setIcon(SmallIcon("document-open")); @@ -122,12 +128,20 @@ PhononNotificationBackend::ConfigWidget::~ConfigWidget() void PhononNotificationBackend::ConfigWidget::widgetChanged() { - ui.play->setEnabled(ui.enabled->isChecked() && !ui.filename->text().isEmpty()); + if (! _audioAvailable) { + ui.play->setEnabled(ui.enabled->isChecked()); + ui.open->setEnabled(false); + ui.filename->setEnabled(false); + ui.filename->setText(QString()); + } + else { + ui.play->setEnabled(ui.enabled->isChecked() && !ui.filename->text().isEmpty()); - bool changed = (enabled != ui.enabled->isChecked() - || filename != ui.filename->text()); + bool changed = (enabled != ui.enabled->isChecked() || filename != ui.filename->text()); - if (changed != hasChanged()) setChangedState(changed); + if (changed != hasChanged()) + setChangedState(changed); + } } @@ -180,12 +194,15 @@ void PhononNotificationBackend::ConfigWidget::on_open_clicked() void PhononNotificationBackend::ConfigWidget::on_play_clicked() { - if (!ui.filename->text().isEmpty()) { - if (audioPreview) - delete audioPreview; + if (_audioAvailable) { + if (!ui.filename->text().isEmpty()) { + if (audioPreview) + delete audioPreview; - audioPreview = Phonon::createPlayer(Phonon::NotificationCategory, - Phonon::MediaSource(ui.filename->text())); - audioPreview->play(); + audioPreview = Phonon::createPlayer(Phonon::NotificationCategory, Phonon::MediaSource(ui.filename->text())); + audioPreview->play(); + } } + else + QApplication::beep(); } diff --git a/src/qtui/phononnotificationbackend.h b/src/qtui/phononnotificationbackend.h index 936aa105..b6ae1bea 100644 --- a/src/qtui/phononnotificationbackend.h +++ b/src/qtui/phononnotificationbackend.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -49,6 +49,7 @@ private: class ConfigWidget; bool _enabled; + bool _audioAvailable; Phonon::MediaObject *_media; }; @@ -75,6 +76,7 @@ private: Ui::PhononNotificationConfigWidget ui; bool enabled; + bool _audioAvailable; QString filename; Phonon::MediaObject *audioPreview; }; diff --git a/src/qtui/qtui.cpp b/src/qtui/qtui.cpp index 05f73634..9c7cbbf8 100644 --- a/src/qtui/qtui.cpp +++ b/src/qtui/qtui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtui.h b/src/qtui/qtui.h index bd11f9e5..8ad7aa3c 100644 --- a/src/qtui/qtui.h +++ b/src/qtui/qtui.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index fc94e973..e13fa0ff 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuiapplication.h b/src/qtui/qtuiapplication.h index 557379f1..6f4a7e26 100644 --- a/src/qtui/qtuiapplication.h +++ b/src/qtui/qtuiapplication.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index cd41c1af..679705c3 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuimessageprocessor.h b/src/qtui/qtuimessageprocessor.h index 8e178be1..3eab6372 100644 --- a/src/qtui/qtuimessageprocessor.h +++ b/src/qtui/qtuimessageprocessor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuisettings.cpp b/src/qtui/qtuisettings.cpp index 045b2b39..5b1012e0 100644 --- a/src/qtui/qtuisettings.cpp +++ b/src/qtui/qtuisettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuisettings.h b/src/qtui/qtuisettings.h index ed93b040..8335e836 100644 --- a/src/qtui/qtuisettings.h +++ b/src/qtui/qtuisettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuistyle.cpp b/src/qtui/qtuistyle.cpp index 5769b4fa..11f6c43a 100644 --- a/src/qtui/qtuistyle.cpp +++ b/src/qtui/qtuistyle.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/qtuistyle.h b/src/qtui/qtuistyle.h index dbc9c343..f6651f99 100644 --- a/src/qtui/qtuistyle.h +++ b/src/qtui/qtuistyle.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 4dbfae20..11a8bcaa 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingsdlg.h b/src/qtui/settingsdlg.h index 950e8089..82cefdb9 100644 --- a/src/qtui/settingsdlg.h +++ b/src/qtui/settingsdlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspagedlg.cpp b/src/qtui/settingspagedlg.cpp index 7cbbdbe4..b978df6e 100644 --- a/src/qtui/settingspagedlg.cpp +++ b/src/qtui/settingspagedlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspagedlg.h b/src/qtui/settingspagedlg.h index fb62d5f2..471bbadd 100644 --- a/src/qtui/settingspagedlg.h +++ b/src/qtui/settingspagedlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp index aed4c1a7..a63ad067 100644 --- a/src/qtui/settingspages/aliasesmodel.cpp +++ b/src/qtui/settingspages/aliasesmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index 0e18ed7e..a7b85629 100644 --- a/src/qtui/settingspages/aliasesmodel.h +++ b/src/qtui/settingspages/aliasesmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/aliasessettingspage.cpp b/src/qtui/settingspages/aliasessettingspage.cpp index 49b3a813..3a9794ba 100644 --- a/src/qtui/settingspages/aliasessettingspage.cpp +++ b/src/qtui/settingspages/aliasessettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/aliasessettingspage.h b/src/qtui/settingspages/aliasessettingspage.h index ce9c2075..0201f514 100644 --- a/src/qtui/settingspages/aliasessettingspage.h +++ b/src/qtui/settingspages/aliasessettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index ab6276ad..1a664762 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/appearancesettingspage.h b/src/qtui/settingspages/appearancesettingspage.h index 77828259..c026a8ff 100644 --- a/src/qtui/settingspages/appearancesettingspage.h +++ b/src/qtui/settingspages/appearancesettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/backlogsettingspage.cpp b/src/qtui/settingspages/backlogsettingspage.cpp index 7d3d90a4..8afcbbcc 100644 --- a/src/qtui/settingspages/backlogsettingspage.cpp +++ b/src/qtui/settingspages/backlogsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/backlogsettingspage.h b/src/qtui/settingspages/backlogsettingspage.h index 3df67915..15f08b96 100644 --- a/src/qtui/settingspages/backlogsettingspage.h +++ b/src/qtui/settingspages/backlogsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index bb3c99f3..f2ef7a17 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/bufferviewsettingspage.h b/src/qtui/settingspages/bufferviewsettingspage.h index e52e8de8..880d5382 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.h +++ b/src/qtui/settingspages/bufferviewsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index c27cbad0..67c4b0b2 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/chatmonitorsettingspage.h b/src/qtui/settingspages/chatmonitorsettingspage.h index be15f71d..26e22fc6 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.h +++ b/src/qtui/settingspages/chatmonitorsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/chatviewsettingspage.cpp b/src/qtui/settingspages/chatviewsettingspage.cpp index b45f7f04..afbe4444 100644 --- a/src/qtui/settingspages/chatviewsettingspage.cpp +++ b/src/qtui/settingspages/chatviewsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/chatviewsettingspage.h b/src/qtui/settingspages/chatviewsettingspage.h index 5500a84c..0ec253fc 100644 --- a/src/qtui/settingspages/chatviewsettingspage.h +++ b/src/qtui/settingspages/chatviewsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/connectionsettingspage.cpp b/src/qtui/settingspages/connectionsettingspage.cpp index edec88a1..4fcc70a6 100644 --- a/src/qtui/settingspages/connectionsettingspage.cpp +++ b/src/qtui/settingspages/connectionsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -85,6 +85,8 @@ QVariant ConnectionSettingsPage::loadAutoWidgetValue(const QString &widgetName) return config->autoWhoNickLimit(); if (widgetName == "autoWhoDelay") return config->autoWhoDelay(); + if (widgetName == "standardCtcp") + return config->standardCtcp(); return SettingsPage::loadAutoWidgetValue(widgetName); } @@ -109,6 +111,8 @@ void ConnectionSettingsPage::saveAutoWidgetValue(const QString &widgetName, cons config->requestSetAutoWhoNickLimit(value.toInt()); else if (widgetName == "autoWhoDelay") config->requestSetAutoWhoDelay(value.toInt()); + else if (widgetName == "standardCtcp") + config->requestSetStandardCtcp(value.toBool()); else SettingsPage::saveAutoWidgetValue(widgetName, value); diff --git a/src/qtui/settingspages/connectionsettingspage.h b/src/qtui/settingspages/connectionsettingspage.h index e3bb7ddb..e4170197 100644 --- a/src/qtui/settingspages/connectionsettingspage.h +++ b/src/qtui/settingspages/connectionsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/connectionsettingspage.ui b/src/qtui/settingspages/connectionsettingspage.ui index 484454c3..e1ca2480 100644 --- a/src/qtui/settingspages/connectionsettingspage.ui +++ b/src/qtui/settingspages/connectionsettingspage.ui @@ -244,6 +244,16 @@ + + + + Enable standard-compliant CTCP behavior + + + + + + diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index 863b9256..87099866 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/coreaccountsettingspage.h b/src/qtui/settingspages/coreaccountsettingspage.h index f9a0c648..831ab5ee 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.h +++ b/src/qtui/settingspages/coreaccountsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/coreconnectionsettingspage.cpp b/src/qtui/settingspages/coreconnectionsettingspage.cpp index 4113a4e7..176386ad 100644 --- a/src/qtui/settingspages/coreconnectionsettingspage.cpp +++ b/src/qtui/settingspages/coreconnectionsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/coreconnectionsettingspage.h b/src/qtui/settingspages/coreconnectionsettingspage.h index 91f27d17..d1be23b8 100644 --- a/src/qtui/settingspages/coreconnectionsettingspage.h +++ b/src/qtui/settingspages/coreconnectionsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/highlightsettingspage.cpp b/src/qtui/settingspages/highlightsettingspage.cpp index d9e3d160..a915504d 100644 --- a/src/qtui/settingspages/highlightsettingspage.cpp +++ b/src/qtui/settingspages/highlightsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/highlightsettingspage.h b/src/qtui/settingspages/highlightsettingspage.h index 244eef77..3fd382cc 100644 --- a/src/qtui/settingspages/highlightsettingspage.h +++ b/src/qtui/settingspages/highlightsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/identitiessettingspage.cpp b/src/qtui/settingspages/identitiessettingspage.cpp index 198b8ba4..094e9e00 100644 --- a/src/qtui/settingspages/identitiessettingspage.cpp +++ b/src/qtui/settingspages/identitiessettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/identitiessettingspage.h b/src/qtui/settingspages/identitiessettingspage.h index f8861ce1..4ae1e6d8 100644 --- a/src/qtui/settingspages/identitiessettingspage.h +++ b/src/qtui/settingspages/identitiessettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 38bbd112..f670753f 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -134,6 +134,7 @@ void IdentityEditWidget::displayIdentity(CertIdentity *id, CertIdentity *saveId) void IdentityEditWidget::saveToIdentity(CertIdentity *id) { + QRegExp linebreaks = QRegExp("[\\r\\n]"); id->setRealName(ui.realName->text()); QStringList nicks; for (int i = 0; i < ui.nicknameList->count(); i++) { @@ -142,19 +143,19 @@ void IdentityEditWidget::saveToIdentity(CertIdentity *id) id->setNicks(nicks); id->setAwayNick(ui.awayNick->text()); id->setAwayNickEnabled(true); - id->setAwayReason(ui.awayReason->text()); + id->setAwayReason(ui.awayReason->text().remove(linebreaks)); id->setAwayReasonEnabled(true); id->setAutoAwayEnabled(ui.autoAwayEnabled->isChecked()); id->setAutoAwayTime(ui.autoAwayTime->value()); - id->setAutoAwayReason(ui.autoAwayReason->text()); + id->setAutoAwayReason(ui.autoAwayReason->text().remove(linebreaks)); id->setAutoAwayReasonEnabled(ui.autoAwayReasonEnabled->isChecked()); id->setDetachAwayEnabled(ui.detachAwayEnabled->isChecked()); - id->setDetachAwayReason(ui.detachAwayReason->text()); + id->setDetachAwayReason(ui.detachAwayReason->text().remove(linebreaks)); id->setDetachAwayReasonEnabled(true); id->setIdent(ui.ident->text()); - id->setKickReason(ui.kickReason->text()); - id->setPartReason(ui.partReason->text()); - id->setQuitReason(ui.quitReason->text()); + id->setKickReason(ui.kickReason->text().remove(linebreaks)); + id->setPartReason(ui.partReason->text().remove(linebreaks)); + id->setQuitReason(ui.quitReason->text().remove(linebreaks)); #ifdef HAVE_SSL id->setSslKey(QSslKey(ui.keyTypeLabel->property("sslKey").toByteArray(), (QSsl::KeyAlgorithm)(ui.keyTypeLabel->property("sslKeyType").toInt()))); id->setSslCert(QSslCertificate(ui.certOrgLabel->property("sslCert").toByteArray())); diff --git a/src/qtui/settingspages/identityeditwidget.h b/src/qtui/settingspages/identityeditwidget.h index d60199c4..75db71f2 100644 --- a/src/qtui/settingspages/identityeditwidget.h +++ b/src/qtui/settingspages/identityeditwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/ignorelistmodel.cpp b/src/qtui/settingspages/ignorelistmodel.cpp index d9040095..876a141e 100644 --- a/src/qtui/settingspages/ignorelistmodel.cpp +++ b/src/qtui/settingspages/ignorelistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/ignorelistmodel.h b/src/qtui/settingspages/ignorelistmodel.h index 6e36c7bf..8940dbf6 100644 --- a/src/qtui/settingspages/ignorelistmodel.h +++ b/src/qtui/settingspages/ignorelistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/ignorelistsettingspage.cpp b/src/qtui/settingspages/ignorelistsettingspage.cpp index 832ddd93..d37ae94c 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.cpp +++ b/src/qtui/settingspages/ignorelistsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/ignorelistsettingspage.h b/src/qtui/settingspages/ignorelistsettingspage.h index 1a01a50e..fc9931eb 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.h +++ b/src/qtui/settingspages/ignorelistsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/inputwidgetsettingspage.cpp b/src/qtui/settingspages/inputwidgetsettingspage.cpp index 93a10d2c..737ae132 100644 --- a/src/qtui/settingspages/inputwidgetsettingspage.cpp +++ b/src/qtui/settingspages/inputwidgetsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/inputwidgetsettingspage.h b/src/qtui/settingspages/inputwidgetsettingspage.h index d301336e..d866b7cc 100644 --- a/src/qtui/settingspages/inputwidgetsettingspage.h +++ b/src/qtui/settingspages/inputwidgetsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/itemviewsettingspage.cpp b/src/qtui/settingspages/itemviewsettingspage.cpp index ae1dd11a..4ab43a43 100644 --- a/src/qtui/settingspages/itemviewsettingspage.cpp +++ b/src/qtui/settingspages/itemviewsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/itemviewsettingspage.h b/src/qtui/settingspages/itemviewsettingspage.h index 6f597adb..8a9db1c9 100644 --- a/src/qtui/settingspages/itemviewsettingspage.h +++ b/src/qtui/settingspages/itemviewsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/keysequencewidget.cpp b/src/qtui/settingspages/keysequencewidget.cpp index 6e4fea6b..88d600ed 100644 --- a/src/qtui/settingspages/keysequencewidget.cpp +++ b/src/qtui/settingspages/keysequencewidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This class has been inspired by KDE's KKeySequenceWidget and uses * diff --git a/src/qtui/settingspages/keysequencewidget.h b/src/qtui/settingspages/keysequencewidget.h index 25971e70..30075783 100644 --- a/src/qtui/settingspages/keysequencewidget.h +++ b/src/qtui/settingspages/keysequencewidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This class has been inspired by KDE's KKeySequenceWidget and uses * diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index 3aeaf708..4d66b6f6 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -35,12 +35,20 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("Networks"), parent) +#ifdef HAVE_SSL + , _cid(0) +#endif { ui.setupUi(this); // hide SASL options for older cores if (!(Client::coreFeatures() & Quassel::SaslAuthentication)) ui.sasl->hide(); + if (!(Client::coreFeatures() & Quassel::SaslExternal)) + ui.saslExtInfo->hide(); +#ifndef HAVE_SSL + ui.saslExtInfo->hide(); +#endif // set up icons ui.renameNetwork->setIcon(SmallIcon("edit-rename")); @@ -469,6 +477,20 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) _ignoreWidgetChanges = true; if (id != 0) { NetworkInfo info = networkInfos[id]; + +#ifdef HAVE_SSL + // this is only needed when the core supports SASL EXTERNAL + if (Client::coreFeatures() & Quassel::SaslExternal) { + if (_cid) { + disconnect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + delete _cid; + } + _cid = new CertIdentity(*Client::identity(info.identity), this); + _cid->enableEditSsl(true); + connect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + } +#endif + ui.identityList->setCurrentIndex(ui.identityList->findData(info.identity.toInt())); ui.serverList->clear(); foreach(Network::Server server, info.serverList) { @@ -506,6 +528,12 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) } else { // just clear widgets +#ifdef HAVE_SSL + if (_cid) { + disconnect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + delete _cid; + } +#endif ui.identityList->setCurrentIndex(-1); ui.serverList->clear(); ui.performEdit->clear(); @@ -549,6 +577,26 @@ void NetworksSettingsPage::saveToNetworkInfo(NetworkInfo &info) } +#ifdef HAVE_SSL +void NetworksSettingsPage::sslUpdated() +{ + if (_cid && !_cid->sslKey().isNull()) { + ui.saslAccount->setDisabled(true); + ui.saslAccountLabel->setDisabled(true); + ui.saslPassword->setDisabled(true); + ui.saslPasswordLabel->setDisabled(true); + ui.saslExtInfo->setHidden(false); + } else { + ui.saslAccount->setDisabled(false); + ui.saslAccountLabel->setDisabled(false); + ui.saslPassword->setDisabled(false); + ui.saslPasswordLabel->setDisabled(false); + ui.saslExtInfo->setHidden(true); + } +} +#endif + + /*** Network list ***/ void NetworksSettingsPage::on_networkList_itemSelectionChanged() diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index a6588842..ef9f8835 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,6 +25,7 @@ #include "network.h" #include "settingspage.h" +#include "clientidentity.h" #include "ui_networkssettingspage.h" #include "ui_networkadddlg.h" @@ -65,6 +66,10 @@ private slots: void clientIdentityRemoved(IdentityId); void clientIdentityUpdated(); +#ifdef HAVE_SSL + void sslUpdated(); +#endif + void on_networkList_itemSelectionChanged(); void on_addNetwork_clicked(); void on_deleteNetwork_clicked(); @@ -86,6 +91,9 @@ private: NetworkId currentId; QHash networkInfos; bool _ignoreWidgetChanges; +#ifdef HAVE_SSL + CertIdentity *_cid; +#endif QPixmap connectedIcon, connectingIcon, disconnectedIcon; diff --git a/src/qtui/settingspages/networkssettingspage.ui b/src/qtui/settingspages/networkssettingspage.ui index 7665e101..7ef574ac 100644 --- a/src/qtui/settingspages/networkssettingspage.ui +++ b/src/qtui/settingspages/networkssettingspage.ui @@ -6,8 +6,8 @@ 0 0 - 515 - 503 + 510 + 505 @@ -607,7 +607,7 @@ Note that Quassel IRC automatically rejoins channels, so /join will rarely be ne - + true @@ -617,7 +617,7 @@ Note that Quassel IRC automatically rejoins channels, so /join will rarely be ne - + true @@ -629,6 +629,16 @@ Note that Quassel IRC automatically rejoins channels, so /join will rarely be ne + + + + <html><head/><body><p><span style=" font-weight:600;">Note:</span> because the identity has an ssl certificate set, SASL EXTERNAL will be used.</p></body></html> + + + true + + + diff --git a/src/qtui/settingspages/notificationssettingspage.cpp b/src/qtui/settingspages/notificationssettingspage.cpp index 7e587fb5..2a79f675 100644 --- a/src/qtui/settingspages/notificationssettingspage.cpp +++ b/src/qtui/settingspages/notificationssettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/notificationssettingspage.h b/src/qtui/settingspages/notificationssettingspage.h index c1dca615..8fd6ae19 100644 --- a/src/qtui/settingspages/notificationssettingspage.h +++ b/src/qtui/settingspages/notificationssettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/previewbufferview.cpp b/src/qtui/settingspages/previewbufferview.cpp index 309a1c2d..76e029b3 100644 --- a/src/qtui/settingspages/previewbufferview.cpp +++ b/src/qtui/settingspages/previewbufferview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/previewbufferview.h b/src/qtui/settingspages/previewbufferview.h index 03ecf227..6f762b5a 100644 --- a/src/qtui/settingspages/previewbufferview.h +++ b/src/qtui/settingspages/previewbufferview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/shortcutsmodel.cpp b/src/qtui/settingspages/shortcutsmodel.cpp index 2ee0eee8..47679839 100644 --- a/src/qtui/settingspages/shortcutsmodel.cpp +++ b/src/qtui/settingspages/shortcutsmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/shortcutsmodel.h b/src/qtui/settingspages/shortcutsmodel.h index b6a0df30..dfd6c8a6 100644 --- a/src/qtui/settingspages/shortcutsmodel.h +++ b/src/qtui/settingspages/shortcutsmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/shortcutssettingspage.cpp b/src/qtui/settingspages/shortcutssettingspage.cpp index a9bfaf8c..40fd8df4 100644 --- a/src/qtui/settingspages/shortcutssettingspage.cpp +++ b/src/qtui/settingspages/shortcutssettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/shortcutssettingspage.h b/src/qtui/settingspages/shortcutssettingspage.h index 8a6fcfec..9eb9b526 100644 --- a/src/qtui/settingspages/shortcutssettingspage.h +++ b/src/qtui/settingspages/shortcutssettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/topicwidgetsettingspage.cpp b/src/qtui/settingspages/topicwidgetsettingspage.cpp index 2e71dde8..8a9584e8 100644 --- a/src/qtui/settingspages/topicwidgetsettingspage.cpp +++ b/src/qtui/settingspages/topicwidgetsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/settingspages/topicwidgetsettingspage.h b/src/qtui/settingspages/topicwidgetsettingspage.h index c4f48ef3..e5827a86 100644 --- a/src/qtui/settingspages/topicwidgetsettingspage.h +++ b/src/qtui/settingspages/topicwidgetsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/simplenetworkeditor.cpp b/src/qtui/simplenetworkeditor.cpp index 1c0d7ec9..1591e75f 100644 --- a/src/qtui/simplenetworkeditor.cpp +++ b/src/qtui/simplenetworkeditor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/simplenetworkeditor.h b/src/qtui/simplenetworkeditor.h index 5db021f3..aaca86ae 100644 --- a/src/qtui/simplenetworkeditor.h +++ b/src/qtui/simplenetworkeditor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/sslinfodlg.cpp b/src/qtui/sslinfodlg.cpp index 1aabb79c..e0b6a492 100644 --- a/src/qtui/sslinfodlg.cpp +++ b/src/qtui/sslinfodlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/sslinfodlg.h b/src/qtui/sslinfodlg.h index b3a1bed1..ef372a92 100644 --- a/src/qtui/sslinfodlg.h +++ b/src/qtui/sslinfodlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/statusnotifieritem.cpp b/src/qtui/statusnotifieritem.cpp index 1b6cb4a0..e96cd4eb 100644 --- a/src/qtui/statusnotifieritem.cpp +++ b/src/qtui/statusnotifieritem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This contains code from KStatusNotifierItem, part of the KDE libs * diff --git a/src/qtui/statusnotifieritem.h b/src/qtui/statusnotifieritem.h index df95c464..30050b15 100644 --- a/src/qtui/statusnotifieritem.h +++ b/src/qtui/statusnotifieritem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This contains code from KStatusNotifierItem, part of the KDE libs * diff --git a/src/qtui/systemtray.cpp b/src/qtui/systemtray.cpp index 5bae0845..bb80eeb1 100644 --- a/src/qtui/systemtray.cpp +++ b/src/qtui/systemtray.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/systemtray.h b/src/qtui/systemtray.h index 9556ce9b..65b6e8d8 100644 --- a/src/qtui/systemtray.h +++ b/src/qtui/systemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 2f2e11a2..ae16ac2e 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/systraynotificationbackend.h b/src/qtui/systraynotificationbackend.h index 17028388..8493d7ce 100644 --- a/src/qtui/systraynotificationbackend.h +++ b/src/qtui/systraynotificationbackend.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index 5ffdf71f..9d07bfac 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/taskbarnotificationbackend.h b/src/qtui/taskbarnotificationbackend.h index b9e6dea9..041125cb 100644 --- a/src/qtui/taskbarnotificationbackend.h +++ b/src/qtui/taskbarnotificationbackend.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/titlesetter.cpp b/src/qtui/titlesetter.cpp index 67d439ca..31385a0e 100644 --- a/src/qtui/titlesetter.cpp +++ b/src/qtui/titlesetter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/titlesetter.h b/src/qtui/titlesetter.h index 5bc1c785..1acb20de 100644 --- a/src/qtui/titlesetter.h +++ b/src/qtui/titlesetter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index 4af94b6b..8b8e16d4 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/topicwidget.h b/src/qtui/topicwidget.h index e41451c4..2a6bc6ce 100644 --- a/src/qtui/topicwidget.h +++ b/src/qtui/topicwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/verticaldock.cpp b/src/qtui/verticaldock.cpp index bf82e5f5..3ec7a96e 100644 --- a/src/qtui/verticaldock.cpp +++ b/src/qtui/verticaldock.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/verticaldock.h b/src/qtui/verticaldock.h index 0327a71d..7a11e20f 100644 --- a/src/qtui/verticaldock.h +++ b/src/qtui/verticaldock.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/webpreviewitem.cpp b/src/qtui/webpreviewitem.cpp index 37f231ac..7ee73922 100644 --- a/src/qtui/webpreviewitem.cpp +++ b/src/qtui/webpreviewitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/qtui/webpreviewitem.h b/src/qtui/webpreviewitem.h index a347bc7f..f28d1696 100644 --- a/src/qtui/webpreviewitem.h +++ b/src/qtui/webpreviewitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractbuffercontainer.cpp b/src/uisupport/abstractbuffercontainer.cpp index 3d937024..5c016035 100644 --- a/src/uisupport/abstractbuffercontainer.cpp +++ b/src/uisupport/abstractbuffercontainer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractbuffercontainer.h b/src/uisupport/abstractbuffercontainer.h index 12b0d4a1..c35c8388 100644 --- a/src/uisupport/abstractbuffercontainer.h +++ b/src/uisupport/abstractbuffercontainer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractitemview.cpp b/src/uisupport/abstractitemview.cpp index c79715fe..e8eb141d 100644 --- a/src/uisupport/abstractitemview.cpp +++ b/src/uisupport/abstractitemview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractitemview.h b/src/uisupport/abstractitemview.h index b75c9ff9..56b58aec 100644 --- a/src/uisupport/abstractitemview.h +++ b/src/uisupport/abstractitemview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractnotificationbackend.cpp b/src/uisupport/abstractnotificationbackend.cpp index 810ac895..c392c287 100644 --- a/src/uisupport/abstractnotificationbackend.cpp +++ b/src/uisupport/abstractnotificationbackend.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/abstractnotificationbackend.h b/src/uisupport/abstractnotificationbackend.h index 4c4e094c..f2a4eb88 100644 --- a/src/uisupport/abstractnotificationbackend.h +++ b/src/uisupport/abstractnotificationbackend.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/action.cpp b/src/uisupport/action.cpp index 983e385f..9a8c7add 100644 --- a/src/uisupport/action.cpp +++ b/src/uisupport/action.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/action.h b/src/uisupport/action.h index 81157a22..77b9dc00 100644 --- a/src/uisupport/action.h +++ b/src/uisupport/action.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/actioncollection.cpp b/src/uisupport/actioncollection.cpp index a6368792..58a6348d 100644 --- a/src/uisupport/actioncollection.cpp +++ b/src/uisupport/actioncollection.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/actioncollection.h b/src/uisupport/actioncollection.h index 866cd947..5774eb35 100644 --- a/src/uisupport/actioncollection.h +++ b/src/uisupport/actioncollection.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferhotlistfilter.cpp b/src/uisupport/bufferhotlistfilter.cpp index 42dc813f..da68ebac 100644 --- a/src/uisupport/bufferhotlistfilter.cpp +++ b/src/uisupport/bufferhotlistfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferhotlistfilter.h b/src/uisupport/bufferhotlistfilter.h index 2db49c09..f9dde62a 100644 --- a/src/uisupport/bufferhotlistfilter.h +++ b/src/uisupport/bufferhotlistfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index 2d804167..d48d7c42 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferview.h b/src/uisupport/bufferview.h index 8afa877c..ce7483e1 100644 --- a/src/uisupport/bufferview.h +++ b/src/uisupport/bufferview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index 30839f67..f5ae4447 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index 462c3230..5b816fbd 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferviewoverlayfilter.cpp b/src/uisupport/bufferviewoverlayfilter.cpp index a90f8e86..9870fb56 100644 --- a/src/uisupport/bufferviewoverlayfilter.cpp +++ b/src/uisupport/bufferviewoverlayfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/bufferviewoverlayfilter.h b/src/uisupport/bufferviewoverlayfilter.h index 9849e2b1..fda73776 100644 --- a/src/uisupport/bufferviewoverlayfilter.h +++ b/src/uisupport/bufferviewoverlayfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clearablelineedit.cpp b/src/uisupport/clearablelineedit.cpp index 4a495e84..11d6239a 100644 --- a/src/uisupport/clearablelineedit.cpp +++ b/src/uisupport/clearablelineedit.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clearablelineedit.h b/src/uisupport/clearablelineedit.h index c5fc73dd..5c4abb20 100644 --- a/src/uisupport/clearablelineedit.h +++ b/src/uisupport/clearablelineedit.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clickable.cpp b/src/uisupport/clickable.cpp index 3e704179..73382917 100644 --- a/src/uisupport/clickable.cpp +++ b/src/uisupport/clickable.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clickable.h b/src/uisupport/clickable.h index 80e9af36..295256cd 100644 --- a/src/uisupport/clickable.h +++ b/src/uisupport/clickable.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clickablelabel.cpp b/src/uisupport/clickablelabel.cpp index 34661e86..2bb635e7 100644 --- a/src/uisupport/clickablelabel.cpp +++ b/src/uisupport/clickablelabel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/clickablelabel.h b/src/uisupport/clickablelabel.h index f8bab08b..759fda16 100644 --- a/src/uisupport/clickablelabel.h +++ b/src/uisupport/clickablelabel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/colorbutton.cpp b/src/uisupport/colorbutton.cpp index 5c8572ae..29327e81 100644 --- a/src/uisupport/colorbutton.cpp +++ b/src/uisupport/colorbutton.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/colorbutton.h b/src/uisupport/colorbutton.h index 0df56929..e93be888 100644 --- a/src/uisupport/colorbutton.h +++ b/src/uisupport/colorbutton.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/contextmenuactionprovider.cpp b/src/uisupport/contextmenuactionprovider.cpp index d14a689d..d0f6458e 100644 --- a/src/uisupport/contextmenuactionprovider.cpp +++ b/src/uisupport/contextmenuactionprovider.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/contextmenuactionprovider.h b/src/uisupport/contextmenuactionprovider.h index ca22d303..112d3317 100644 --- a/src/uisupport/contextmenuactionprovider.h +++ b/src/uisupport/contextmenuactionprovider.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/flatproxymodel.cpp b/src/uisupport/flatproxymodel.cpp index cef6459e..81c55686 100644 --- a/src/uisupport/flatproxymodel.cpp +++ b/src/uisupport/flatproxymodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/flatproxymodel.h b/src/uisupport/flatproxymodel.h index aa358072..0adf6183 100644 --- a/src/uisupport/flatproxymodel.h +++ b/src/uisupport/flatproxymodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/fontselector.cpp b/src/uisupport/fontselector.cpp index 9ddbcb66..e9a3f5f6 100644 --- a/src/uisupport/fontselector.cpp +++ b/src/uisupport/fontselector.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/fontselector.h b/src/uisupport/fontselector.h index 3c7b2941..8a36e8c2 100644 --- a/src/uisupport/fontselector.h +++ b/src/uisupport/fontselector.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/graphicalui.cpp b/src/uisupport/graphicalui.cpp index 19a28c20..83b0ce5b 100644 --- a/src/uisupport/graphicalui.cpp +++ b/src/uisupport/graphicalui.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This contains code from KStatusNotifierItem, part of the KDE libs * diff --git a/src/uisupport/graphicalui.h b/src/uisupport/graphicalui.h index dcd03942..eb7562d0 100644 --- a/src/uisupport/graphicalui.h +++ b/src/uisupport/graphicalui.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/icon.cpp b/src/uisupport/icon.cpp index 63249999..19e9f88f 100644 --- a/src/uisupport/icon.cpp +++ b/src/uisupport/icon.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/icon.h b/src/uisupport/icon.h index f1865439..4cecb2ad 100644 --- a/src/uisupport/icon.h +++ b/src/uisupport/icon.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/iconloader.cpp b/src/uisupport/iconloader.cpp index 4f37c328..f000d189 100644 --- a/src/uisupport/iconloader.cpp +++ b/src/uisupport/iconloader.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/iconloader.h b/src/uisupport/iconloader.h index 0efed6af..c5c01ccb 100644 --- a/src/uisupport/iconloader.h +++ b/src/uisupport/iconloader.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * Based in part on KDE's kiconloader.h * diff --git a/src/uisupport/kcmdlinewrapper.cpp b/src/uisupport/kcmdlinewrapper.cpp index f106a199..0d4f30f2 100644 --- a/src/uisupport/kcmdlinewrapper.cpp +++ b/src/uisupport/kcmdlinewrapper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/kcmdlinewrapper.h b/src/uisupport/kcmdlinewrapper.h index d306a3b8..6d4dd3a3 100644 --- a/src/uisupport/kcmdlinewrapper.h +++ b/src/uisupport/kcmdlinewrapper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 05f630da..aed4af79 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/multilineedit.h b/src/uisupport/multilineedit.h index 3eb729d2..70daa53f 100644 --- a/src/uisupport/multilineedit.h +++ b/src/uisupport/multilineedit.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index 7eb6c53e..1259b6ae 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/networkmodelcontroller.h b/src/uisupport/networkmodelcontroller.h index 4b44523e..48fc5eb1 100644 --- a/src/uisupport/networkmodelcontroller.h +++ b/src/uisupport/networkmodelcontroller.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index bdec1872..05515e68 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/nickview.h b/src/uisupport/nickview.h index 7ddd2ba1..21ffa027 100644 --- a/src/uisupport/nickview.h +++ b/src/uisupport/nickview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/nickviewfilter.cpp b/src/uisupport/nickviewfilter.cpp index 74638522..8d223d5d 100644 --- a/src/uisupport/nickviewfilter.cpp +++ b/src/uisupport/nickviewfilter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/nickviewfilter.h b/src/uisupport/nickviewfilter.h index def0e122..716294ed 100644 --- a/src/uisupport/nickviewfilter.h +++ b/src/uisupport/nickviewfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index 237533bf..01fda884 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/qssparser.h b/src/uisupport/qssparser.h index c5838925..c52b3ea8 100644 --- a/src/uisupport/qssparser.h +++ b/src/uisupport/qssparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/resizingstackedwidget.cpp b/src/uisupport/resizingstackedwidget.cpp index db5d20df..78c95025 100644 --- a/src/uisupport/resizingstackedwidget.cpp +++ b/src/uisupport/resizingstackedwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/resizingstackedwidget.h b/src/uisupport/resizingstackedwidget.h index 5b7a8a1d..7015469f 100644 --- a/src/uisupport/resizingstackedwidget.h +++ b/src/uisupport/resizingstackedwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/settingspage.cpp b/src/uisupport/settingspage.cpp index 1a9d1d8c..e5792b63 100644 --- a/src/uisupport/settingspage.cpp +++ b/src/uisupport/settingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/settingspage.h b/src/uisupport/settingspage.h index 1f2ffa13..3875ea01 100644 --- a/src/uisupport/settingspage.h +++ b/src/uisupport/settingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/styledlabel.cpp b/src/uisupport/styledlabel.cpp index 4aae71a0..1a56daad 100644 --- a/src/uisupport/styledlabel.cpp +++ b/src/uisupport/styledlabel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/styledlabel.h b/src/uisupport/styledlabel.h index b0dd215f..a43498a2 100644 --- a/src/uisupport/styledlabel.h +++ b/src/uisupport/styledlabel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/tabcompleter.cpp b/src/uisupport/tabcompleter.cpp index baae742b..da6b0741 100644 --- a/src/uisupport/tabcompleter.cpp +++ b/src/uisupport/tabcompleter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/tabcompleter.h b/src/uisupport/tabcompleter.h index 7d1aa6a1..3d3a1e93 100644 --- a/src/uisupport/tabcompleter.h +++ b/src/uisupport/tabcompleter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/toolbaractionprovider.cpp b/src/uisupport/toolbaractionprovider.cpp index c69ce08b..a7ef447b 100644 --- a/src/uisupport/toolbaractionprovider.cpp +++ b/src/uisupport/toolbaractionprovider.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/toolbaractionprovider.h b/src/uisupport/toolbaractionprovider.h index 391e0379..a4e61c42 100644 --- a/src/uisupport/toolbaractionprovider.h +++ b/src/uisupport/toolbaractionprovider.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/uisettings.cpp b/src/uisupport/uisettings.cpp index 361572ed..c8fce00c 100644 --- a/src/uisupport/uisettings.cpp +++ b/src/uisupport/uisettings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/uisettings.h b/src/uisupport/uisettings.h index 877b1750..c1db196e 100644 --- a/src/uisupport/uisettings.h +++ b/src/uisupport/uisettings.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 6bd84941..df23a62e 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -561,15 +561,43 @@ UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat QString UiStyle::mircToInternal(const QString &mirc_) { - QString mirc = mirc_; - mirc.replace('%', "%%"); // escape % just to be sure - mirc.replace('\t', " "); // tabs break layout, also this is italics in Konversation - mirc.replace('\x02', "%B"); - mirc.replace('\x0f', "%O"); - mirc.replace('\x12', "%R"); - mirc.replace('\x16', "%R"); - mirc.replace('\x1d', "%S"); - mirc.replace('\x1f', "%U"); + QString mirc; + mirc.reserve(mirc_.size()); + foreach (const QChar &c, mirc_) { + if ((c < '\x20' || c == '\x7f') && c != '\x03') { + switch (c.unicode()) { + case '\x02': + mirc += "%B"; + break; + case '\x0f': + mirc += "%O"; + break; + case '\x12': + case '\x16': + mirc += "%R"; + break; + case '\x1d': + mirc += "%S"; + break; + case '\x1f': + mirc += "%U"; + break; + case '\x7f': + mirc += QChar(0x2421); + break; + default: + mirc += QChar(0x2400 + c.unicode()); + } + } else { + if (c == '\t') { + mirc += " "; + continue; + } + if (c == '%') + mirc += c; + mirc += c; + } + } // Now we bring the color codes (\x03) in a sane format that can be parsed more easily later. // %Dcfxx is foreground, %Dcbxx is background color, where xx is a 2 digit dec number denoting the color code. @@ -687,8 +715,10 @@ void UiStyle::StyledMessage::style() const //: Error Message t = tr("%1").arg(txt); break; case Message::DayChange: + { //: Day Change Message - t = tr("{Day changed to %1}").arg(timestamp().toString()); + t = tr("{Day changed to %1}").arg(QLocale().toString(timestamp(), QLocale().dateFormat())); + } break; case Message::Topic: //: Topic Message diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index fd059742..993aab39 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify *