/***************************************************************************
- * Copyright (C) 2005-2014 by the Quassel Project *
+ * Copyright (C) 2005-2015 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "clientsettings.h"
#include "peerfactory.h"
-#include "protocols/legacy/legacypeer.h"
-
using namespace Protocol;
ClientAuthHandler::ClientAuthHandler(CoreAccount account, QObject *parent)
text = tr("Disconnected");
// Ensure the disconnected() signal is sent even if we haven't reached the Connected state yet.
// The baseclass implementation will make sure to only send the signal once.
- onSocketDisconnected();
+ // However, we do want to prefer a potential socket error signal that may be on route already, so
+ // give this a chance to overtake us by spinning the loop...
+ QTimer::singleShot(0, this, SLOT(onSocketDisconnected()));
}
break;
default:
if (_account.useSsl())
magic |= Protocol::Encryption;
#endif
- //magic |= Protocol::Compression; // not implemented yet
+ magic |= Protocol::Compression;
stream << magic;
// here goes the list of protocols we support, in order of preference
- stream << ((quint32)Protocol::LegacyProtocol | 0x80000000); // end list
+ PeerFactory::ProtoList protos = PeerFactory::supportedProtocols();
+ for (int i = 0; i < protos.count(); ++i) {
+ quint32 reply = protos[i].first;
+ reply |= protos[i].second<<8;
+ if (i == protos.count() - 1)
+ reply |= 0x80000000; // end list
+ stream << reply;
+ }
socket()->flush(); // make sure the probing data is sent immediately
return;
qDebug() << "Legacy core detected, switching to compatibility mode";
- RemotePeer *peer = new LegacyPeer(this, socket(), this);
+ RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this);
// Only needed for the legacy peer, as all others check the protocol version before instantiation
connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));
quint16 protoFeatures = static_cast<quint16>(reply>>8 & 0xffff);
_connectionFeatures = static_cast<quint8>(reply>>24);
- RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(type, protoFeatures), this, socket(), this);
+ Compressor::CompressionLevel level;
+ if (_connectionFeatures & Protocol::Compression)
+ level = Compressor::BestCompression;
+ else
+ level = Compressor::NoCompression;
+
+ RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(type, protoFeatures), this, socket(), level, this);
if (!peer) {
qWarning() << "No valid protocol supported for this core!";
emit errorPopup(tr("<b>Incompatible Quassel Core!</b><br>"
void ClientAuthHandler::setPeer(RemotePeer *peer)
{
+ qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "...";
+
_peer = peer;
connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int)));
useSsl = _account.useSsl();
#endif
- _peer->dispatch(RegisterClient(Quassel::buildInfo().fancyVersionString, useSsl));
+ _peer->dispatch(RegisterClient(Quassel::buildInfo().fancyVersionString, Quassel::buildInfo().buildDate, useSsl));
}