#include <QString>
#include <QTimer>
#include <QTranslator>
+#include <QFile>
#include "global.h"
#include "logger.h"
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
- // Logger logger;
-
Global::registerMetaTypes();
Global::setupVersion();
// put core-only arguments here
Global::parser.addOption("port",'p',"The port quasselcore will listen at",QString("4242"));
Global::parser.addSwitch("norestore", 'n', "Don't restore last core's state");
+ Global::parser.addOption("logfile",'l',"Path to logfile","./quassel.log");
+ Global::parser.addOption("loglevel",'L',"Loglevel Debug|Info|Warning|Error","Info");
#endif // BUILD_QTUI
#ifndef BUILD_CORE
// put client-only arguments here
return 1;
}
+ /*
+ This is an initial check if logfile is writable since the warning would spam stdout if done
+ in current Logger implementation. Can be dropped whenever the logfile is only opened once.
+ */
+ if(Global::runMode != Global::ClientOnly) {
+ QFile logFile;
+ if(!Global::parser.value("logfile").isEmpty()) {
+ logFile.setFileName(Global::parser.value("logfile"));
+ if(!logFile.open(QIODevice::Append | QIODevice::Text))
+ qWarning("Warning: Couldn't open logfile '%s' - will log to stdout instead",qPrintable(logFile.fileName()));
+ logFile.close();
+ }
+ else qWarning("Warning: Couldn't open logfile '%s' - will log to stdout instead",qPrintable(logFile.fileName()));
+ }
+
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
// Set up i18n support
#include "abstractsqlstorage.h"
+#include "logger.h"
+
#include <QSqlError>
#include <QSqlQuery>
return db;
if(!openDb()) {
- qWarning() << "Unable to Open Database" << displayName();
- qWarning() << " -" << db.lastError().text();
+ quWarning() << "Unable to Open Database " << displayName();
+ quWarning() << " - " << db.lastError().text();
}
return QSqlDatabase::database("quassel_connection");
return false;
if(installedSchemaVersion() == -1) {
- qDebug() << "Storage Schema is missing!";
+ quError() << "Storage Schema is missing!";
return false;
}
if(installedSchemaVersion() > schemaVersion()) {
- qWarning() << "Installed Schema is newer then any known Version.";
+ quError() << "Installed Schema is newer then any known Version.";
return false;
}
if(installedSchemaVersion() < schemaVersion()) {
- qWarning() << "Installed Schema is not up to date. Upgrading...";
+ quWarning() << "Installed Schema is not up to date. Upgrading...";
if(!upgradeDb())
return false;
}
- qDebug() << "Storage Backend is ready. Quassel Schema Version:" << installedSchemaVersion();
+ quInfo() << "Storage Backend is ready. Quassel Schema Version: " << installedSchemaVersion();
return true;
}
QFileInfo queryInfo(QString(":/SQL/%1/%2/%3.sql").arg(displayName()).arg(version).arg(queryName));
if(!queryInfo.exists() || !queryInfo.isFile() || !queryInfo.isReadable()) {
- qWarning() << "Unable to read SQL-Query" << queryName << "for engine" << displayName();
+ quError() << "Unable to read SQL-Query " << queryName << " for engine " << displayName();
return QString();
}
Q_UNUSED(settings)
QSqlDatabase db = logDb();
if(!db.isOpen()) {
- qWarning() << "Unable to setup Logging Backend!";
+ quError() << "Unable to setup Logging Backend!";
return false;
}
foreach(QString queryString, setupQueries()) {
QSqlQuery query = db.exec(queryString);
if(!watchQuery(&query)) {
- qWarning() << "Unable to setup Logging Backend!";
+ quError() << "Unable to setup Logging Backend!";
return false;
}
}
foreach(QString queryString, upgradeQueries(ver)) {
QSqlQuery query = db.exec(queryString);
if(!watchQuery(&query)) {
- qWarning() << "Unable to upgrade Logging Backend!";
+ quError() << "Unable to upgrade Logging Backend!";
return false;
}
}
bool AbstractSqlStorage::watchQuery(QSqlQuery *query) {
if(query->lastError().isValid()) {
- qWarning() << "unhandled Error in QSqlQuery!";
- qWarning() << " last Query:\n" << query->lastQuery();
- qWarning() << " executed Query:\n" << query->executedQuery();
- qWarning() << " bound Values:" << query->boundValues();
- qWarning() << " Error Number:" << query->lastError().number();
- qWarning() << " Error Message:" << query->lastError().text();
- qWarning() << " Driver Message:" << query->lastError().driverText();
- qWarning() << " DB Message:" << query->lastError().databaseText();
+ quError() << "unhandled Error in QSqlQuery!";
+ quError() << " last Query:\n" << query->lastQuery();
+ quError() << " executed Query:\n" << query->executedQuery();
+ quError() << " bound Values: ";
+ QList<QVariant> list = query->boundValues().values();
+ for (int i = 0; i < list.size(); ++i)
+ quError() << i << ": " << list.at(i).toString().toAscii().data();
+ quError() << " Error Number: " << query->lastError().number();
+ quError() << " Error Message: " << query->lastError().text();
+ quError() << " Driver Message: " << query->lastError().driverText();
+ quError() << " DB Message: " << query->lastError().databaseText();
return false;
}
#include <QMetaMethod>
#include "util.h"
+#include "logger.h"
BasicHandler::BasicHandler(NetworkConnection *parent)
: QObject(parent),
if(!handlerHash().contains(handler)) {
if(defaultHandler == -1) {
- qWarning() << QString("No such Handler: %1::handle%2").arg(metaObject()->className(), handler);
+ quWarning() << QString("No such Handler: %1::handle%2").arg(metaObject()->className(), handler);
return;
} else {
void *param[] = {0, Q_ARG(QString, member).data(), val0.data(), val1.data(), val2.data(), val3.data(), val4.data(),
#include "signalproxy.h"
#include "sqlitestorage.h"
#include "network.h"
+#include "logger.h"
#include "util.h"
registerStorageBackend(new SqliteStorage(this));
if(!_storageBackends.count()) {
- qWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
- qWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
+ quWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
+ quWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
"Qt library with the sqlite plugin enabled in order for quasselcore\n"
"to work."));
exit(1); // TODO make this less brutal (especially for mono client -> popup)
CoreSettings cs;
if(!(configured = initStorage(cs.storageSettings().toMap()))) {
- qWarning("Core is currently not configured! Please connect with a Quassel Client for basic setup.");
+ quWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
// try to migrate old settings
QVariantMap old = cs.oldDbSettings().toMap();
QVariantMap newSettings;
newSettings["Backend"] = "SQLite";
if((configured = initStorage(newSettings))) {
- qWarning("...but thankfully I found some old settings to migrate!");
+ quWarning() << "...but thankfully I found some old settings to migrate!";
cs.setStorageSettings(newSettings);
}
}
return;
}
if(instance()->sessions.count()) {
- qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
+ quWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
return;
}
CoreSettings s;
*/
QVariantList activeSessions = s.coreState().toMap()["ActiveSessions"].toList();
if(activeSessions.count() > 0) {
- qDebug() << "Restoring previous core state...";
+ quInfo() << "Restoring previous core state...";
foreach(QVariant v, activeSessions) {
UserId user = v.value<UserId>();
instance()->createSession(user, true);
}
CoreSettings s;
s.setStorageSettings(setupData);
- qDebug() << qPrintable(tr("Creating admin user..."));
+ quInfo() << qPrintable(tr("Creating admin user..."));
mutex.lock();
storage->addUser(user, password);
mutex.unlock();
if(_storageBackends.contains(backend)) {
storage = _storageBackends[backend];
} else {
- qWarning() << "Selected storage backend is not available:" << backend;
+ quError() << "Selected storage backend is not available:" << backend;
return configured = false;
}
if(!storage->init(dbSettings)) {
if(!setup || !(storage->setup(dbSettings) && storage->init(dbSettings))) {
- qWarning() << "Could not init storage!";
+ quError() << "Could not init storage!";
storage = 0;
return configured = false;
}
}
if(!success) {
- qWarning("%s", qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(server.errorString())));
+ quError() << 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() << "using protocol version" << Global::protocolVersion;
+ quInfo() << "Listening for GUI clients on port " << server.serverPort() << " using protocol version " << Global::protocolVersion;
}
return success;
void Core::stopListening() {
server.close();
- qDebug() << "No longer listening for GUI clients.";
+ quInfo() << "No longer listening for GUI clients.";
}
void Core::incomingConnection() {
QVariantMap clientInfo;
blocksizes.insert(socket, (quint32)0);
- qDebug() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString());
+ quInfo() << qPrintable(tr("Client connected from ")) << qPrintable(socket->peerAddress().toString());
if (!configured) {
server.close();
- qDebug() << "Closing server for basic setup.";
+ quDebug() << "Closing server for basic setup.";
}
}
}
void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
if(!msg.contains("MsgType")) {
// Client is way too old, does not even use the current init format
- qWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
+ quWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
socket->close();
return;
}
"This core needs at least client/core protocol version %1.<br>"
"Please consider upgrading your client.").arg(Global::coreNeedsProtocol);
SignalProxy::writeDataToDevice(socket, reply);
- qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
+ quWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
socket->close(); return;
}
#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() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString());
+ quDebug() << qPrintable(tr("Starting TLS for Client:")) << qPrintable(socket->peerAddress().toString());
connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
sslSocket->startServerEncryption();
}
#ifndef QT_NO_COMPRESS
if(supportsCompression && msg["UseCompression"].toBool()) {
socket->setProperty("UseCompression", true);
- qDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
+ quDebug() << "Using compression for Client: " << qPrintable(socket->peerAddress().toString());
}
#endif
reply["MsgType"] = "ClientLoginReject";
reply["Error"] = tr("<b>Client not initialized!</b><br>You need to send an init message before trying to login.");
SignalProxy::writeDataToDevice(socket, reply);
- qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
+ quWarning() << 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") {
}
reply["MsgType"] = "ClientLoginAck";
SignalProxy::writeDataToDevice(socket, reply);
- 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()));
+ quInfo() << 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);
}
}
QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
if(socket) {
// here it's safe to call methods on socket!
- qDebug() << qPrintable(tr("Non-authed client disconnected.")) << qPrintable(socket->peerAddress().toString());
+ quInfo() << 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)"));
+ quDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)"));
// DO NOT CALL ANY METHODS ON socket!!
socket = static_cast<QTcpSocket *>(sender());
blocksizes.remove(socket);
clientInfo.remove(socket);
if(!sess) {
- qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
+ quWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
socket->close();
}
sess->addClient(socket);
SessionThread *Core::createSession(UserId uid, bool restore) {
if(sessions.contains(uid)) {
- qWarning() << "Calling createSession() when a session for the user already exists!";
+ quWarning() << "Calling createSession() when a session for the user already exists!";
return 0;
}
SessionThread *sess = new SessionThread(uid, restore, this);
void Core::socketError(QAbstractSocket::SocketError err) {
QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(sender());
if(socket && err != QAbstractSocket::RemoteHostClosedError)
- qDebug() << "Core::socketError()" << socket << err << socket->errorString();
+ quWarning() << "Core::socketError()" << socket << err << socket->errorString();
}
#include "corenetwork.h"
#include "coresession.h"
+#include "logger.h"
+
CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session)
: Network(networkid, session),
_coreSession(session)
void CoreNetwork::requestConnect() const {
if(connectionState() != Disconnected) {
- qWarning() << "Requesting connect while already being connected!";
+ quWarning() << "Requesting connect while already being connected!";
return;
}
emit connectRequested(networkId());
void CoreNetwork::requestDisconnect() const {
if(connectionState() == Disconnected) {
- qWarning() << "Requesting disconnect while not being connected!";
+ quWarning() << "Requesting disconnect while not being connected!";
return;
}
emit disconnectRequested(networkId());
#include "util.h"
#include "coreusersettings.h"
+#include "logger.h"
CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
: QObject(parent),
foreach(IdentityId id, s.identityIds()) {
Identity *i = new Identity(s.identity(id), this);
if(!i->isValid()) {
- qWarning() << QString("Invalid identity! Removing...");
+ quWarning() << "Invalid identity! Removing...";
s.removeIdentity(id);
delete i;
continue;
}
if(_identities.contains(i->id())) {
- qWarning() << "Duplicate identity, ignoring!";
+ quWarning() << "Duplicate identity, ignoring!";
delete i;
continue;
}
void CoreSession::connectToNetwork(NetworkId id) {
CoreNetwork *net = network(id);
if(!net) {
- qWarning() << "Connect to unknown network requested! net:" << id << "user:" << user();
+ quWarning() << "Connect to unknown network requested! net: " << id << " user: " << user();
return;
}
void CoreSession::addClient(QObject *dev) { // this is QObject* so we can use it in signal connections
QIODevice *device = qobject_cast<QIODevice *>(dev);
if(!device) {
- qWarning() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!";
+ quError() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!";
} else {
signalProxy()->addPeer(device);
QVariantMap reply;
// no checks for validity check - privateslot...
QTcpSocket *socket = qobject_cast<QTcpSocket *>(iodev);
if(socket)
- qDebug() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt()));
+ quInfo() << qPrintable(tr("Client ")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr(" disconnected (UserId: %1).").arg(user().toInt()));
else
- qDebug() << "Local client disconnedted.";
+ quInfo() << "Local client disconnedted.";
disconnect(socket, 0, this, 0);
socket->deleteLater();
}
if(conn) {
conn->userInput(bufinfo, msg);
} else {
- qWarning() << "Trying to send to unconnected network:" << msg;
+ quWarning() << "Trying to send to unconnected network:" << msg;
}
}
void CoreSession::updateIdentity(const Identity &id) {
if(!_identities.contains(id.id())) {
- qWarning() << "Update request for unknown identity received!";
+ quWarning() << "Update request for unknown identity received!";
return;
}
_identities[id.id()]->update(id);
Core::createNetwork(user(), info);
if(!info.networkId.isValid()) {
- qWarning() << qPrintable(tr("CoreSession::createNetwork(): Got invalid networkId from Core when trying to create network %1!").arg(info.networkName));
+ quWarning() << qPrintable(tr("CoreSession::createNetwork(): Got invalid networkId from Core when trying to create network %1!").arg(info.networkName));
return;
}
signalProxy()->synchronize(net);
emit networkCreated(id);
} else {
- qWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
+ quWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
updateNetwork(info);
}
}
// FIXME: move to CoreNetwork
void CoreSession::updateNetwork(const NetworkInfo &info) {
if(!_networks.contains(info.networkId)) {
- qWarning() << "Update request for unknown network received!";
+ quWarning() << "Update request for unknown network received!";
return;
}
_networks[info.networkId]->setNetworkInfo(info);
void CoreSession::removeBufferRequested(BufferId bufferId) {
BufferInfo bufferInfo = Core::getBufferInfo(user(), bufferId);
if(!bufferInfo.isValid()) {
- qWarning() << "CoreSession::removeBufferRequested(): invalid BufferId:" << bufferId << "for User:" << user();
+ quWarning() << "CoreSession::removeBufferRequested(): invalid BufferId: " << bufferId << " for User: " << user();
return;
}
if(bufferInfo.type() == BufferInfo::StatusBuffer) {
- qWarning() << "CoreSession::removeBufferRequested(): Status Buffers cannot be removed!";
+ quWarning() << "CoreSession::removeBufferRequested(): Status Buffers cannot be removed!";
return;
}
if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
CoreNetwork *net = network(bufferInfo.networkId());
if(!net) {
- qWarning() << "CoreSession::removeBufferRequested(): Received BufferInfo with unknown networkId!";
+ quWarning() << "CoreSession::removeBufferRequested(): Received BufferInfo with unknown networkId!";
return;
}
IrcChannel *chan = net->ircChannel(bufferInfo.bufferName());
if(chan) {
- qWarning() << "CoreSession::removeBufferRequested(): Unable to remove Buffer for joined Channel:" << bufferInfo.bufferName();
+ quWarning() << "CoreSession::removeBufferRequested(): Unable to remove Buffer for joined Channel: " << bufferInfo.bufferName();
return;
}
}
#include "ircuser.h"
#include "ircchannel.h"
+#include "logger.h"
#include <QDebug>
void IrcServerHandler::handleServerMsg(QByteArray msg) {
try {
if(msg.isEmpty()) {
- qWarning() << "Received empty string from server!";
+ quWarning() << "Received empty string from server!";
return;
}
QList<QByteArray> params = msg.split(' ');
if(!trailing.isEmpty()) params << trailing;
if(params.count() < 1) {
- qWarning() << "Received invalid string from server!";
+ quWarning() << "Received invalid string from server!";
return;
}
foo.remove(0, 1);
prefix = foo;
if(params.count() < 1) {
- qWarning() << "Received invalid string from server!";
+ quWarning() << "Received invalid string from server!";
return;
}
foo = serverDecode(params.takeFirst());
uint num = cmd.toUInt();
if(num > 0) {
if(params.count() == 0) {
- qWarning() << "Message received from server violates RFC and is ignored!";
+ quWarning() << "Message received from server violates RFC and is ignored!";
return;
}
params.removeFirst();
else
channel->removeUserMode(ircUser, QString(modes[c]));
} else {
- qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+ quWarning() << "Received MODE with too few parameters: " << serverDecode(params);
}
paramOffset++;
} else {
if(paramOffset < params.count()) {
value = params[paramOffset];
} else {
- qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+ quWarning() << "Received MODE with too few parameters: " << serverDecode(params);
}
paramOffset++;
}
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
- qWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
+ quWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
return;
}
QString newnick = serverDecode(params[0]);
IrcUser *ircuser = network()->updateNickFromMask(prefix);
QString channel = serverDecode(params[0]);
if(!ircuser) {
- qWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
+ quWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
return;
}
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
- qWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
+ quWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
return;
}
if(params.isEmpty()) {
- qWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
+ quWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from: " << prefix;
return;
}
IrcChannel *channel = network()->ircChannel(channelname);
if(!channel) {
- qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
+ quWarning() << "IrcServerHandler::handle353(): received unknown target channel: " << channelname;
return;
}
bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams) {
if(params.count() < minParams) {
- qWarning() << qPrintable(methodName) << "requieres" << minParams << "parameters but received only" << params.count() << serverDecode(params);
+ quWarning() << qPrintable(methodName) << " requires " << minParams << " parameters but received only " << params.count() << serverDecode(params);
return false;
} else {
return true;
#include "userinputhandler.h"
#include "ctcphandler.h"
+#include "logger.h"
+
NetworkConnection::NetworkConnection(Network *network, CoreSession *session)
: QObject(network),
_connectionState(Network::Disconnected),
QVariantList serverList = network()->serverList();
Identity *identity = coreSession()->identity(network()->identity());
if(!serverList.count()) {
- qWarning() << "Server list empty, ignoring connect request!";
+ quWarning() << "Server list empty, ignoring connect request!";
return;
}
if(!identity) {
- qWarning() << "Invalid identity configures, ignoring connect request!";
+ quWarning() << "Invalid identity configures, ignoring connect request!";
return;
}
// use a random server?
void NetworkConnection::socketError(QAbstractSocket::SocketError) {
_previousConnectionAttemptFailed = true;
- qDebug() << qPrintable(tr("Could not connect to %1 (%2)").arg(network()->networkName(), socket.errorString()));
+ quWarning() << qPrintable(tr("Could not connect to %1 (%2)").arg(network()->networkName(), socket.errorString()));
emit connectionError(socket.errorString());
emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Connection failure: %1").arg(socket.errorString()));
network()->emitConnectionError(socket.errorString());
//emit connected(networkId()); initialize first!
Identity *identity = coreSession()->identity(network()->identity());
if(!identity) {
- qWarning() << "Identity invalid!";
+ quError() << "Identity invalid!";
disconnectFromIrc();
return;
}
void NetworkConnection::doAutoReconnect() {
if(connectionState() != Network::Disconnected && connectionState() != Network::Reconnecting) {
- qWarning() << "NetworkConnection::doAutoReconnect(): Cannot reconnect while not being disconnected!";
+ quWarning() << "NetworkConnection::doAutoReconnect(): Cannot reconnect while not being disconnected!";
return;
}
if(_autoReconnectCount > 0) _autoReconnectCount--;
#include "network.h"
#include "util.h"
+#include "logger.h"
SqliteStorage::SqliteStorage(QObject *parent)
: AbstractSqlStorage(parent)
if(withTransaction) {
sync();
if(!logDb().transaction()) {
- qWarning() << "SqliteStorage::removeNetwork(): cannot start transaction. continuing with out rollback support!";
+ quWarning() << "SqliteStorage::removeNetwork(): cannot start transaction. continuing with out rollback support!";
withTransaction = false;
}
}
query->exec();
if(!query->first()) {
watchQuery(query);
- qWarning() << "unable to create BufferInfo for:" << user << networkId << buffer;
+ quWarning() << "unable to create BufferInfo for: " << user << networkId << buffer;
return BufferInfo();
}
}
BufferInfo bufferInfo = BufferInfo(query->value(0).toInt(), networkId, (BufferInfo::Type)query->value(1).toInt(), 0, buffer);
if(query->next()) {
- qWarning() << "SqliteStorage::getBufferInfo(): received more then one Buffer!";
- qWarning() << " Query:" << query->lastQuery();
- qWarning() << " bound Values:" << query->boundValues();
+ quError() << "SqliteStorage::getBufferInfo(): received more then one Buffer!";
+ quError() << " Query: " << query->lastQuery();
+ quError() << " bound Values:";
+ QList<QVariant> list = query->boundValues().values();
+ for (int i = 0; i < list.size(); ++i)
+ quError() << i << ": " << list.at(i).toString().toAscii().data();
Q_ASSERT(false);
}
getPasswordsQuery.exec();
if(!watchQuery(&getPasswordsQuery)) {
- qWarning() << "unable to migrate to new password format!";
+ quError() << "unable to migrate to new password format!";
return false;
}
watchQuery(&setPasswordsQuery);
}
- qDebug() << "successfully migrated passwords!";
+ quDebug() << "successfully migrated passwords!";
return true;
}
#include <QFile>
#include <QDebug>
+#include "logger.h"
#include "util.h"
#ifndef QT_NO_OPENSSL
_certIsValid = !_cert.isNull() && _cert.isValid() && !_key.isNull();
if(!_certIsValid) {
- qWarning() << "SslServer: SSL Certificate is either missing or has a wrong format!\n"
+ quWarning() << "SslServer: SSL Certificate is either missing or has a wrong format!\n"
<< " Quassel Core will still work, but cannot provide SSL for client connections.\n"
<< " Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support.";
}