X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=b7714e391ddef269acb5738625ffc3c9f0dd45cc;hb=a801d1eab5fcb932c88f2e3953e5626083d4ec59;hp=c0b9a5036d3d88e3d563a9a736e7533f2b9f6207;hpb=e95dffeaa5d005caa689f8fe34678b95f8fc6736;p=quassel.git diff --git a/src/core/core.cpp b/src/core/core.cpp index c0b9a503..b7714e39 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -65,7 +65,7 @@ void Core::init() { CoreSettings cs; if(!(configured = initStorage(cs.storageSettings().toMap()))) { - qWarning("Core is currently not configured!"); + qWarning("Core is currently not configured! Please connect with a Quassel Client for basic setup."); // try to migrate old settings QVariantMap old = cs.oldDbSettings().toMap(); @@ -105,7 +105,7 @@ void Core::saveState() { void Core::restoreState() { if(!instance()->configured) { - qWarning() << qPrintable(tr("Cannot restore a state for an unconfigured core!")); + // qWarning() << qPrintable(tr("Cannot restore a state for an unconfigured core!")); return; } if(instance()->sessions.count()) { @@ -141,7 +141,7 @@ QString Core::setupCore(const QVariant &setupData_) { return tr("Could not setup storage!"); } CoreSettings s; - //s.setStorageSettings(msg); + s.setStorageSettings(setupData); qDebug() << qPrintable(tr("Creating admin user...")); mutex.lock(); storage->addUser(user, password); @@ -235,11 +235,41 @@ NetworkId Core::networkId(UserId user, const QString &network) { return instance()->storage->getNetworkId(user, network); } +QList Core::connectedNetworks(UserId user) { + QMutexLocker locker(&mutex); + return instance()->storage->connectedNetworks(user); +} + +void Core::setNetworkConnected(UserId user, const NetworkId &networkId, bool isConnected) { + QMutexLocker locker(&mutex); + return instance()->storage->setNetworkConnected(user, networkId, isConnected); +} + +QHash Core::persistentChannels(UserId user, const NetworkId &networkId) { + QMutexLocker locker(&mutex); + return instance()->storage->persistentChannels(user, networkId); +} + +void Core::setChannelPersistent(UserId user, const NetworkId &networkId, const QString &channel, bool isJoined) { + QMutexLocker locker(&mutex); + return instance()->storage->setChannelPersistent(user, networkId, channel, isJoined); +} + +void Core::setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key) { + QMutexLocker locker(&mutex); + return instance()->storage->setPersistentChannelKey(user, networkId, channel, key); +} + BufferInfo Core::bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer) { QMutexLocker locker(&mutex); return instance()->storage->getBufferInfo(user, networkId, type, buffer); } +BufferInfo Core::getBufferInfo(UserId user, const BufferId &bufferId) { + QMutexLocker locker(&mutex); + return instance()->storage->getBufferInfo(user, bufferId); +} + MsgId Core::storeMessage(const Message &message) { QMutexLocker locker(&mutex); return instance()->storage->logMessage(message); @@ -265,14 +295,24 @@ QList Core::requestBuffers(UserId user, QDateTime since) { return instance()->storage->requestBuffers(user, since); } -void Core::setBufferLastSeen(UserId user, const BufferId &bufferId, const QDateTime &seenDate) { +bool Core::removeBuffer(const UserId &user, const BufferId &bufferId) { + QMutexLocker locker(&mutex); + return instance()->storage->removeBuffer(user, bufferId); +} + +BufferId Core::renameBuffer(const UserId &user, const NetworkId &networkId, const QString &newName, const QString &oldName) { + QMutexLocker locker(&mutex); + return instance()->storage->renameBuffer(user, networkId, newName, oldName); +} + +void Core::setBufferLastSeenMsg(UserId user, const BufferId &bufferId, const MsgId &msgId) { QMutexLocker locker(&mutex); - return instance()->storage->setBufferLastSeen(user, bufferId, seenDate); + return instance()->storage->setBufferLastSeenMsg(user, bufferId, msgId); } -QHash Core::bufferLastSeenDates(UserId user) { +QHash Core::bufferLastSeenMsgIds(UserId user) { QMutexLocker locker(&mutex); - return instance()->storage->bufferLastSeenDates(user); + return instance()->storage->bufferLastSeenMsgIds(user); } /*** Network Management ***/ @@ -337,7 +377,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { int updays = uptime / 86400; uptime %= 86400; int uphours = uptime / 3600; uptime %= 3600; int upmins = uptime / 60; - reply["CoreInfo"] = tr("Quassel Core Version %1 (Build >= %2)
" + reply["CoreInfo"] = tr("Quassel Core Version %1 (Build ≥ %2)
" "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuild) .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));