X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=901b0a31d5e76bbeb5c3114df54a239ce594a2ea;hp=13a7fd90b1ac33b266a01a4da34fbd0ddc5139f9;hb=5c5d13eed99c43a4dff477ac736f98b5d7569837;hpb=452077390e20d20d20c9b1f97c3772a5690f58ce
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 13a7fd90..901b0a31 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -48,7 +48,7 @@ void Core::destroy() {
}
Core::Core() : storage(0) {
- startTime = QDateTime::currentDateTime(); // for uptime :)
+ _startTime = QDateTime::currentDateTime(); // for uptime :)
// Register storage backends here!
registerStorageBackend(new SqliteStorage(this));
@@ -353,7 +353,7 @@ bool Core::startListening(uint port) {
if(!success) {
qWarning("%s", qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(server.errorString())));
} else {
- qDebug() << "Listening for GUI clients on port" << server.serverPort();
+ qDebug() << "Listening for GUI clients on port" << server.serverPort() << "using protocol version" << Global::protocolVersion;
}
return success;
@@ -373,7 +373,7 @@ void Core::incomingConnection() {
QVariantMap clientInfo;
blocksizes.insert(socket, (quint32)0);
- qDebug() << "Client connected from" << qPrintable(socket->peerAddress().toString());
+ qDebug() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString());
if (!configured) {
server.close();
@@ -414,7 +414,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
"This core needs at least client/core protocol version %1.
"
"Please consider upgrading your client.").arg(Global::coreNeedsProtocol);
SignalProxy::writeDataToDevice(socket, reply);
- qWarning() << qPrintable(tr("Client %1 too old, rejecting.").arg(socket->peerAddress().toString()));
+ qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
socket->close(); return;
}
@@ -423,14 +423,14 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
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());
int updays = uptime / 86400; uptime %= 86400;
int uphours = uptime / 3600; uptime %= 3600;
int upmins = uptime / 60;
reply["CoreInfo"] = tr("Quassel Core Version %1
"
- "Built: %2
"
- "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuildDate)
- .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
+ "Built: %2
"
+ "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuildDate)
+ .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime().toString(Qt::TextDate));
#ifndef QT_NO_OPENSSL
SslServer *sslServer = qobject_cast(&server);
@@ -474,7 +474,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
#ifndef QT_NO_OPENSSL
// after we told the client that we are ssl capable we switch to ssl mode
if(supportSsl && msg["UseSsl"].toBool()) {
- qDebug() << "Starting TLS for Client:" << qPrintable(socket->peerAddress().toString());
+ qDebug() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString());
connect(sslSocket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &)));
sslSocket->startServerEncryption();
}
@@ -494,7 +494,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
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 %1 did not send an init message before trying to login, rejecting.").arg(socket->peerAddress().toString()));
+ qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
socket->close(); return;
}
if(msg["MsgType"] == "CoreSetupData") {
@@ -520,7 +520,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
}
reply["MsgType"] = "ClientLoginAck";
SignalProxy::writeDataToDevice(socket, reply);
- qDebug() << qPrintable(tr("Client %1 initialized and authenticated successfully as \"%2\" (UserId: %3).").arg(socket->peerAddress().toString(), msg["User"].toString()).arg(uid.toInt()));
+ qDebug() << 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);
}
}
@@ -532,9 +532,12 @@ void Core::clientDisconnected() {
if(socket) {
// here it's safe to call methods on socket!
qDebug() << 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)"));
// DO NOT CALL ANY METHODS ON socket!!
socket = static_cast(sender());
@@ -576,7 +579,7 @@ void Core::setupClientSession(QTcpSocket *socket, UserId uid) {
blocksizes.remove(socket);
clientInfo.remove(socket);
if(!sess) {
- qWarning() << qPrintable(tr("Could not initialize session for client %1!").arg(socket->peerAddress().toString()));
+ qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
socket->close();
}
sess->addClient(socket);