X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=29174b62b7ba973a18b8ffa1b4d4905fa49ebfcc;hp=b2e3ee431c10aa74d590ce5bf95571120ec3abe6;hb=ec7436e9be67c03be7f24b4e362db204c8d8315c;hpb=e049ffc61b5e260a49d73102a74c3821af827e77 diff --git a/src/core/core.cpp b/src/core/core.cpp index b2e3ee43..29174b62 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -37,9 +37,16 @@ #ifdef Q_OS_WIN32 # include #else +# include # include #endif /* Q_OS_WIN32 */ +// umask +#ifndef Q_OS_WIN32 +# include +# include +#endif /* Q_OS_WIN32 */ + // ============================== // Custom Events // ============================== @@ -73,6 +80,9 @@ void Core::destroy() { Core::Core() : _storage(0) { +#ifndef Q_OS_WIN32 + umask(S_IRWXG | S_IRWXO); +#endif /* Q_OS_WIN32 */ _startTime = QDateTime::currentDateTime().toUTC(); // for uptime :) Quassel::loadTranslation(QLocale::system()); @@ -509,10 +519,15 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { socket->close(); return; } + reply["ProtocolVersion"] = Quassel::buildInfo().protocolVersion; reply["CoreVersion"] = Quassel::buildInfo().fancyVersionString; reply["CoreDate"] = Quassel::buildInfo().buildDate; - reply["ProtocolVersion"] = Quassel::buildInfo().protocolVersion; - // TODO: Make the core info configurable + reply["CoreStartTime"] = startTime(); // v10 clients don't necessarily parse this, see below + + // FIXME: newer clients no longer use the hardcoded CoreInfo (for now), since it gets the + // time zone wrong. With the next protocol bump (10 -> 11), we should remove this + // or make it properly configurable. + int uptime = startTime().secsTo(QDateTime::currentDateTime().toUTC()); int updays = uptime / 86400; uptime %= 86400; int uphours = uptime / 3600; uptime %= 3600; @@ -523,6 +538,8 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { .arg(Quassel::buildInfo().buildDate) .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime().toString(Qt::TextDate)); + reply["CoreFeatures"] = (int)Quassel::features(); + #ifdef HAVE_SSL SslServer *sslServer = qobject_cast(&_server); QSslSocket *sslSocket = qobject_cast(socket); @@ -858,7 +875,7 @@ void Core::createUser() { return; } - if(_storage->addUser(username, password).isValid()) { + if(_configured && _storage->addUser(username, password).isValid()) { out << "Added user " << username << " successfully!" << endl; } else { qWarning() << "Unable to add user:" << qPrintable(username); @@ -896,7 +913,7 @@ void Core::changeUserPass(const QString &username) { return; } - if(_storage->updateUser(userId, password)) { + if(_configured && _storage->updateUser(userId, password)) { out << "Password changed successfuly!" << endl; } else { qWarning() << "Failed to change password!";