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"),
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 &)),
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<Tp::ReceivedMessage> queuedMessages = channel->messageQueue();
foreach(Tp::ReceivedMessage message, queuedMessages) {
// qDebug() << "received " << message.text();
};
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);
};
/**
*/
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);
}