X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=3c27145b31cba915752e00d2fd16bbd11575d342;hp=8cc87e417bad358f562765cb78a71bdc9055eb1d;hb=da791527a453a98e0fc800336fee4022ec3d4207;hpb=08aac67d4dc813ed541a81d06fb83d9c4fec5834 diff --git a/src/client/client.cpp b/src/client/client.cpp index 8cc87e41..3c27145b 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -105,7 +105,13 @@ void Client::init() { p->attachSignal(this, SIGNAL(requestRemoveIdentity(IdentityId)), SIGNAL(removeIdentity(IdentityId))); p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &))); p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId))); - +/* + p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &))); + p->attachSignal(this, SIGNAL(requestUpdateNetwork(const NetworkInfo &)), SIGNAL(updateNetwork(const NetworkInfo &))); + p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId))); + p->attachSlot(SIGNAL(networkCreated(const NetworkInfo &)), this, SLOT(coreNetworkCreated(const NetworkInfo &))); + p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId))); +*/ connect(p, SIGNAL(disconnected()), this, SLOT(disconnectFromCore())); //connect(mainUi, SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &))); @@ -333,6 +339,13 @@ QStringList Client::sessionDataKeys() { /*** ***/ +// FIXME +void Client::disconnectFromNetwork(NetworkId id) { + if(!instance()->_networks.contains(id)) return; + Network *net = instance()->_networks[id]; + net->requestDisconnect(); +} + /* void Client::networkConnected(uint netid) { // TODO: create statusBuffer / switch to networkids @@ -362,19 +375,18 @@ void Client::networkDisconnected(NetworkId networkid) { } */ -void Client::addNetwork(NetworkId netid) { - Network *net = new Network(netid, instance()); - addNetwork(net); -} - void Client::addNetwork(Network *net) { net->setProxy(signalProxy()); signalProxy()->synchronize(net); networkModel()->attachNetwork(net); connect(net, SIGNAL(destroyed()), instance(), SLOT(networkDestroyed())); instance()->_networks[net->networkId()] = net; - emit instance()->networkAdded(net->networkId()); - //if(net->networkId() == 1) net->requestConnect(); // FIXME + emit instance()->networkCreated(net->networkId()); +} + +void Client::createNetwork(const NetworkInfo &info) { + + } /*** ***/ @@ -396,25 +408,17 @@ void Client::bufferDestroyed() { } void Client::networkDestroyed() { - Network *netinfo = static_cast(sender()); - NetworkId networkId = netinfo->networkId(); + // FIXME this is not gonna work, net is a QObject here already! + Network *net = static_cast(sender()); + NetworkId networkId = net->networkId(); if(_networks.contains(networkId)) _networks.remove(networkId); } void Client::recvMessage(const Message &msg) { Buffer *b = buffer(msg.buffer()); - -// Buffer::ActivityLevel level = Buffer::OtherActivity; -// if(msg.type() == Message::Plain || msg.type() == Message::Notice){ -// level |= Buffer::NewMessage; -// } -// if(msg.flags() & Message::Highlight){ -// level |= Buffer::Highlight; -// } -// emit bufferActivity(level, b); - b->appendMsg(msg); + networkModel()->updateBufferActivity(msg); } void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { @@ -426,6 +430,7 @@ void Client::recvBacklogData(BufferInfo id, QVariantList msgs, bool /*done*/) { foreach(QVariant v, msgs) { Message msg = v.value(); b->prependMsg(msg); + // networkModel()->updateBufferActivity(msg); if(!layoutQueue.contains(b)) layoutQueue.append(b); } if(layoutQueue.count() && !layoutTimer->isActive()) layoutTimer->start();