Since the 2.1 series of KMess releases, we have split the networking library off the KMess frontend. This means that you can now easily write applications that connect to the Messenger Live network (previously MSN and .Net Messenger). This page describes how to do that in a matter of minutes. Of course, you can also adapt your existing application to also connect to the network.

Why you'd use libkmess-msn instead of libmsn, libpurple or any other library is out of scope for this document. More information about that will be written later.

Beginning

I will assume you have an existing application framework. This can be achieved by, for example, using QtCreator to create a new project directly, or by writing a simple CMake file and adding a main.cpp and such things. Also, you need to have libkmess-msn installed in some place, and your project configured to link against libkmess-msn, and use its include files. The include files are at /usr/include/KMess by default; you should have /usr/include in your include list (probably by default), then include them like this:

#include <KMess/MsnChat>

Main.cpp

The application I'm going to write is called the KMess Echobot. It will simply listen to incoming chats, then whatever it gets, it echoes. We start out with the following main.cpp:

#include <QtCore/QCoreApplication>

#include "echobot.h"

int main( int argc, char *argv[] )
{
  QCoreApplication app( argc, argv );

  // Of course, substitute an e-mail address you have access to below.
  // We will use echobot@kmess.org as our Echobot e-mail address.
  EchoBot echoBot( "echobot@kmess.org" );

  return app.exec();
}

We will continue with implementing the actual EchoBot.