123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include "qmlxmppclient.h"
- #include <QDebug>
- QMLXmppClient* QMLXmppClient::instance = 0;
- QMLXmppClient::QMLXmppClient(QObject *parent) : QObject(parent)
- {
- qDebug() << "QMLXmppClient:[" << this << "]";
- QMLXmppClient::instance = this;
- m_stateConnect = MYXMPP_DISCONNECTED;
- jidLastMessage = "";
- flTyping = false;
- m_myjid = "";
- }
- int QMLXmppClient::MYXMPP_CONNECTING = 0;
- int QMLXmppClient::MYXMPP_CONNECTED = 1;
- int QMLXmppClient::MYXMPP_DISCONNECTED = 2;
- void QMLXmppClient::setStateConnect( const int st )
- {
- if( st == QMLXmppClient::MYXMPP_CONNECTING ) {
- m_stateConnect = QMLXmppClient::MYXMPP_CONNECTING;
- emit connectingChanged();
- } else if( st == QMLXmppClient::MYXMPP_CONNECTED ) {
- m_stateConnect = QMLXmppClient::MYXMPP_CONNECTED;
- emit connectingChanged();
- } else if( st == QMLXmppClient::MYXMPP_DISCONNECTED ) {
- m_stateConnect = QMLXmppClient::MYXMPP_DISCONNECTED;
- emit connectingChanged();
- }
- }
- void QMLXmppClient::setStatusText( const QString &__statusText, const bool flNotify )
- {
- m_statusText = __statusText;
- if( flNotify ) {
- emit statusTextChanged();
- }
- }
- void QMLXmppClient::setStatus( QXmppPresence::Status::Type __status, const bool flNotify )
- {
- if( __status == QXmppPresence::Status::Online ) {
- m_status = Online;
- } else if( __status == QXmppPresence::Status::Chat ) {
- m_status = Chat;
- } else if ( __status == QXmppPresence::Status::Away ) {
- m_status = Away;
- } else if ( __status == QXmppPresence::Status::XA ) {
- m_status = XA;
- } else if( __status == QXmppPresence::Status::DND ) {
- m_status = DND;
- } else if( __status == QXmppPresence::Status::Offline ) {
- m_status = Offline;
- }
- if( flNotify ) {
- emit statusChanged();
- }
- }
|