X-Git-Url: http://git.maemo.org/git/?p=tpsession;a=blobdiff_plain;f=tpsession-0.1%2Ftpsession%2Ftpsessionchannel.cpp;h=96a4972db9de0a1d2790e843b9b5b8881e05e418;hp=759289c2b0ef5c4fa3891e6fc3d30cfdf2dbb3b3;hb=f923941a11132697d5bd1968cbbb9c328f090423;hpb=5acc03fc8b3a2abbf9437fb5dfbe3db085cac91f diff --git a/tpsession-0.1/tpsession/tpsessionchannel.cpp b/tpsession-0.1/tpsession/tpsessionchannel.cpp index 759289c..96a4972 100644 --- a/tpsession-0.1/tpsession/tpsessionchannel.cpp +++ b/tpsession-0.1/tpsession/tpsessionchannel.cpp @@ -74,7 +74,7 @@ TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn,const Tp::ContactPtr &contact) { QVariantMap request; - // qDebug() << "TpSessionChannel::TpSessionChannel" <<"contact.id() " << contact->id(); + // qDebug() << "TpSessionChannel::TpSessionChannel" <<"contact.id() " << contact->id() << contact->id().toLocal8Bit().toHex(); request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"), TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT); request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"), @@ -124,10 +124,19 @@ void TpSessionChannel::onChannelCreated(Tp::PendingOperation *op) SLOT(onChannelReady(Tp::PendingOperation*))); } +QString TpSessionChannel::objectPath() +{ + return channel->objectPath(); +} +QString TpSessionChannel::type() +{ + return channel->channelType(); +} void TpSessionChannel::onChannelReady(Tp::PendingOperation *op) { - // qDebug() << "TpSessionChannel::onChannelReady type=" << channel->channelType() <<"path " << channel->objectPath() << - // "initiatorContact=" << (channel->initiatorContact() ? channel->initiatorContact()->id():"NULL") ; + Q_UNUSED(op); + //qDebug() << "TpSessionChannel::onChannelReady type=" << channel->channelType() <<"path " << channel->objectPath() << + // "initiatorContact=" << (channel->initiatorContact() ? channel->initiatorContact()->id():"NULL"); ; connect(channel.data(), SIGNAL(messageReceived(const Tp::ReceivedMessage &)), @@ -136,8 +145,8 @@ void TpSessionChannel::onChannelReady(Tp::PendingOperation *op) 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 *))); + if(peerId().isEmpty()) peerContact=channel->initiatorContact(); // If this is incoming channel emit channelReady(this); - peerContact=channel->initiatorContact(); QList queuedMessages = channel->messageQueue(); foreach(Tp::ReceivedMessage message, queuedMessages) { // qDebug() << "received " << message.text(); @@ -162,7 +171,7 @@ void TpSessionChannel::onMessageReceived(const Tp::ReceivedMessage &msg) }; void TpSessionChannel::onMessageSent(const Tp::Message &msg,Tp::MessageSendingFlags sflags, const QString &flags) { - // qDebug() << "TpSessionChannel::onMessageSent"; + // qDebug() << "TpSessionChannel::onMessageSen" << peerId() <<"txt:" << msg.text();; emit messageSent(msg,sflags,flags,this); }; /** @@ -173,12 +182,13 @@ void TpSessionChannel::onMessageSent(const Tp::Message &msg,Tp::MessageSendingFl */ QString TpSessionChannel::peerId() { - return peerContact ? peerContact->id():""; + return peerContact ? peerContact->id():QString(); } void TpSessionChannel::onChannelDestroyed(QObject *obj) { - // qDebug() << "TpSessionChannel::onChannelDestroyed"; + Q_UNUSED(obj); + qDebug() << "TpSessionChannel::onChannelDestroyed"; //TpSessionChannel *call = (TpSessionChannel *) obj; emit channelDestroyed(this); }