projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't put oxygen_quassel in tarballs
[quassel.git]
/
src
/
core
/
coresession.cpp
diff --git
a/src/core/coresession.cpp
b/src/core/coresession.cpp
index
841ae7c
..
926fc97
100644
(file)
--- a/
src/core/coresession.cpp
+++ b/
src/core/coresession.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-0
8
by the Quassel Project *
+ * Copyright (C) 2005-0
9
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-51,7
+51,6
@@
CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
_coreInfo(this),
scriptEngine(new QScriptEngine(this))
{
_coreInfo(this),
scriptEngine(new QScriptEngine(this))
{
-
SignalProxy *p = signalProxy();
connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *)));
SignalProxy *p = signalProxy();
connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *)));
@@
-69,35
+68,24
@@
CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
p->attachSignal(this, SIGNAL(networkRemoved(NetworkId)));
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(createNetwork(const NetworkInfo &
, const QStringList &)), this, SLOT(createNetwork(const NetworkInfo &, const QStringList
&)));
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
loadSettings();
initScriptEngine();
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(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferSyncer, SLOT(storeDirtyIds()));
+ connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferViewManager, SLOT(saveBufferViews()));
- connect(_bufferSyncer, SIGNAL(lastSeenMsgSet(BufferId, MsgId)), this, SLOT(storeBufferLastSeenMsg(BufferId, MsgId)));
p->synchronize(_bufferSyncer);
p->synchronize(_bufferSyncer);
-
-
- // init alias manager
p->synchronize(&aliasManager());
p->synchronize(&aliasManager());
-
- // init BacklogManager
p->synchronize(_backlogManager);
p->synchronize(_backlogManager);
-
- // init IrcListHelper
p->synchronize(ircListHelper());
p->synchronize(ircListHelper());
-
- // init CoreInfo
p->synchronize(&_coreInfo);
// Restore session state
p->synchronize(&_coreInfo);
// Restore session state
- if(restoreState) restoreSessionState();
+ if(restoreState)
+ restoreSessionState();
emit initialized();
}
emit initialized();
}
@@
-145,12
+133,6
@@
void CoreSession::loadSettings() {
foreach(CoreIdentity identity, Core::identities(user())) {
createIdentity(identity);
}
foreach(CoreIdentity identity, Core::identities(user())) {
createIdentity(identity);
}
- if(!_identities.count()) {
- Identity identity;
- identity.setToDefaults();
- identity.setIdentityName(tr("Default Identity"));
- createIdentity(identity, QVariantMap());
- }
foreach(NetworkInfo info, Core::networks(user())) {
createNetwork(info);
foreach(NetworkInfo info, Core::networks(user())) {
createNetwork(info);
@@
-158,6
+140,8
@@
void CoreSession::loadSettings() {
}
void CoreSession::saveSessionState() const {
}
void CoreSession::saveSessionState() const {
+ _bufferSyncer->storeDirtyIds();
+ _bufferViewManager->saveBufferViews();
}
void CoreSession::restoreSessionState() {
}
void CoreSession::restoreSessionState() {
@@
-198,7
+182,6
@@
void CoreSession::removeClient(QIODevice *iodev) {
QHash<QString, QString> CoreSession::persistentChannels(NetworkId id) const {
return Core::persistentChannels(user(), id);
QHash<QString, QString> CoreSession::persistentChannels(NetworkId id) const {
return Core::persistentChannels(user(), id);
- return QHash<QString, QString>();
}
// FIXME switch to BufferId
}
// FIXME switch to BufferId
@@
-263,10
+246,6
@@
QVariant CoreSession::sessionState() {
return v;
}
return v;
}
-void CoreSession::storeBufferLastSeenMsg(BufferId buffer, const MsgId &msgId) {
- Core::setBufferLastSeenMsg(user(), buffer, msgId);
-}
-
void CoreSession::initScriptEngine() {
signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, SLOT(scriptRequest(QString)));
signalProxy()->attachSignal(this, SIGNAL(scriptResult(QString)));
void CoreSession::initScriptEngine() {
signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, SLOT(scriptRequest(QString)));
signalProxy()->attachSignal(this, SIGNAL(scriptResult(QString)));
@@
-327,7
+306,7
@@
void CoreSession::removeIdentity(IdentityId id) {
/*** Network Handling ***/
/*** Network Handling ***/
-void CoreSession::createNetwork(const NetworkInfo &info_) {
+void CoreSession::createNetwork(const NetworkInfo &info_
, const QStringList &persistentChans
) {
NetworkInfo info = info_;
int id;
NetworkInfo info = info_;
int id;
@@
-351,6
+330,11
@@
void CoreSession::createNetwork(const NetworkInfo &info_) {
_networks[id] = net;
signalProxy()->synchronize(net);
emit networkCreated(id);
_networks[id] = net;
signalProxy()->synchronize(net);
emit networkCreated(id);
+ // create persistent chans
+ foreach(QString channel, persistentChans) {
+ Core::bufferInfo(user(), info.networkId, BufferInfo::ChannelBuffer, channel, true);
+ Core::setChannelPersistent(user(), info.networkId, channel, true);
+ }
} else {
qWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
_networks[info.networkId]->requestSetNetworkInfo(info);
} else {
qWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
_networks[info.networkId]->requestSetNetworkInfo(info);
@@
-384,8
+368,10
@@
void CoreSession::destroyNetwork(NetworkId id) {
}
void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) {
}
void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) {
- BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName);
- _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName);
+ BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName, false);
+ if(bufferInfo.isValid()) {
+ _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName);
+ }
}
void CoreSession::clientsConnected() {
}
void CoreSession::clientsConnected() {
@@
-393,7
+379,6
@@
void CoreSession::clientsConnected() {
Identity *identity = 0;
CoreNetwork *net = 0;
IrcUser *me = 0;
Identity *identity = 0;
CoreNetwork *net = 0;
IrcUser *me = 0;
- QString awayReason;
while(netIter != _networks.end()) {
net = *netIter;
netIter++;
while(netIter != _networks.end()) {
net = *netIter;
netIter++;
@@
-435,8
+420,6
@@
void CoreSession::clientsDisconnected() {
if(identity->detachAwayEnabled() && !me->isAway()) {
if(identity->detachAwayReasonEnabled())
awayReason = identity->detachAwayReason();
if(identity->detachAwayEnabled() && !me->isAway()) {
if(identity->detachAwayReasonEnabled())
awayReason = identity->detachAwayReason();
- else
- awayReason = identity->awayReason();
net->setAutoAwayActive(true);
net->userInputHandler()->handleAway(BufferInfo(), awayReason);
}
net->setAutoAwayActive(true);
net->userInputHandler()->handleAway(BufferInfo(), awayReason);
}