X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=tpsession-0.1%2Ftpsession%2Ftpsessionchannel.cpp;h=c4ca4039b13c4447eba0b025a4d8bdcab3f86cf4;hb=f07bfbb28b7f1e02e46f7fc94cd500f47c9bf822;hp=96a4972db9de0a1d2790e843b9b5b8881e05e418;hpb=e7bf1c2870de918858d82eb2f8f13c991a1ac7ff;p=tpsession diff --git a/tpsession-0.1/tpsession/tpsessionchannel.cpp b/tpsession-0.1/tpsession/tpsessionchannel.cpp index 96a4972..c4ca403 100644 --- a/tpsession-0.1/tpsession/tpsessionchannel.cpp +++ b/tpsession-0.1/tpsession/tpsessionchannel.cpp @@ -100,17 +100,20 @@ TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn,const Tp::ContactPtr & TpSessionChannel::TpSessionChannel(Tp::TextChannelPtr ch) { - // qDebug() << "TpSessionChannel::TpSessionChannel" <<"path " << ch->objectPath(); + if(TpSession::tpsDebug()) qDebug() << "TpSessionChannel::TpSessionChannel" <<"path " << ch->objectPath(); channel=ch; connect(channel->becomeReady(Tp::TextChannel::FeatureMessageQueue|Tp::TextChannel::FeatureMessageSentSignal), SIGNAL(finished(Tp::PendingOperation *)), SLOT(onChannelReady(Tp::PendingOperation *))); + connect(channel.data(), + SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)), + SLOT(onChannelDestroyed())); } void TpSessionChannel::onChannelCreated(Tp::PendingOperation *op) { - // qDebug() << "TpSessionChannel::onOutgoingChannelCreated" ; + if(TpSession::tpsDebug())qDebug() << "TpSessionChannel::onOutgoingChannelCreated" ; if (op->isError()) { qWarning() << "Connection cannot become connected" ; return; @@ -122,6 +125,9 @@ void TpSessionChannel::onChannelCreated(Tp::PendingOperation *op) connect(channel->becomeReady(Tp::TextChannel::FeatureMessageQueue | Tp::TextChannel::FeatureMessageSentSignal), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onChannelReady(Tp::PendingOperation*))); + connect(channel.data(), + SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)), + SLOT(onChannelDestroyed())); } QString TpSessionChannel::objectPath() @@ -135,8 +141,8 @@ QString TpSessionChannel::type() void TpSessionChannel::onChannelReady(Tp::PendingOperation *op) { Q_UNUSED(op); - //qDebug() << "TpSessionChannel::onChannelReady type=" << channel->channelType() <<"path " << channel->objectPath() << - // "initiatorContact=" << (channel->initiatorContact() ? channel->initiatorContact()->id():"NULL"); + if(TpSession::tpsDebug()) qDebug() << "TpSessionChannel::onChannelReady type=" << channel->channelType() <<"path " << channel->objectPath() << + "initiatorContact=" << (channel->initiatorContact() ? channel->initiatorContact()->id():"NULL"); ; connect(channel.data(), SIGNAL(messageReceived(const Tp::ReceivedMessage &)), @@ -144,7 +150,7 @@ void TpSessionChannel::onChannelReady(Tp::PendingOperation *op) connect(channel.data(), SIGNAL(messageSent(const Tp::Message &,Tp::MessageSendingFlags, const QString &)), SLOT(onMessageSent(const Tp::Message &,Tp::MessageSendingFlags, const QString &))); - connect(channel.data(),SIGNAL(destroyed(QObject *)),SLOT(onChannelDestroyed(QObject *))); + connect(channel.data(),SIGNAL(destroyed(QObject *)),SLOT(onChannelDestroyed())); if(peerId().isEmpty()) peerContact=channel->initiatorContact(); // If this is incoming channel emit channelReady(this); QList queuedMessages = channel->messageQueue(); @@ -185,10 +191,9 @@ QString TpSessionChannel::peerId() return peerContact ? peerContact->id():QString(); } -void TpSessionChannel::onChannelDestroyed(QObject *obj) +void TpSessionChannel::onChannelDestroyed() { - Q_UNUSED(obj); - qDebug() << "TpSessionChannel::onChannelDestroyed"; + if(TpSession::tpsDebug()) qDebug() << "TpSessionChannel::onChannelDestroyed" << peerId() << objectPath(); //TpSessionChannel *call = (TpSessionChannel *) obj; emit channelDestroyed(this); }