Ejemplo n.º 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());
}
Ejemplo n.º 2
0
JingleManager::JingleManager(Client *client)
    : QObject(client), d_ptr(new JingleManagerPrivate)
{
	Q_D(JingleManager);
	d->client = client;
#ifdef HAVE_IRISICE
	d->transports << new JingleIce::TransportFactory;
#endif
	d->descriptions << new JingleAudioContentFactory;
	client->registerPayload(new JingleFactory(client));
	foreach (AbstractPayloadFactory *factory, d->transports)
		client->registerPayload(factory);
	foreach (AbstractPayloadFactory *factory, d->descriptions)
		client->registerPayload(factory);
	connect(d->client, SIGNAL(iqReceived(Jreen::IQ)),
	        SLOT(_q_iqReceived(Jreen::IQ)));
}
Ejemplo n.º 3
0
Disco::Disco(Client *client) : d_ptr(new DiscoPrivate)
{
	Q_D(Disco);
	d->client = client;
	connect(d->client, SIGNAL(iqReceived(Jreen::IQ)), this, SLOT(_q_received(Jreen::IQ)));
}