+void CoreSession::saveSessionState() const {
+
+}
+
+void CoreSession::restoreSessionState() {
+ QList<NetworkId> nets = Core::connectedNetworks(user());
+ foreach(NetworkId id, nets) {
+ connectToNetwork(id);
+ }
+}
+
+void CoreSession::updateBufferInfo(UserId uid, const BufferInfo &bufinfo) {
+ if(uid == user()) emit bufferInfoUpdated(bufinfo);
+}
+
+void CoreSession::connectToNetwork(NetworkId id) {
+ CoreNetwork *net = network(id);
+ if(!net) {
+ qWarning() << "Connect to unknown network requested! net:" << id << "user:" << user();
+ return;
+ }
+
+ NetworkConnection *conn = networkConnection(id);
+ if(!conn) {
+ conn = new NetworkConnection(net, this);
+ _connections[id] = conn;
+ attachNetworkConnection(conn);
+ }
+ conn->connectToIrc();
+}
+
+void CoreSession::attachNetworkConnection(NetworkConnection *conn) {
+ connect(conn, SIGNAL(connected(NetworkId)), this, SLOT(networkConnected(NetworkId)));
+ connect(conn, SIGNAL(quitRequested(NetworkId)), this, SLOT(networkDisconnected(NetworkId)));
+
+ // I guess we don't need these anymore, client-side can just connect the network's signals directly
+ //signalProxy()->attachSignal(conn, SIGNAL(connected(NetworkId)), SIGNAL(networkConnected(NetworkId)));
+ //signalProxy()->attachSignal(conn, SIGNAL(disconnected(NetworkId)), SIGNAL(networkDisconnected(NetworkId)));
+
+ connect(conn, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags)),
+ this, SLOT(recvMessageFromServer(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags)));
+ connect(conn, SIGNAL(displayStatusMsg(QString)), this, SLOT(recvStatusMsgFromServer(QString)));
+
+ connect(conn, SIGNAL(nickChanged(const NetworkId &, const QString &, const QString &)),
+ this, SLOT(renameBuffer(const NetworkId &, const QString &, const QString &)));
+ connect(conn, SIGNAL(channelJoined(NetworkId, const QString &, const QString &)),
+ this, SLOT(channelJoined(NetworkId, const QString &, const QString &)));
+ connect(conn, SIGNAL(channelParted(NetworkId, const QString &)),
+ this, SLOT(channelParted(NetworkId, const QString &)));
+}
+
+void CoreSession::disconnectFromNetwork(NetworkId id) {
+ if(!_connections.contains(id))
+ return;
+
+ //_connections[id]->disconnectFromIrc();
+ _connections[id]->userInputHandler()->handleQuit(BufferInfo(), QString());
+}
+
+void CoreSession::networkStateRequested() {
+}
+