X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fcore.cpp;h=f413bbf20d61d9a4819c47365e5f170195a47894;hb=018d1d001bf3c051b55525f523d933a8d694e071;hp=21e7c16f9f1b2926592ea6dc2ffac17e8cde193a;hpb=444e91f948b435e652205c4d0f1148906e9e86dc;p=quassel.git diff --git a/src/core/core.cpp b/src/core/core.cpp index 21e7c16f..f413bbf2 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -207,6 +207,16 @@ void Core::syncStorage() { } /*** Storage Access ***/ +void Core::setUserSetting(UserId userId, const QString &settingName, const QVariant &data) { + QMutexLocker locker(&mutex); + instance()->storage->setUserSetting(userId, settingName, data); +} + +QVariant Core::getUserSetting(UserId userId, const QString &settingName, const QVariant &data) { + QMutexLocker locker(&mutex); + return instance()->storage->getUserSetting(userId, settingName, data); +} + bool Core::createNetwork(UserId user, NetworkInfo &info) { QMutexLocker locker(&mutex); NetworkId networkId = instance()->storage->createNetwork(user, info); @@ -292,9 +302,9 @@ QList Core::requestMsgRange(UserId user, BufferId buffer, int first, in return instance()->storage->requestMsgRange(user, buffer, first, last); } -QList Core::requestBuffers(UserId user, QDateTime since) { +QList Core::requestBuffers(UserId user) { QMutexLocker locker(&mutex); - return instance()->storage->requestBuffers(user, since); + return instance()->storage->requestBuffers(user); } bool Core::removeBuffer(const UserId &user, const BufferId &bufferId) { @@ -391,9 +401,16 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { #else bool supportSsl = false; #endif + +#ifndef QT_NO_COMPRESS + bool supportsCompression = true; +#else + bool supportsCompression = false; +#endif reply["SupportSsl"] = supportSsl; - // switch to ssl after client has been informed about our capabilities (see below) + reply["SupportsCompression"] = supportsCompression; + // switch to ssl/compression after client has been informed about our capabilities (see below) reply["LoginEnabled"] = true; @@ -429,12 +446,19 @@ 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() << "Starting TLS for Client:" << qPrintable(socket->peerAddress().toString()); connect(sslSocket, SIGNAL(sslErrors(const QList &)), this, 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()); + } +#endif + } else { // for the rest, we need an initialized connection if(!clientInfo.contains(socket)) { @@ -468,7 +492,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { } reply["MsgType"] = "ClientLoginAck"; SignalProxy::writeDataToDevice(socket, reply); - qDebug() << qPrintable(tr("Client %1 initialized and authentificated successfully as \"%2\" (UserId: %3).").arg(socket->peerAddress().toString(), msg["User"].toString()).arg(uid.toInt())); + qDebug() << qPrintable(tr("Client %1 initialized and authenticated successfully as \"%2\" (UserId: %3).").arg(socket->peerAddress().toString(), msg["User"].toString()).arg(uid.toInt())); setupClientSession(socket, uid); } }