コード例 #1
0
ファイル: XmppClient.cpp プロジェクト: AlericInglewood/hifi
void XmppClient::connectToServer() {
    disconnectFromServer();

    if (_xmppClient.addExtension(&_xmppMUCManager)) {
        connect(&_xmppClient, SIGNAL(connected()), this, SLOT(xmppConnected()));
        connect(&_xmppClient, SIGNAL(error(QXmppClient::Error)), this, SLOT(xmppError(QXmppClient::Error)));
    }
    AccountManager& accountManager = AccountManager::getInstance();
    QString user = accountManager.getAccountInfo().getUsername();
    const QString& password = accountManager.getAccountInfo().getXMPPPassword();
    _xmppClient.connectToServer(user + "@" + DEFAULT_XMPP_SERVER, password);
}
コード例 #2
0
QXmppRosterManager::QXmppRosterManager(QXmppStream* stream, QObject *parent)
    : QObject(parent),
    m_stream(stream),
    m_isRosterReceived(false)
{
    bool check = QObject::connect(m_stream, SIGNAL(xmppConnected()),
        this, SLOT(connected()));
    Q_ASSERT(check);

    check = QObject::connect(m_stream, SIGNAL(disconnected()),
        this, SLOT(disconnected()));
    Q_ASSERT(check);

    check = QObject::connect(m_stream, SIGNAL(presenceReceived(const QXmppPresence&)),
        this, SLOT(presenceReceived(const QXmppPresence&)));
    Q_ASSERT(check);

    check = QObject::connect(m_stream, SIGNAL(rosterIqReceived(const QXmppRosterIq&)), 
        this, SLOT(rosterIqReceived(const QXmppRosterIq&)));
    Q_ASSERT(check);
}
コード例 #3
0
ファイル: QXmppClient.cpp プロジェクト: mecalwang/imXmpp
QXmppClient::QXmppClient(QObject *parent)
    : QObject(parent),
    d(new QXmppClientPrivate)
{
    QSslSocket *socket = new QSslSocket;
    d->stream = new QXmppStream(socket, this);
    socket->setParent(d->stream);
    d->clientPresence.setExtensions(d->stream->presenceExtensions());

    bool check = connect(d->stream, SIGNAL(elementReceived(const QDomElement&, bool&)),
                         this, SIGNAL(elementReceived(const QDomElement&, bool&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(messageReceived(const QXmppMessage&)),
                         this, SIGNAL(messageReceived(const QXmppMessage&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(presenceReceived(const QXmppPresence&)),
                    this, SIGNAL(presenceReceived(const QXmppPresence&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(iqReceived(const QXmppIq&)), this,
        SIGNAL(iqReceived(const QXmppIq&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(discoveryIqReceived(const QXmppDiscoveryIq&)), this,
        SIGNAL(discoveryIqReceived(const QXmppDiscoveryIq&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(disconnected()), this,
        SIGNAL(disconnected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(xmppConnected()), this,
        SLOT(xmppConnected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(xmppConnected()), this,
        SIGNAL(connected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(error(QXmppClient::Error)), this,
        SIGNAL(error(QXmppClient::Error)));
    Q_ASSERT(check);

    check = setReconnectionManager(new QXmppReconnectionManager(this));
    Q_ASSERT(check);

    // rpc
    check = connect(d->stream, SIGNAL(rpcCallInvoke(QXmppRpcInvokeIq)),
        this, SLOT(invokeInterfaceMethod(QXmppRpcInvokeIq)));
    Q_ASSERT(check);

    // logging
    check = connect(this, SIGNAL(logMessage(QXmppLogger::MessageType, QString)),
        d->stream, SIGNAL(logMessage(QXmppLogger::MessageType, QString)));
    Q_ASSERT(check);

    // create managers
    d->rosterManager = new QXmppRosterManager(d->stream, this);
    d->archiveManager = new QXmppArchiveManager(d->stream, this);
    d->callManager = new QXmppCallManager(d->stream, this);
    d->mucManager = new QXmppMucManager(d->stream, this);
    d->transferManager = new QXmppTransferManager(d->stream, this);
    d->vCardManager = new QXmppVCardManager(d->stream, this);
}
コード例 #4
0
ファイル: QXmppClient.cpp プロジェクト: berndhs/qxmpp
QXmppClient::QXmppClient(QObject *parent)
    : QXmppLoggable(parent),
    d(new QXmppClientPrivate(this))
{
    d->stream = new QXmppOutgoingClient(this);
    d->addProperCapability(d->clientPresence);

    bool check = connect(d->stream, SIGNAL(elementReceived(const QDomElement&, bool&)),
                         this, SLOT(slotElementReceived(const QDomElement&, bool&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(messageReceived(const QXmppMessage&)),
                         this, SIGNAL(messageReceived(const QXmppMessage&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(presenceReceived(const QXmppPresence&)),
                    this, SIGNAL(presenceReceived(const QXmppPresence&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(iqReceived(const QXmppIq&)), this,
        SIGNAL(iqReceived(const QXmppIq&)));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(disconnected()), this,
        SIGNAL(disconnected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(connected()), this,
        SLOT(xmppConnected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(connected()), this,
        SIGNAL(connected()));
    Q_ASSERT(check);

    check = connect(d->stream, SIGNAL(error(QXmppClient::Error)), this,
        SIGNAL(error(QXmppClient::Error)));
    Q_ASSERT(check);

    check = setReconnectionManager(new QXmppReconnectionManager(this));
    Q_ASSERT(check);

    // logging
    d->logger = 0;
    setLogger(QXmppLogger::getLogger());

    // create managers
    // TODO move manager references to d->extensions
    d->rosterManager = new QXmppRosterManager(this);
    addExtension(d->rosterManager);

    d->vCardManager = new QXmppVCardManager;
    addExtension(d->vCardManager);

    d->versionManager = new QXmppVersionManager;
    addExtension(d->versionManager);

    addExtension(new QXmppEntityTimeManager());

    QXmppDiscoveryManager *discoveryManager = new QXmppDiscoveryManager;
    addExtension(discoveryManager);

    // obsolete signal
    check = connect(discoveryManager, SIGNAL(infoReceived(QXmppDiscoveryIq)),
                    this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq)));
    Q_ASSERT(check);

    check = connect(discoveryManager, SIGNAL(itemsReceived(QXmppDiscoveryIq)),
                    this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq)));
    Q_ASSERT(check);
}