common: Port remote nicks to NickHighlightMatcher
[quassel.git] / src / client / client.cpp
index 32f599d..c20fa8b 100644 (file)
@@ -114,8 +114,7 @@ Client::Client(QObject *parent)
     _messageProcessor(0),
     _coreAccountModel(new CoreAccountModel(this)),
     _coreConnection(new CoreConnection(this)),
-    _connected(false),
-    _debugLog(&_debugLogBuffer)
+    _connected(false)
 {
     _signalProxy->synchronize(_ircListHelper);
 }
@@ -215,6 +214,16 @@ void Client::onDbUpgradeInProgress(bool inProgress)
 }
 
 
+void Client::onExitRequested(int exitCode, const QString &reason)
+{
+    if (!reason.isEmpty()) {
+        qCritical() << reason;
+        emit exitRequested(reason);
+    }
+    QCoreApplication::exit(exitCode);
+}
+
+
 /*** Network handling ***/
 
 QList<NetworkId> Client::networkIds()
@@ -435,6 +444,9 @@ void Client::setSyncedToCore()
     Q_ASSERT(!_highlightRuleManager);
     _highlightRuleManager = new HighlightRuleManager(this);
     p->synchronize(highlightRuleManager());
+    // Listen to network removed events
+    connect(this, SIGNAL(networkRemoved(NetworkId)),
+        _highlightRuleManager, SLOT(networkRemoved(NetworkId)));
 
 /*  not ready yet
     // create TransferManager and DccConfig if core supports them
@@ -753,48 +765,3 @@ void Client::corePasswordChanged(PeerPtr, bool success)
         coreAccountModel()->save();
     emit passwordChanged(success);
 }
-
-
-#if QT_VERSION < 0x050000
-void Client::logMessage(QtMsgType type, const char *msg)
-{
-    fprintf(stderr, "%s\n", msg);
-    fflush(stderr);
-    if (type == QtFatalMsg) {
-        Quassel::logFatalMessage(msg);
-    }
-    else {
-        QString msgString = QString("%1\n").arg(msg);
-
-        //Check to see if there is an instance around, else we risk recursions
-        //when calling instance() and creating new ones.
-        if (!instanceExists())
-            return;
-
-        instance()->_debugLog << msgString;
-        emit instance()->logUpdated(msgString);
-    }
-}
-#else
-void Client::logMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
-{
-    Q_UNUSED(context);
-
-    fprintf(stderr, "%s\n", msg.toLocal8Bit().constData());
-    fflush(stderr);
-    if (type == QtFatalMsg) {
-        Quassel::logFatalMessage(msg.toLocal8Bit().constData());
-    }
-    else {
-        QString msgString = QString("%1\n").arg(msg);
-
-        //Check to see if there is an instance around, else we risk recursions
-        //when calling instance() and creating new ones.
-        if (!instanceExists())
-            return;
-
-        instance()->_debugLog << msgString;
-        emit instance()->logUpdated(msgString);
-    }
-}
-#endif