#include "core.h"
#include "coresession.h"
#include "coresettings.h"
+#include "quassel.h"
#include "signalproxy.h"
#include "sqlitestorage.h"
#include "network.h"
}
Core::Core() : storage(0) {
- _startTime = QDateTime::currentDateTime(); // for uptime :)
+ _startTime = QDateTime::currentDateTime().toUTC(); // for uptime :)
// Register storage backends here!
registerStorageBackend(new SqliteStorage(this));
connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection()));
connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection()));
- if(!startListening(cs.port())) exit(1); // TODO make this less brutal
+ if(!startListening()) exit(1); // TODO make this less brutal
}
Core::~Core() {
/*** Network Management ***/
-bool Core::startListening(uint port) {
+bool Core::startListening() {
bool success = false;
+ uint port = Quassel::optionValue("port").toUInt();
if(_server.listen(QHostAddress::Any, port)) {
quInfo() << "Listening for GUI clients on IPv6 port" << _server.serverPort() << "using protocol version" << Global::protocolVersion;
if(!success) {
quError() << qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(_server.errorString()));
}
-
+
return success;
}
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)));
-
+
QVariantMap clientInfo;
blocksizes.insert(socket, (quint32)0);
quInfo() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString());
reply["CoreBuild"] = 860; // FIXME legacy
reply["ProtocolVersion"] = Global::protocolVersion;
// TODO: Make the core info configurable
- int uptime = startTime().secsTo(QDateTime::currentDateTime());
+ int uptime = startTime().secsTo(QDateTime::currentDateTime().toUTC());
int updays = uptime / 86400; uptime %= 86400;
int uphours = uptime / 3600; uptime %= 3600;
int upmins = uptime / 60;
quDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
}
#endif
-
+
} else {
// for the rest, we need an initialized connection
if(!clientInfo.contains(socket)) {
// DO NOT CALL ANY METHODS ON socket!!
socket = static_cast<QTcpSocket *>(sender());
-
+
QHash<QTcpSocket *, quint32>::iterator blockSizeIter = blocksizes.begin();
while(blockSizeIter != blocksizes.end()) {
if(blockSizeIter.key() == socket) {