C++ (Qt)#include <QtCore/QCoreApplication>#include <QXmppLogger.h>#include <QXmppMessage.h>#include <QXmppClient.h>#include <iostream>using namespace std; class echoClient : public QXmppClient{ Q_OBJECTpublic: echoClient(QObject *parent = 0); ~echoClient();public slots: void messageReceived(const QXmppMessage&);}; echoClient::echoClient(QObject *parent) : QXmppClient(parent){ bool check = connect(this, SIGNAL(messageReceived(const QXmppMessage&)), SLOT(messageReceived(const QXmppMessage&))); Q_ASSERT(check);} echoClient::~echoClient(){ } void echoClient::messageReceived(const QXmppMessage& message){ QString from = message.getFrom(); QString msg = message.getBody(); cout << msg.toStdString() << "\n"; sendPacket(QXmppMessage("", from, "Пакет получен"));} int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); cout << "Hi, this is Jabber-Bot\n"; QXmppLogger::getLogger()->setLoggingType(QXmppLogger::STDOUT); echoClient client; client.connectToServer("www.jabber.ru", "css_server", "steelaxe", "jabber.ru"); cout << "Connected!"; system("pause"); return a.exec();}
13:19:25.281 : Connecting to: www.jabber.ru:522213:19:27.890 : Host found