コード例 #1
0
QXmppClient::QXmppClient(QObject *parent)
    : QXmppLoggable(parent),
    d(new QXmppClientPrivate(this))
{
    bool check;
    Q_UNUSED(check);

    d->stream = new QXmppOutgoingClient(this);
    d->addProperCapability(d->clientPresence);

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

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

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

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

    check = connect(d->stream->socket(), SIGNAL(stateChanged(QAbstractSocket::SocketState)),
                    this, SLOT(_q_socketStateChanged(QAbstractSocket::SocketState)));
    Q_ASSERT(check);

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

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

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

    // reconnection
    d->reconnectionTimer = new QTimer(this);
    d->reconnectionTimer->setSingleShot(true);
    connect(d->reconnectionTimer, SIGNAL(timeout()),
            this, SLOT(_q_reconnect()));
    Q_ASSERT(check);

    // logging
    setLogger(QXmppLogger::getLogger());

    addExtension(new QXmppRosterManager(this));
    addExtension(new QXmppVCardManager);
    addExtension(new QXmppVersionManager);
    addExtension(new QXmppEntityTimeManager());
    addExtension(new QXmppDiscoveryManager());
}
コード例 #2
0
ファイル: QXmppMucManager.cpp プロジェクト: berndhs/qxmpp
void QXmppMucManager::setClient(QXmppClient* client)
{
    QXmppClientExtension::setClient(client);

    bool check = connect(client, SIGNAL(messageReceived(QXmppMessage)),
                         this, SLOT(messageReceived(QXmppMessage)));
    Q_ASSERT(check);

    check = QObject::connect(client, SIGNAL(presenceReceived(QXmppPresence)),
                             this, SLOT(presenceReceived(QXmppPresence)));
    Q_ASSERT(check);
}
コード例 #3
0
MyXmppClient::MyXmppClient() : QObject(0) {
    xmppClient = new QXmppClient( this );
    QObject::connect( xmppClient, SIGNAL(stateChanged(QXmppClient::State)), this, SLOT(clientStateChanged(QXmppClient::State)) );
    QObject::connect( xmppClient, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceivedSlot(QXmppMessage)) );
    QObject::connect( xmppClient, SIGNAL(presenceReceived(QXmppPresence)), this, SLOT(presenceReceived(QXmppPresence)) );
    QObject::connect( xmppClient, SIGNAL(error(QXmppClient::Error)), this, SLOT(error(QXmppClient::Error)) );

    m_status = Offline;
    m_keepAlive = 60;


    xmppClient->versionManager().setClientName("Lightbulb");
    xmppClient->versionManager().setClientVersion( MyXmppClient::myVersion );

    rosterManager = 0;
    QSettings temp(QDir::currentPath() + QDir::separator() + "Settings.conf",QSettings::NativeFormat);
    temp.beginGroup("paths");
    cacheIM = new MyCache(temp.value("cache","").toString());
    temp.endGroup();

    cachedRoster = new RosterListModel( this );

    vCardManager = &xmppClient->vCardManager();
    QObject::connect( vCardManager, SIGNAL(vCardReceived(const QXmppVCardIq &)),
                      this, SLOT(initVCard(const QXmppVCardIq &)),
                      Qt::UniqueConnection  );
}
コード例 #4
0
xmppClient::xmppClient(QObject *parent)
    : QXmppClient(parent)
    , m_turnPort(0)
    , m_turnFinished(false)
{
    bool check;
    Q_UNUSED(check);

    // add QXmppCallManager extension
    callManager = new QXmppCallManager;
    addExtension(callManager);

    check = connect(this, SIGNAL(connected()),
                    this, SLOT(slotConnected()));
    Q_ASSERT(check);

    check = connect(this, SIGNAL(presenceReceived(QXmppPresence)),
                    this, SLOT(slotPresenceReceived(QXmppPresence)));
    Q_ASSERT(check);

    check = connect(callManager, SIGNAL(callReceived(QXmppCall*)),
                    this, SLOT(slotCallReceived(QXmppCall*)));
    Q_ASSERT(check);

    check = connect(&m_dns, SIGNAL(finished()),
                    this, SLOT(slotDnsLookupFinished()));
    Q_ASSERT(check);
}
コード例 #5
0
MyXmppClient::MyXmppClient() : QObject(0) {
    xmppClient = new QXmppClient( this );
    QObject::connect( xmppClient, SIGNAL(stateChanged(QXmppClient::State)), this, SLOT(clientStateChanged(QXmppClient::State)) );
    QObject::connect( xmppClient, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceivedSlot(QXmppMessage)) );
    QObject::connect( xmppClient, SIGNAL(presenceReceived(QXmppPresence)), this, SLOT(presenceReceived(QXmppPresence)) );
    QObject::connect( xmppClient, SIGNAL(error(QXmppClient::Error)), this, SLOT(error(QXmppClient::Error)) );

    m_status = Offline;
    m_keepAlive = 60;

    qmlVCard = new QMLVCard();

    xmppClient->versionManager().setClientName("Lightbulb");
    xmppClient->versionManager().setClientVersion( MyXmppClient::myVersion );

    rosterManager = 0;
    cacheIM = new MyCache();

    cachedRoster = new RosterListModel( this );

    vCardManager = &xmppClient->vCardManager();
    QObject::connect( vCardManager, SIGNAL(vCardReceived(const QXmppVCardIq &)),
                      this, SLOT(initVCard(const QXmppVCardIq &)),
                      Qt::UniqueConnection  );
}
コード例 #6
0
ファイル: QXmppRosterManager.cpp プロジェクト: freedbrt/qxmpp
QXmppRosterManager::QXmppRosterManager(QXmppClient* client)
{
    bool check;
    Q_UNUSED(check);

    d = new QXmppRosterManagerPrivate(this);

    check = connect(client, SIGNAL(connected()),
                    this, SLOT(_q_connected()));
    Q_ASSERT(check);

    check = connect(client, SIGNAL(disconnected()),
                    this, SLOT(_q_disconnected()));
    Q_ASSERT(check);

    check = connect(client, SIGNAL(presenceReceived(QXmppPresence)),
                    this, SLOT(_q_presenceReceived(QXmppPresence)));
    Q_ASSERT(check);

    check = connect(client, SIGNAL(streamManagementEnabled(bool)),
                    this, SLOT(_q_streamResumeEnabled(bool)));
    Q_ASSERT(check);

    check = connect(client, SIGNAL(streamManagementResumed(bool)),
                    this, SLOT(_q_streamResumed(bool)));
    Q_ASSERT(check);
}
コード例 #7
0
ファイル: vcardmanager.cpp プロジェクト: magist3r/jreen
VCardManager::VCardManager(Client *client)
    : QObject(client), d_ptr(new VCardManagerPrivate(this))
{
	Q_D(VCardManager);
	d->client = client;
	connect(d->client, SIGNAL(presenceReceived(Jreen::Presence)),
	        SLOT(_q_received(Jreen::Presence)));
	connect(d->client, SIGNAL(mucPresenceReceived(Jreen::Presence)),
	        SLOT(_q_received(Jreen::Presence)));
}
コード例 #8
0
ファイル: rpcClient.cpp プロジェクト: antofik/RedHelper
rpcClient::rpcClient(QObject *parent)
    : QXmppClient(parent)
{
    // add RPC manager
    m_rpcManager = new QXmppRpcManager;
    addExtension(m_rpcManager);

    // observe incoming presences
    bool check = connect(this, SIGNAL(presenceReceived(QXmppPresence)),
                         this, SLOT(slotPresenceReceived(QXmppPresence)));
    Q_ASSERT(check);
    Q_UNUSED(check);
}
コード例 #9
0
ファイル: xmppClient.cpp プロジェクト: berndhs/qxmpp
xmppClient::xmppClient(QObject *parent)
    : QXmppClient(parent)
{
    // add QXmppCallManager extension
    callManager = new QXmppCallManager;
    addExtension(callManager);

    bool check = connect(this, SIGNAL(presenceReceived(QXmppPresence)),
                         this, SLOT(slotPresenceReceived(QXmppPresence)));
    Q_ASSERT(check);

    check = connect(callManager, SIGNAL(callReceived(QXmppCall*)),
                    this, SLOT(slotCallReceived(QXmppCall*)));
    Q_ASSERT(check);
}
コード例 #10
0
ファイル: qxmpp_peer.cpp プロジェクト: z80/IPM
QxmppPeer::QxmppPeer( QObject * parent )
{
    QXmppLogger::getLogger()->setLoggingType( QXmppLogger::SignalLogging );

    connect( this, SIGNAL(sigSendFile(const QString &, const QString &, QIODevice *)), 
             this, SLOT(slotSendFile(const QString &, const QString &, QIODevice *)), Qt::QueuedConnection );
    bool check;

    check = QObject::connect( QXmppLogger::getLogger(), SIGNAL(message(QXmppLogger::MessageType, const QString &)), 
                              this,                     SLOT(logMessage(QXmppLogger::MessageType, const QString &)) );

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

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

    check = QObject::connect( this, SIGNAL( error(QXmppClient::Error) ), 
                                    SLOT( error(QXmppClient::Error) ) );
    Q_ASSERT(check);

    check = QObject::connect(this, SIGNAL( messageReceived(QXmppMessage) ),
                                     SLOT( messageReceived(QXmppMessage) ) );
    Q_ASSERT(check);

    m_trManager = new QXmppTransferManager();
    addExtension( m_trManager );

    check = connect(this, SIGNAL( presenceReceived(QXmppPresence) ),
                    this, SLOT( trPresenceReceived(QXmppPresence) ) );
    Q_ASSERT(check);

    check = connect( m_trManager, SIGNAL(jobStarted(QXmppTransferJob*) ),
                     this, SLOT( trJobStarted(QXmppTransferJob*) ) );
    Q_ASSERT(check);

    check = connect( m_trManager, SIGNAL(fileReceived(QXmppTransferJob*) ),
                     this, SLOT( trFileReceived(QXmppTransferJob*) ) );
    Q_ASSERT(check);

    Q_UNUSED(check);
}
コード例 #11
0
ファイル: xmppClient.cpp プロジェクト: berndhs/qxmpp
xmppClient::xmppClient(QObject *parent)
    : QXmppClient(parent), transferManager(0)
{
    // add transfer manager
    transferManager = new QXmppTransferManager;
    addExtension(transferManager);

    // uncomment one of the following if you only want to use a specific transfer method:
    //
    // transferManager->setSupportedMethods(QXmppTransferJob::InBandMethod);
    // transferManager->setSupportedMethods(QXmppTransferJob::SocksMethod);

    bool check = connect(this, SIGNAL(presenceReceived(QXmppPresence)),
                         this, SLOT(slotPresenceReceived(QXmppPresence)));
    Q_ASSERT(check);

    check = connect(transferManager, SIGNAL(fileReceived(QXmppTransferJob*)),
                    this, SLOT(slotFileReceived(QXmppTransferJob*)));
    Q_ASSERT(check);
}
コード例 #12
0
void JabberContactAvatarService::rosterReceived()
{
    for (auto &&bareId : m_client->rosterManager().getRosterBareJids())
        for (auto &&presence : m_client->rosterManager().getAllPresencesForBareJid(bareId))
            presenceReceived(presence);
}