Web page and doxygen documentation created
[tpsession] / tpsession-0.1 / tpsession / tpsessionchannel.cpp
index 601e615..36e1b85 100644 (file)
  */
 #include "tpsessionchannel.h"
 
+
+/**
+ * \class TpSessionChannel
+ * \headerfile <tpsessionchannel.h>
+ *
+ *
+ * When you start chat session or call with your buddy, channel is established with your buddy.
+ * TpSessionChannel represents this connection. TpSession account makes automatically channel when
+ * you send message to your buddy's address. If you send successive messages to same buddy with
+ * TpSessionAccount, it automatically reuses existing connection.
+ */
+/**
+ * \fn void TpSessionChannel::channelReady(TpSessionChannel *);
+ *
+ * Emitted when the channel becomes ready
+ *
+ * \param  TpSessionChannel  pointer to channel become ready
+ */
+/**
+ * \fn void TpSessionChannel::channelDestroyed(TpSessionChannel *);
+ *
+ * Emitted when the channel is destroyed
+ *
+ * \param  TpSessionChannel  pointer to channel destroyed. The pointer is only for referenc to remove
+ * it from some possible places where it could be stored. It is not guaranteed to point any more valid TpSessionChannel object
+ */
+/**
+ * \fn void TpSessionChannel::messageReceived(const Tp::ReceivedMessage &,TpSessionConnection *);
+ *
+ * Emitted when any of Account Managers recived message
+ *
+ * \param  Tp::ReceivedMessage  Message received
+ * \param  TpSessionChannel  pointer to channel received message
+ */
+/**
+  * \fn void TpSessionChannel::messageSent(const Tp::Message &,Tp::MessageSendingFlags, const QString &,TpSessionChannel *);
+  *
+  * \param Tp::Message message sent
+  */
+
+/**
+ * Construct a new TpSessionChannel object. This constructor is called by TpSessionAccount class when
+ * new channel is created . It is not inended to be used stand alone
+ * This varient with connection and contact as parameter is intented for creationg new connection from origginator side to your peer
+ *
+ *
+ * \param conn connection where this channel is created
+ * \param contact  Contacto to your peer to establish channel
+ */
+
+
 TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn,const Tp::ContactPtr &contact)
 {
     QVariantMap request;
@@ -37,6 +88,14 @@ TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn,const Tp::ContactPtr &
     peerContact=contact;
 }
 
+/**
+ * Construct a new TpSessionChannel object. This constructor is called by TpSessionAccount class when
+ * new channel is created . It is not inended to be used stand alone
+ * This varient with connection only parameter is intented for receiving new connection from your peer
+ *
+ *
+ * \param conn connection where this channel is created
+ */
 
 
 TpSessionChannel::TpSessionChannel(Tp::TextChannelPtr ch)
@@ -76,6 +135,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 *)));
  emit channelReady(this);
  peerContact=channel->initiatorContact();
  QList<Tp::ReceivedMessage> queuedMessages = channel->messageQueue();
@@ -84,6 +144,13 @@ void TpSessionChannel::onChannelReady(Tp::PendingOperation *op)
            emit messageReceived(message,this);
     }
 }
+/**
+ *  Send message to to ths channel
+ *
+ *
+ * \param message   message to send
+ */
+
 void TpSessionChannel::sendMessage(QString message)
 {
     channel->send(message);
@@ -98,8 +165,21 @@ void TpSessionChannel::onMessageSent(const Tp::Message &msg,Tp::MessageSendingFl
     qDebug() << "TpSessionChannel::onMessageSent";
     emit messageSent(msg,sflags,flags,this);
 };
-
+/**
+ *  Get id ( address of your peer )
+ *
+ *
+ * \returns your peer id/address ir empty QString
+ */
 QString TpSessionChannel::peerId()
 {
     return peerContact ? peerContact->id():"";
 }
+
+void TpSessionChannel::onChannelDestroyed(QObject *obj)
+{
+    qDebug() << "TpSessionChannel::onChannelDestroyed";
+    //TpSessionChannel *call = (TpSessionChannel *) obj;
+     emit channelDestroyed(this);
+}
+