projects
/
tpsession
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
channelDestroyed hadling, TPSESSION_DEBUG env
[tpsession]
/
tpsession-0.1
/
tpsession
/
tpsessionchannel.cpp
diff --git
a/tpsession-0.1/tpsession/tpsessionchannel.cpp
b/tpsession-0.1/tpsession/tpsessionchannel.cpp
index
759289c
..
c4ca403
100644
(file)
--- 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;
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"),
request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"),
TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT);
request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"),
@@
-100,17
+100,20
@@
TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn,const Tp::ContactPtr &
TpSessionChannel::TpSessionChannel(Tp::TextChannelPtr ch)
{
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 *)));
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)
{
}
void TpSessionChannel::onChannelCreated(Tp::PendingOperation *op)
{
- // qDebug() << "TpSessionChannel::onOutgoingChannelCreated" ;
+ if(TpSession::tpsDebug())qDebug() << "TpSessionChannel::onOutgoingChannelCreated" ;
if (op->isError()) {
qWarning() << "Connection cannot become connected" ;
return;
if (op->isError()) {
qWarning() << "Connection cannot become connected" ;
return;
@@
-122,12
+125,24
@@
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->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()
+{
+ return channel->objectPath();
+}
+QString TpSessionChannel::type()
+{
+ return channel->channelType();
+}
void TpSessionChannel::onChannelReady(Tp::PendingOperation *op)
{
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);
+ 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 &)),
;
connect(channel.data(),
SIGNAL(messageReceived(const Tp::ReceivedMessage &)),
@@
-135,9
+150,9
@@
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(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);
emit channelReady(this);
- peerContact=channel->initiatorContact();
QList<Tp::ReceivedMessage> queuedMessages = channel->messageQueue();
foreach(Tp::ReceivedMessage message, queuedMessages) {
// qDebug() << "received " << message.text();
QList<Tp::ReceivedMessage> queuedMessages = channel->messageQueue();
foreach(Tp::ReceivedMessage message, queuedMessages) {
// qDebug() << "received " << message.text();
@@
-162,7
+177,7
@@
void TpSessionChannel::onMessageReceived(const Tp::ReceivedMessage &msg)
};
void TpSessionChannel::onMessageSent(const Tp::Message &msg,Tp::MessageSendingFlags sflags, const QString &flags)
{
};
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);
};
/**
emit messageSent(msg,sflags,flags,this);
};
/**
@@
-173,12
+188,12
@@
void TpSessionChannel::onMessageSent(const Tp::Message &msg,Tp::MessageSendingFl
*/
QString TpSessionChannel::peerId()
{
*/
QString TpSessionChannel::peerId()
{
- return peerContact ? peerContact->id():"";
+ return peerContact ? peerContact->id():QString();
}
}
-void TpSessionChannel::onChannelDestroyed(QObject *obj)
+void TpSessionChannel::onChannelDestroyed()
{
{
- // qDebug() << "TpSessionChannel::onChannelDestroyed";
+ if(TpSession::tpsDebug()) qDebug() << "TpSessionChannel::onChannelDestroyed" << peerId() << objectPath();
//TpSessionChannel *call = (TpSessionChannel *) obj;
emit channelDestroyed(this);
}
//TpSessionChannel *call = (TpSessionChannel *) obj;
emit channelDestroyed(this);
}