/***************************************************************************
- * Copyright (C) 2005-07 by The Quassel Team *
+ * Copyright (C) 2005-07 by the Quassel IRC Team *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
+ * (at your option) version 3. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#include "coresession.h"
#include "networkinfo.h"
-#include "synchronizer.h"
#include "ircserverhandler.h"
#include "userinputhandler.h"
_ircServerHandler(new IrcServerHandler(this)),
_userInputHandler(new UserInputHandler(this)),
_ctcpHandler(new CtcpHandler(this)),
- _networkInfo(new NetworkInfo(networkId, coreSession()->signalProxy(), this))
+ _networkInfo(new NetworkInfo(networkId, this))
{
networkInfo()->setNetworkName(net);
+ networkInfo()->setProxy(coreSession()->signalProxy());
}
Server::~Server() {
void Server::run() {
connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
- connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
+ connect(&socket, SIGNAL(disconnected()), this, SLOT(quit()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
connect(&socket, SIGNAL(readyRead()), this, SLOT(socketHasData()));
+ connect(this, SIGNAL(finished()), this, SLOT(threadFinished()));
exec();
}
//qDebug() << "Socket Error!";
}
-void Server::socketConnected( ) {
+void Server::socketConnected() {
emit connected(networkId());
putRawLine(QString("NICK :%1").arg(identity["NickList"].toStringList()[0])); // FIXME: try more nicks if error occurs
putRawLine(QString("USER %1 8 * :%2").arg(identity["Ident"].toString()).arg(identity["RealName"].toString()));
}
-void Server::socketDisconnected( ) {
+void Server::threadFinished() {
+ // the Socket::disconnected() is connect to this::quit()
+ // so after the event loop is finished we're beeing called
+ // and propagate the disconnect
emit disconnected(networkId());
- // propagate to networkInfo, so we can clear up
}
void Server::socketStateChanged(QAbstractSocket::SocketState state) {