Development/Tutorials/Decibel/Handling TextChannels

< Development‎ | Tutorials
Revision as of 04:04, 12 March 2008 by Grundleborg (talk | contribs) (The Class Definition)
Jump to: navigation, search


This tutorial will walk you through the process of creating a simple application that uses Decibel's TextChannels to communicate via arbitrary instant messaging networks using telepathy. From the result of this tutorial, only a few more lines of code are needed to produce a functioning text based instant messaging client.

This tutorial is based on the source code of the simpleclient demo included in decibel. An explanation of using the simpleclient demo can be found here.

ChannelHandler class

The first class we will need to create is an implementation of the Decibel::ChannelHandler interface.

The Class Definition

The code below is the class definition for our implementation of the Decibel::ChannelHandler interface.

class MyTextChannelHandler : public Decibel::ChannelHandler {



   /** @brief Constructor. */
   explicit MyTextChannelHandler(QObject * parent = 0);
   /** @brief Destructor. */
   /** @brief A implementation of the ChannelHandler interface's only method. */
   bool handleChannel(QtTapioca::Connection *, QtTapioca::Channel *, const bool);

public slots:

   /** @brief Called when a new text message was received on our channel. */
   void onMessageReceived();
   /** @brief Called when our channel is closed. */
   void onCloseChannel();


   /** @brief A pointer to our Connection. */
   QtTapioca::Connection *  m_connection;
   /** @brief A pointer to our Channel. */
   QtTapioca::TextChannel * m_channel;


Content is available under Creative Commons License SA 4.0 unless otherwise noted.