clientignorelistmanager.cpp
clientirclisthelper.cpp
clientsettings.cpp
- clienttransfer.cpp
- clienttransfermanager.cpp
clientuserinputhandler.cpp
coreaccount.cpp
coreaccountmodel.cpp
clientidentity.h
clientignorelistmanager.h
clientirclisthelper.h
- clienttransfer.h
- clienttransfermanager.h
clientuserinputhandler.h
coreaccountmodel.h
coreconnection.h
#include "clientirclisthelper.h"
#include "clientidentity.h"
#include "clientignorelistmanager.h"
-#include "clienttransfermanager.h"
#include "clientuserinputhandler.h"
#include "coreaccountmodel.h"
#include "coreconnection.h"
_inputHandler(0),
_networkConfig(0),
_ignoreListManager(0),
- _transferManager(0),
_messageModel(0),
_messageProcessor(0),
_coreAccountModel(new CoreAccountModel(this)),
_ignoreListManager = new ClientIgnoreListManager(this);
signalProxy()->synchronize(ignoreListManager());
- Q_ASSERT(!_transferManager);
- _transferManager = new ClientTransferManager(this);
- signalProxy()->synchronize(transferManager());
-
// trigger backlog request once all active bufferviews are initialized
connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
_ignoreListManager->deleteLater();
_ignoreListManager = 0;
}
-
- if (_transferManager) {
- _transferManager->deleteLater();
- _transferManager = 0;
- }
-
// we probably don't want to save pending input for reconnect
_userInputBuffer.clear();
class ClientBufferViewManager;
class ClientIgnoreListManager;
class ClientIrcListHelper;
-class ClientTransferManager;
class ClientUserInputHandler;
class CoreAccountModel;
class CoreConnection;
class IrcChannel;
class NetworkConfig;
class SignalProxy;
-
struct NetworkInfo;
class Client : public QObject
static inline ClientUserInputHandler *inputHandler() { return instance()->_inputHandler; }
static inline NetworkConfig *networkConfig() { return instance()->_networkConfig; }
static inline ClientIgnoreListManager *ignoreListManager() { return instance()->_ignoreListManager; }
- static inline ClientTransferManager *transferManager() { return instance()->_transferManager; }
static inline CoreAccountModel *coreAccountModel() { return instance()->_coreAccountModel; }
static inline CoreConnection *coreConnection() { return instance()->_coreConnection; }
ClientUserInputHandler *_inputHandler;
NetworkConfig *_networkConfig;
ClientIgnoreListManager *_ignoreListManager;
- ClientTransferManager *_transferManager;
MessageModel *_messageModel;
AbstractMessageProcessor *_messageProcessor;
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 <QFile>
-
-#include "clienttransfer.h"
-
-INIT_SYNCABLE_OBJECT(ClientTransfer)
-ClientTransfer::ClientTransfer(const QUuid &uuid, QObject *parent)
- : Transfer(uuid, parent),
- _file(0)
-{
- connect(this, SIGNAL(stateChanged(State)), SLOT(onStateChanged(State)));
-}
-
-
-void ClientTransfer::cleanUp()
-{
- if (_file) {
- _file->close();
- _file->deleteLater();
- _file = 0;
- }
-}
-
-
-QString ClientTransfer::savePath() const
-{
- return _savePath;
-}
-
-
-void ClientTransfer::accept(const QString &savePath) const
-{
- _savePath = savePath;
- PeerPtr ptr = 0;
- REQUEST_OTHER(requestAccepted, ARG(ptr));
- emit accepted();
-}
-
-
-void ClientTransfer::reject() const
-{
- PeerPtr ptr = 0;
- REQUEST_OTHER(requestRejected, ARG(ptr));
- emit rejected();
-}
-
-
-void ClientTransfer::dataReceived(PeerPtr, const QByteArray &data)
-{
- // TODO: proper error handling (relay to core)
- if (!_file) {
- _file = new QFile(_savePath, this);
- if (!_file->open(QFile::WriteOnly|QFile::Truncate)) {
- qWarning() << Q_FUNC_INFO << "Could not open file:" << _file->errorString();
- return;
- }
- }
-
- if (!_file->isOpen())
- return;
-
- if (_file->write(data) < 0) {
- qWarning() << Q_FUNC_INFO << "Could not write to file:" << _file->errorString();
- return;
- }
-}
-
-
-void ClientTransfer::onStateChanged(Transfer::State state)
-{
- switch(state) {
- case Completed:
- if (_file)
- _file->close();
- break;
- case Failed:
- if (_file)
- _file->remove();
- break;
- default:
- ;
- }
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 CLIENTTRANSFER_H
-#define CLIENTTRANSFER_H
-
-#include <QUuid>
-
-#include "transfer.h"
-
-class QFile;
-
-class ClientTransfer : public Transfer
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
-public:
- ClientTransfer(const QUuid &uuid, QObject *parent = 0);
-
- QString savePath() const;
-
-public slots:
- // called on the client side
- void accept(const QString &savePath) const;
- void reject() const;
-
-private slots:
- void dataReceived(PeerPtr peer, const QByteArray &data);
- void onStateChanged(State state);
-
-private:
- virtual void cleanUp();
-
- mutable QString _savePath;
-
- QFile *_file;
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 "clienttransfermanager.h"
-
-#include "client.h"
-#include "clienttransfer.h"
-
-
-INIT_SYNCABLE_OBJECT(ClientTransferManager)
-ClientTransferManager::ClientTransferManager(QObject *parent)
- : TransferManager(parent)
-{
- connect(this, SIGNAL(transferAdded(const Transfer*)), SLOT(onTransferAdded(const Transfer*)));
-}
-
-
-const ClientTransfer *ClientTransferManager::transfer(const QUuid &uuid) const
-{
- return qobject_cast<const ClientTransfer *>(transfer_(uuid));
-}
-
-
-void ClientTransferManager::onCoreTransferAdded(const QUuid &uuid)
-{
- if (uuid.isNull()) {
- qWarning() << Q_FUNC_INFO << "Invalid transfer uuid" << uuid.toString();
- return;
- }
-
- ClientTransfer *transfer = new ClientTransfer(uuid, this);
- connect(transfer, SIGNAL(initDone()), SLOT(onTransferInitDone())); // we only want to add initialized transfers
- Client::signalProxy()->synchronize(transfer);
-}
-
-
-void ClientTransferManager::onTransferInitDone()
-{
- Transfer *transfer = qobject_cast<Transfer *>(sender());
- Q_ASSERT(transfer);
- addTransfer(transfer);
-}
-
-
-void ClientTransferManager::onTransferAdded(const Transfer *transfer)
-{
- const ClientTransfer *t = qobject_cast<const ClientTransfer *>(transfer);
- if (!t) {
- qWarning() << "Invalid Transfer added to ClientTransferManager!";
- return;
- }
-
- emit transferAdded(t);
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 CLIENTTRANSFERMANAGER_H
-#define CLIENTTRANSFERMANAGER_H
-
-#include "transfermanager.h"
-
-#include <QUuid>
-
-class ClientTransfer;
-
-class ClientTransferManager : public TransferManager
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
-public:
- ClientTransferManager(QObject *parent = 0);
-
- const ClientTransfer *transfer(const QUuid &uuid) const;
-
-public slots:
- void onCoreTransferAdded(const QUuid &uuid);
- void onTransferInitDone();
-
-signals:
- void transferAdded(const ClientTransfer *transfer);
-
-private slots:
- void onTransferAdded(const Transfer *transfer);
-
-};
-
-#endif
settings.cpp
signalproxy.cpp
syncableobject.cpp
- transfer.cpp
- transfermanager.cpp
util.cpp
protocols/datastream/datastreampeer.cpp
settings.h
signalproxy.h
syncableobject.h
- transfer.h
- transfermanager.h
protocols/datastream/datastreampeer.h
protocols/legacy/legacypeer.h
#ifdef HAVE_SSL
cliParser->addSwitch("require-ssl", 0, "Require SSL for client connections");
#endif
- cliParser->addSwitch("enable-experimental-dcc", 0, "Enable highly experimental and unfinished support for CTCP DCC (DANGEROUS)");
#endif
#ifdef HAVE_KDE
#include <QLibraryInfo>
#include <QSettings>
#include <QTranslator>
-#include <QUuid>
#include "bufferinfo.h"
#include "identity.h"
qRegisterMetaType<MsgId>("MsgId");
qRegisterMetaType<QHostAddress>("QHostAddress");
- qRegisterMetaType<QUuid>("QUuid");
qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 "transfer.h"
-
-INIT_SYNCABLE_OBJECT(Transfer)
-Transfer::Transfer(const QUuid &uuid, QObject *parent)
- : SyncableObject(parent),
- _state(New),
- _direction(Receive),
- _port(0),
- _fileSize(0),
- _uuid(uuid)
-{
- init();
-}
-
-Transfer::Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
- : SyncableObject(parent),
- _state(New),
- _direction(direction),
- _fileName(fileName),
- _address(address),
- _port(port),
- _fileSize(fileSize),
- _nick(nick),
- _uuid(QUuid::createUuid())
-{
- init();
-}
-
-
-void Transfer::init()
-{
- renameObject(QString("Transfer/%1").arg(_uuid.toString()));
- setAllowClientUpdates(true);
-}
-
-
-QUuid Transfer::uuid() const
-{
- return _uuid;
-}
-
-
-Transfer::State Transfer::state() const
-{
- return _state;
-}
-
-
-void Transfer::setState(Transfer::State state)
-{
- if (_state != state) {
- _state = state;
- SYNC(ARG(state));
- emit stateChanged(state);
- }
-}
-
-
-
-Transfer::Direction Transfer::direction() const
-{
- return _direction;
-}
-
-
-void Transfer::setDirection(Transfer::Direction direction)
-{
- if (_direction != direction) {
- _direction = direction;
- SYNC(ARG(direction));
- emit directionChanged(direction);
- }
-}
-
-
-QHostAddress Transfer::address() const
-{
- return _address;
-}
-
-
-void Transfer::setAddress(const QHostAddress &address)
-{
- if (_address != address) {
- _address = address;
- SYNC(ARG(address));
- emit addressChanged(address);
- }
-}
-
-
-quint16 Transfer::port() const
-{
- return _port;
-}
-
-
-void Transfer::setPort(quint16 port)
-{
- if (_port != port) {
- _port = port;
- SYNC(ARG(port));
- emit portChanged(port);
- }
-}
-
-
-QString Transfer::fileName() const
-{
- return _fileName;
-}
-
-
-void Transfer::setFileName(const QString &fileName)
-{
- if (_fileName != fileName) {
- _fileName = fileName;
- SYNC(ARG(fileName));
- emit fileNameChanged(fileName);
- }
-}
-
-
-quint64 Transfer::fileSize() const
-{
- return _fileSize;
-}
-
-
-void Transfer::setFileSize(quint64 fileSize)
-{
- if (_fileSize != fileSize) {
- _fileSize = fileSize;
- SYNC(ARG(fileSize));
- emit fileSizeChanged(fileSize);
- }
-}
-
-
-QString Transfer::nick() const
-{
- return _nick;
-}
-
-
-void Transfer::setNick(const QString &nick)
-{
- if (_nick != nick) {
- _nick = nick;
- SYNC(ARG(nick));
- emit nickChanged(nick);
- }
-}
-
-
-void Transfer::setError(const QString &errorString)
-{
- qWarning() << Q_FUNC_INFO << errorString;
- emit error(errorString);
- setState(Failed);
- cleanUp();
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 TRANSFER_H
-#define TRANSFER_H
-
-#include <QHostAddress>
-#include <QUuid>
-
-#include "syncableobject.h"
-#include "types.h"
-
-class Transfer : public SyncableObject
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
- Q_PROPERTY(QUuid uuid READ uuid);
- Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged);
- Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged);
- Q_PROPERTY(QHostAddress address READ address WRITE setAddress NOTIFY addressChanged);
- Q_PROPERTY(quint16 port READ port WRITE setPort NOTIFY portChanged);
- Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged);
- Q_PROPERTY(quint64 fileSize READ fileSize WRITE setFileSize NOTIFY fileSizeChanged);
- Q_PROPERTY(QString nick READ nick WRITE setNick NOTIFY nickChanged);
-
-public:
- enum State {
- New,
- Pending,
- Connecting,
- Transferring,
- Paused,
- Completed,
- Failed,
- Rejected
- };
- Q_ENUMS(State)
-
- enum Direction {
- Send,
- Receive
- };
- Q_ENUMS(Direction)
-
- Transfer(const QUuid &uuid, QObject *parent = 0); // for creating a syncable object client-side
- Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
-
- QUuid uuid() const;
- State state() const;
- Direction direction() const;
- QString fileName() const;
- QHostAddress address() const;
- quint16 port() const;
- quint64 fileSize() const;
- QString nick() const;
-
-public slots:
- // called on the client side
- virtual void accept(const QString &savePath) const { Q_UNUSED(savePath); }
- virtual void reject() const {}
-
- // called on the core side through sync calls
- virtual void requestAccepted(PeerPtr peer) { Q_UNUSED(peer); }
- virtual void requestRejected(PeerPtr peer) { Q_UNUSED(peer); }
-
-signals:
- void stateChanged(State state);
- void directionChanged(Direction direction);
- void addressChanged(const QHostAddress &address);
- void portChanged(quint16 port);
- void fileNameChanged(const QString &fileName);
- void fileSizeChanged(quint64 fileSize);
- void nickChanged(const QString &nick);
-
- void error(const QString &errorString);
-
- void accepted(PeerPtr peer = 0) const;
- void rejected(PeerPtr peer = 0) const;
-
-protected slots:
- void setState(State state);
- void setError(const QString &errorString);
-
- // called on the client side through sync calls
- virtual void dataReceived(PeerPtr, const QByteArray &data) { Q_UNUSED(data); }
-
- virtual void cleanUp() = 0;
-
-private:
- void init();
-
- void setDirection(Direction direction);
- void setAddress(const QHostAddress &address);
- void setPort(quint16 port);
- void setFileName(const QString &fileName);
- void setFileSize(quint64 fileSize);
- void setNick(const QString &nick);
-
-
- State _state;
- Direction _direction;
- QString _fileName;
- QHostAddress _address;
- quint16 _port;
- quint64 _fileSize;
- QString _nick;
- QUuid _uuid;
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 "transfermanager.h"
-
-#include "transfer.h"
-
-
-INIT_SYNCABLE_OBJECT(TransferManager)
-TransferManager::TransferManager(QObject *parent)
- : SyncableObject(parent)
-{
-
-}
-
-
-Transfer *TransferManager::transfer_(const QUuid &uuid) const
-{
- return _transfers.value(uuid, 0);
-}
-
-
-QList<QUuid> TransferManager::transferIds() const
-{
- return _transfers.keys();
-}
-
-
-void TransferManager::addTransfer(Transfer *transfer)
-{
- QUuid uuid = transfer->uuid();
- if (_transfers.contains(uuid)) {
- qWarning() << "Cannot add the same file transfer twice!";
- transfer->deleteLater();
- return;
- }
- transfer->setParent(this);
- _transfers[uuid] = transfer;
-
- SYNC_OTHER(onCoreTransferAdded, ARG(uuid));
- emit transferAdded(transfer);
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 TRANSFERMANAGER_H
-#define TRANSFERMANAGER_H
-
-#include "syncableobject.h"
-
-#include <QUuid>
-
-class Transfer;
-
-class TransferManager : public SyncableObject
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
-public:
- TransferManager(QObject *parent = 0);
- inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
-
- QList<QUuid> transferIds() const;
-
-signals:
- void transferAdded(const Transfer *transfer);
-
-protected:
- Transfer *transfer_(const QUuid &uuid) const;
- void addTransfer(Transfer *transfer);
-
-protected slots:
- virtual void onCoreTransferAdded(const QUuid &uuid) { Q_UNUSED(uuid) };
-
-private:
- QHash<QUuid, Transfer *> _transfers;
-
-};
-
-#endif
coresession.cpp
coresessioneventprocessor.cpp
coresettings.cpp
- coretransfer.cpp
- coretransfermanager.cpp
coreuserinputhandler.cpp
coreusersettings.cpp
ctcpparser.cpp
corenetworkconfig.h
coresession.h
coresessioneventprocessor.h
- coretransfer.h
- coretransfermanager.h
coreuserinputhandler.h
ctcpparser.h
eventstringifier.h
#include "corenetwork.h"
#include "corenetworkconfig.h"
#include "coresessioneventprocessor.h"
-#include "coretransfermanager.h"
#include "coreusersettings.h"
#include "ctcpparser.h"
#include "eventstringifier.h"
_ircListHelper(new CoreIrcListHelper(this)),
_networkConfig(new CoreNetworkConfig("GlobalNetworkConfig", this)),
_coreInfo(this),
- _transferManager(new CoreTransferManager(this)),
_eventManager(new CoreEventManager(this)),
_eventStringifier(new EventStringifier(this)),
_sessionEventProcessor(new CoreSessionEventProcessor(this)),
p->synchronize(networkConfig());
p->synchronize(&_coreInfo);
p->synchronize(&_ignoreListManager);
- p->synchronize(transferManager());
// Restore session state
if (restoreState)
restoreSessionState();
class CoreNetwork;
class CoreNetworkConfig;
class CoreSessionEventProcessor;
-class CoreTransferManager;
class CtcpParser;
class EventManager;
class EventStringifier;
inline CoreIrcListHelper *ircListHelper() const { return _ircListHelper; }
inline CoreIgnoreListManager *ignoreListManager() { return &_ignoreListManager; }
- inline CoreTransferManager *transferManager() const { return _transferManager; }
-
// void attachNetworkConnection(NetworkConnection *conn);
//! Return necessary data for restoring the session after restarting the core
CoreIrcListHelper *_ircListHelper;
CoreNetworkConfig *_networkConfig;
CoreCoreInfo _coreInfo;
- CoreTransferManager *_transferManager;
EventManager *_eventManager;
EventStringifier *_eventStringifier; // should eventually move into client
#include "coreirclisthelper.h"
#include "corenetwork.h"
#include "coresession.h"
-#include "coretransfer.h"
-#include "coretransfermanager.h"
#include "ctcpevent.h"
#include "ircevent.h"
#include "ircuser.h"
-#include "logger.h"
#include "messageevent.h"
#include "netsplit.h"
#include "quassel.h"
}
-// http://www.irchelp.org/irchelp/rfc/ctcpspec.html
-// http://en.wikipedia.org/wiki/Direct_Client-to-Client
-void CoreSessionEventProcessor::handleCtcpDcc(CtcpEvent *e)
-{
- // DCC support is unfinished, experimental and potentially dangerous, so make it opt-in
- if (!Quassel::isOptionSet("enable-experimental-dcc")) {
- quInfo() << "DCC disabled, start core with --enable-experimental-dcc if you really want to try it out";
- return;
- }
-
- // normal: SEND <filename> <ip> <port> [<filesize>]
- // reverse: SEND <filename> <ip> 0 <filesize> <token>
- QStringList params = e->param().split(' ');
- if (params.count()) {
- QString cmd = params[0].toUpper();
- if (cmd == "SEND") {
- if (params.count() < 4) {
- qWarning() << "Invalid DCC SEND request:" << e; // TODO emit proper error to client
- return;
- }
- QString filename = params[1];
- QHostAddress address;
- quint16 port = params[3].toUShort();
- quint64 size = 0;
- QString numIp = params[2]; // this is either IPv4 as a 32 bit value, or IPv6 (which always contains a colon)
- if (numIp.contains(':')) { // IPv6
- if (!address.setAddress(numIp)) {
- qWarning() << "Invalid IPv6:" << numIp;
- return;
- }
- }
- else {
- address.setAddress(numIp.toUInt());
- }
-
- if (port == 0) { // Reverse DCC is indicated by a 0 port
- emit newEvent(new MessageEvent(Message::Error, e->network(), tr("Reverse DCC SEND not supported"), e->prefix(), e->target(), Message::None, e->timestamp()));
- return;
- }
- if (port < 1024) {
- qWarning() << "Privileged port requested:" << port; // FIXME ask user if this is ok
- }
-
-
- if (params.count() > 4) { // filesize is optional
- size = params[4].toULong();
- }
-
- // TODO: check if target is the right thing to use for the partner
- CoreTransfer *transfer = new CoreTransfer(Transfer::Receive, e->target(), filename, address, port, size, this);
- coreSession()->signalProxy()->synchronize(transfer);
- coreSession()->transferManager()->addTransfer(transfer);
- }
- else {
- emit newEvent(new MessageEvent(Message::Error, e->network(), tr("DCC %1 not supported").arg(cmd), e->prefix(), e->target(), Message::None, e->timestamp()));
- return;
- }
- }
-}
-
-
void CoreSessionEventProcessor::handleCtcpPing(CtcpEvent *e)
{
e->setReply(e->param().isNull() ? "" : e->param());
Q_INVOKABLE void handleCtcpAction(CtcpEvent *event);
Q_INVOKABLE void handleCtcpClientinfo(CtcpEvent *event);
- Q_INVOKABLE void handleCtcpDcc(CtcpEvent *event);
Q_INVOKABLE void handleCtcpPing(CtcpEvent *event);
Q_INVOKABLE void handleCtcpTime(CtcpEvent *event);
Q_INVOKABLE void handleCtcpVersion(CtcpEvent *event);
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 <QtEndian>
-
-#include <QCoreApplication>
-#include <QTcpSocket>
-
-#include "coretransfer.h"
-
-const qint64 chunkSize = 16 * 1024;
-
-INIT_SYNCABLE_OBJECT(CoreTransfer)
-
-CoreTransfer::CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 fileSize, QObject *parent)
- : Transfer(direction, nick, fileName, address, port, fileSize, parent),
- _socket(0),
- _pos(0),
- _reading(false)
-{
-
-}
-
-
-void CoreTransfer::cleanUp()
-{
- if (_socket) {
- _socket->close();
- _socket->deleteLater();
- _socket = 0;
- }
-
- _buffer.clear();
- _reading = false;
-}
-
-
-void CoreTransfer::onSocketDisconnected()
-{
- if (state() == Connecting || state() == Transferring) {
- setError(tr("Socket closed while still transferring!"));
- }
- else
- cleanUp();
-}
-
-
-void CoreTransfer::onSocketError(QAbstractSocket::SocketError error)
-{
- Q_UNUSED(error)
-
- if (state() == Connecting || state() == Transferring) {
- setError(tr("DCC connection error: %1").arg(_socket->errorString()));
- }
-}
-
-
-void CoreTransfer::requestAccepted(PeerPtr peer)
-{
- if (_peer || !peer || state() != New)
- return; // transfer was already accepted
-
- _peer = peer;
- setState(Pending);
-
- emit accepted(peer);
-
- // FIXME temporary until we have queueing
- start();
-}
-
-
-void CoreTransfer::requestRejected(PeerPtr peer)
-{
- if (_peer || state() != New)
- return;
-
- _peer = peer;
- setState(Rejected);
-
- emit rejected(peer);
-}
-
-
-void CoreTransfer::start()
-{
- if (!_peer || state() != Pending || direction() != Receive)
- return;
-
- setupConnectionForReceive();
-}
-
-
-void CoreTransfer::setupConnectionForReceive()
-{
- if (port() == 0) {
- setError(tr("Reverse DCC not supported yet!"));
- return;
- }
-
- setState(Connecting);
-
- _socket = new QTcpSocket(this);
- connect(_socket, SIGNAL(connected()), SLOT(startReceiving()));
- connect(_socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected()));
- connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError)));
- connect(_socket, SIGNAL(readyRead()), SLOT(onDataReceived()));
-
- _socket->connectToHost(address(), port());
-}
-
-
-void CoreTransfer::startReceiving()
-{
- setState(Transferring);
-}
-
-
-void CoreTransfer::onDataReceived()
-{
- if (_reading) // since we're spinning the event loop, we may get another readyRead() and thus reentrancy
- return;
- _reading = true;
-
- while (_socket->bytesAvailable()) {
- QByteArray data = _socket->read(chunkSize);
- _pos += data.size();
- if (!relayData(data, true))
- return;
-
- QCoreApplication::processEvents(); // don't block the rest of the core/client communication
- if (!_socket) // just in case something happened during spinning the event loop that killed our socket
- return;
- }
-
- // Send ack to sender. The DCC protocol only specifies 32 bit values, but modern clients (i.e. those who can send files
- // larger than 4 GB) will ignore this anyway...
- quint32 ack = qToBigEndian((quint32)_pos);// qDebug() << Q_FUNC_INFO << _pos;
- _socket->write((char *)&ack, 4);
-
- if (_pos > fileSize()) {
- qWarning() << "DCC Receive: Got more data than expected!";
- setError(tr("DCC Receive: Got more data than expected!"));
- }
- else if (_pos == fileSize()) {
- qDebug() << "DCC Receive: Transfer finished";
- if (relayData(QByteArray(), false)) // empty buffer
- setState(Completed);
- }
-
- _reading = false;
-}
-
-
-bool CoreTransfer::relayData(const QByteArray &data, bool requireChunkSize)
-{
- // safeguard against a disconnecting quasselclient
- if (!_peer) {
- setError(tr("DCC Receive: Quassel Client disconnected during transfer!"));
- return false;
- }
- _buffer.append(data);
-
- // we only want to send data to the client once we have reached the chunksize
- if (_buffer.size() > 0 && (_buffer.size() >= chunkSize || !requireChunkSize)) {
- SYNC_OTHER(dataReceived, ARG(_peer), ARG(_buffer));
- _buffer.clear();
- }
-
- return true;
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 CORETRANSFER_H
-#define CORETRANSFER_H
-
-#include <QPointer>
-
-#include "transfer.h"
-#include "peer.h"
-
-class QTcpSocket;
-
-class CoreTransfer : public Transfer
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
-public:
- CoreTransfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0);
-
-public slots:
- void start();
-
- // called through sync calls
- void requestAccepted(PeerPtr peer);
- void requestRejected(PeerPtr peer);
-
-private slots:
- void startReceiving();
- void onDataReceived();
- void onSocketDisconnected();
- void onSocketError(QAbstractSocket::SocketError error);
-
-private:
- void setupConnectionForReceive();
- bool relayData(const QByteArray &data, bool requireChunkSize);
- virtual void cleanUp();
-
- QPointer<Peer> _peer;
- QTcpSocket *_socket;
- quint64 _pos;
- QByteArray _buffer;
- bool _reading;
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 "coretransfermanager.h"
-
-#include "coretransfer.h"
-
-INIT_SYNCABLE_OBJECT(CoreTransferManager)
-CoreTransferManager::CoreTransferManager(QObject *parent)
- : TransferManager(parent)
-{
- connect(this, SIGNAL(transferAdded(const Transfer*)), SLOT(onTransferAdded(const Transfer*)));
-}
-
-
-CoreTransfer *CoreTransferManager::transfer(const QUuid &uuid) const
-{
- return qobject_cast<CoreTransfer *>(transfer_(uuid));
-}
-
-
-void CoreTransferManager::addTransfer(CoreTransfer *transfer)
-{
- TransferManager::addTransfer(transfer);
-}
-
-
-void CoreTransferManager::onTransferAdded(const Transfer *transfer)
-{
- // for core-side use, publishing a non-const pointer is ok
- CoreTransfer *t = const_cast<CoreTransfer *>(qobject_cast<const CoreTransfer *>(transfer));
- if (!t) {
- qWarning() << "Invalid Transfer added to CoreTransferManager!";
- return;
- }
-
- emit transferAdded(t);
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 CORETRANSFERMANAGER_H
-#define CORETRANSFERMANAGER_H
-
-#include "transfermanager.h"
-#include "types.h"
-
-class CoreTransfer;
-
-class CoreTransferManager : public TransferManager
-{
- Q_OBJECT
- SYNCABLE_OBJECT
-
-public:
- CoreTransferManager(QObject *parent = 0);
-
- CoreTransfer *transfer(const QUuid &uuid) const;
-
-public slots:
- void addTransfer(CoreTransfer *transfer);
-
-signals:
- void transferAdded(CoreTransfer *transfer);
-
-private slots:
- void onTransferAdded(const Transfer *transfer);
-
-};
-
-#endif
qtuimessageprocessor.cpp
qtuisettings.cpp
qtuistyle.cpp
- receivefiledlg.cpp
settingsdlg.cpp
settingspagedlg.cpp
simplenetworkeditor.cpp
qtuiapplication.h
qtuimessageprocessor.h
qtuistyle.h
- receivefiledlg.h
settingsdlg.h
settingspagedlg.h
simplenetworkeditor.h
settingsdlg.ui
settingspagedlg.ui
simplenetworkeditor.ui
- receivefiledlg.ui
topicwidget.ui)
if(HAVE_KDE)
#include "clientbufferviewconfig.h"
#include "clientbufferviewmanager.h"
#include "clientignorelistmanager.h"
-#include "clienttransfer.h"
-#include "clienttransfermanager.h"
#include "coreconfigwizard.h"
#include "coreconnectdlg.h"
#include "coreconnection.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
#include "qtuistyle.h"
-#include "receivefiledlg.h"
#include "settingsdlg.h"
#include "settingspagedlg.h"
#include "statusnotifieritem.h"
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
- connect(Client::transferManager(), SIGNAL(transferAdded(const ClientTransfer*)), SLOT(showNewTransferDlg(const ClientTransfer*)));
-
setConnectedState();
}
}
-void MainWin::showNewTransferDlg(const ClientTransfer *transfer)
-{
- ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this);
- dlg->show();
-}
-
-
void MainWin::onFullScreenToggled()
{
// Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs
class BufferView;
class BufferViewConfig;
class ClientBufferViewConfig;
-class ClientTransfer;
class CoreAccount;
class CoreConnectionStatusWidget;
class BufferViewDock;
void showNotificationsDlg();
void showIgnoreList(QString newRule = QString());
void showShortcutsDlg();
- void showNewTransferDlg(const ClientTransfer *transfer);
void onFullScreenToggled();
void handleCoreConnectionError(const QString &errorMsg);
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 <QDir>
-#include <QFileDialog>
-
-#include "receivefiledlg.h"
-
-#include "transfer.h"
-
-ReceiveFileDlg::ReceiveFileDlg(const Transfer *transfer, QWidget *parent)
- : QDialog(parent),
- _transfer(transfer)
-{
- setAttribute(Qt::WA_DeleteOnClose);
- ui.setupUi(this);
-
- QString label = tr("<b>%1</b> wants to send you a file:<br>%2 (%3 bytes)").arg(transfer->nick(), transfer->fileName()).arg(transfer->fileSize());
- ui.infoText->setText(label);
-}
-
-
-void ReceiveFileDlg::on_buttonBox_clicked(QAbstractButton *button)
-{
- if (ui.buttonBox->standardButton(button) == QDialogButtonBox::Save) {
- QString name = QFileDialog::getSaveFileName(this, QString(), QDir::currentPath() + "/" + _transfer->fileName());
- _transfer->accept(name);
- }
-
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-2014 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 RECEIVEFILEDLG_H
-#define RECEIVEFILEDLG_H
-
-#include "ui_receivefiledlg.h"
-
-class Transfer;
-
-class ReceiveFileDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- ReceiveFileDlg(const Transfer *transfer, QWidget *parent = 0);
-
-private slots:
- void on_buttonBox_clicked(QAbstractButton *button);
-
-private:
- Ui::ReceiveFileDlg ui;
- const Transfer *_transfer;
-};
-
-#endif
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ReceiveFileDlg</class>
- <widget class="QDialog" name="ReceiveFileDlg">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>354</width>
- <height>97</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Incoming File Transfer</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="infoText">
- <property name="text">
- <string notr="true">Someone is trying to send you a file.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Discard|QDialogButtonBox::Ignore|QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ReceiveFileDlg</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ReceiveFileDlg</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>