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 simpleclient demo included with Decibel. An explanation of using the simpleclient demo can be found here.
In this tutorial, we only pick out the important parts of the source code to discuss. The complete working source code for this example can be found here in KDE's SVN Repository.
The first class we will need to create is an implementation of the Decibel::ChannelHandler interface.
The code below is the class definition for our implementation of the Decibel::ChannelHandler interface.
class MyTextChannelHandler : public Decibel::ChannelHandler
explicit MyTextChannelHandler(QObject * parent = 0); ~MyTextChannelHandler();
bool handleChannel(QtTapioca::Connection *, QtTapioca::Channel *, const bool);
void onMessageReceived(); void onCloseChannel();
QtTapioca::Connection * m_connection; QtTapioca::TextChannel * m_channel;