channelDestroyed hadling, TPSESSION_DEBUG env
[tpsession] / tpsession-0.1 / tpsession / tpsession.cpp
index 1e46b7b..93a2989 100644 (file)
@@ -71,6 +71,10 @@ TpSession::TpSession(QString cmname,bool synchronous)
     Tp::enableDebug(false);
     Tp::enableWarnings(false);
 
+    QProcessEnvironment env;
+    tpsdebug=env.systemEnvironment().contains("TPSESSION_DEBUG");
+    if(tpsdebug) qDebug() << "Tpsession debug:" << tpsDebug();
+
     mAM = Tp::AccountManager::create();
     reqCm=cmname;
     sync=synchronous;
@@ -87,6 +91,7 @@ TpSession::TpSession(QString cmname,bool synchronous)
 
 }
 TpSession* TpSession::instancePtr=NULL;
+bool TpSession::tpsdebug=false;
 /**
  * Returns pointer to TpSession singleton. If there is not yet TpSession Object, creates it with "Ring" connection manager as default
  *
@@ -99,8 +104,14 @@ TpSession* TpSession::instance(bool synchronous)
     return instancePtr;
 };
 
+bool TpSession::tpsDebug()
+{
+    return tpsdebug;
+}
+
 void TpSession::onAMReady(Tp::PendingOperation *op)
 {
+ Q_UNUSED(op);
   // qDebug() << "TpSession::onAMReady";
  TpSessionAccount *tpacc;
 
@@ -124,7 +135,7 @@ void TpSession::onAccountCreated(const QString &path)
 
 void TpSession::onAccountReady(TpSessionAccount *tpacc)
 {
-  qDebug() << "TpSession::onAccountReady:Account " << tpacc->acc->cmName() << "is Ready sync=" << sync << "waiting:" << reqCm;
+  //qDebug() << "TpSession::onAccountReady:Account " << tpacc->acc->cmName() << "is Ready sync=" << sync << "waiting:" << reqCm;
   connect(tpacc,SIGNAL(messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *)),
                   SLOT(onMessageReceived(const Tp::ReceivedMessage &,TpSessionAccount *)));
   if(!reqCm.isEmpty() && tpacc->acc->cmName()==reqCm) {
@@ -201,8 +212,7 @@ void TpSession::createObserver()
     bool registered = registrar->registerClient(
       Tp::AbstractClientPtr::dynamicCast(Tp::SharedPtr<TpSessionObserver>(observer)),
       "TpSessionChannelObserver");
-
-    //        qDebug() << "TpSession::createObserver" << (registered ? "started" : "failed");
+    qDebug() << "TpSession::createObserver" << (registered ? "started" : "failed");
 
 }
 
@@ -212,7 +222,9 @@ void TpSession::createChannelListener(const QString &channelType,
                                    const Tp::AccountPtr &account,
                                    const Tp::ChannelPtr &channel)
 {
-      qDebug() << "TpSession::createChannelListener";
+    Q_UNUSED(context);
+    Q_UNUSED(account);
+    qDebug() << "TpSession::createChannelListener";
 
     QString channelObjectPath = channel->objectPath();