Wednesday, October 28, 2015

XMPP Chat - part one(Connection)

Here I am showing the steps to implement XMPP in to Blackberry 10 Application


  • Download QXMPP source code from here
  • Add required files in to the xmpp folder
  • Add QXmppClient *m_xmppClient; in application.h file
  • Add the following lines to application.cpp file
            m_xmppClient = new QXmppClient;
            QXmppConfiguration config;
            config.setAutoAcceptSubscriptions(true);
            config.setHost("hostname"); //ip added
            config.setDomain("domainname");//example.com
            config.setUser("username");
            config.setPassword("password");
            //config.setAutoReconnectionEnabled(true);
            m_xmppClient->connectToServer(config, QXmppPresence::Available);
            m_xmppClient->logger()->setLoggingType(QXmppLogger::StdoutLogging);
            
            //SIGNALS FOR XMPP CONNECTION
             connect(m_xmppClient, SIGNAL(connected()), this, SLOT(onChatConnected()));
             connect(m_xmppClient, SIGNAL(messageReceived(const QXmppMessage)), this,
                           SLOT(onMessageReceived(const QXmppMessage)));
  • void ApplicationUI::onMessageReceived(const QXmppMessage &message){
             qCritical()<<"Connected to XMPP"
          }




  • Will describe all the methods of XMPP in the next part.....


No comments:

Post a Comment