- p->attachSignal(storage, SIGNAL(bufferInfoUpdated(BufferInfo)));
- p->attachSignal(this, SIGNAL(sessionDataChanged(const QString &, const QVariant &)), SIGNAL(coreSessionDataChanged(const QString &, const QVariant &)));
- p->attachSlot(SIGNAL(clientSessionDataChanged(const QString &, const QVariant &)), this, SLOT(storeSessionData(const QString &, const QVariant &)));
- /* Autoconnect. (When) do we actually do this?
- QStringList list;
- QVariantMap networks = retrieveSessionData("Networks").toMap();
- foreach(QString net, networks.keys()) {
- if(networks[net].toMap()["AutoConnect"].toBool()) {
- list << net;
- }
- } qDebug() << list;
- if(list.count()) connectToIrc(list);
- */
+
+ p->attachSignal(this, SIGNAL(identityCreated(const Identity &)));
+ p->attachSignal(this, SIGNAL(identityRemoved(IdentityId)));
+ p->attachSlot(SIGNAL(createIdentity(const Identity &)), this, SLOT(createIdentity(const Identity &)));
+ p->attachSlot(SIGNAL(updateIdentity(const Identity &)), this, SLOT(updateIdentity(const Identity &)));
+ p->attachSlot(SIGNAL(removeIdentity(IdentityId)), this, SLOT(removeIdentity(IdentityId)));
+
+ p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
+ p->attachSignal(this, SIGNAL(networkRemoved(NetworkId)));
+ p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &)), this, SLOT(createNetwork(const NetworkInfo &)));
+ p->attachSlot(SIGNAL(updateNetwork(const NetworkInfo &)), this, SLOT(updateNetwork(const NetworkInfo &)));
+ p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
+
+ loadSettings();
+ initScriptEngine();
+
+ // init BufferSyncer
+ QHash<BufferId, MsgId> lastSeenHash = Core::bufferLastSeenMsgIds(user());
+ foreach(BufferId id, lastSeenHash.keys())
+ _bufferSyncer->requestSetLastSeenMsg(id, lastSeenHash[id]);
+
+ connect(_bufferSyncer, SIGNAL(lastSeenMsgSet(BufferId, MsgId)), this, SLOT(storeBufferLastSeenMsg(BufferId, MsgId)));
+ connect(_bufferSyncer, SIGNAL(removeBufferRequested(BufferId)), this, SLOT(removeBufferRequested(BufferId)));
+ connect(this, SIGNAL(bufferRemoved(BufferId)), _bufferSyncer, SLOT(removeBuffer(BufferId)));
+ connect(this, SIGNAL(bufferRenamed(BufferId, QString)), _bufferSyncer, SLOT(renameBuffer(BufferId, QString)));
+ p->synchronize(_bufferSyncer);
+
+
+ // init BacklogManager;
+ p->synchronize(_backlogManager);
+
+ // Restore session state
+ if(restoreState) restoreSessionState();
+
+ emit initialized();