Example #1
0
void QXmppStreamManagement::ackReceived(const QDomElement &element)
{
    const QString h = element.attribute("h");
    debug(QString("SM ACK RECV h=%1 outbound count=%2").arg(h).arg(QString::number(d->outboundCounter)));
    int handled = h.toInt();

    QMapIterator <int, QXmppStanza*> i(d->outboundBuffer);
    const QXmppStanza *stanza = NULL;
    while (i.hasNext()) {
        i.next();
        if(i.key()<= handled)
        {
            stanza = i.value();
            switch (stanza->getStanzaType())
            {
                case QXmppStanza::Message:
                {
                    QXmppMessage message(static_cast<QXmppMessage const &> (*stanza));
                    emit messageAcknowledged(message, true);
                    break;
                }
                case QXmppStanza::Iq:
                {
                    QXmppIq iq(static_cast<QXmppIq const &> (*stanza));
                    emit iqAcknowledged(iq, true);
                    break;
                }
                case QXmppStanza::Presence:
                {
                    QXmppPresence presence(static_cast<QXmppPresence const &>(*stanza));
                    emit presenceAcknowledged(presence, true);
                    break;
                }
                default:
                    break;
           }

           d->outboundBuffer.remove(i.key());
           delete stanza;
           debug(QString("SM h:%1 removed from the buffer").arg(i.key()));
       }
    }
}
Example #2
0
void QXmppStreamManagement::socketDisconnected()
{
    // If resume is enabled the buffer is not emptied until the resume is attempted
    if(!d->resumeEnabled)
    {
        QMapIterator <int, QXmppStanza*> i(d->outboundBuffer);
        const QXmppStanza *stanza = NULL;
        while (i.hasNext()) {
            i.next();
            stanza = i.value();
            switch (stanza->getStanzaType())
            {
                case QXmppStanza::Message:
                {
                    QXmppMessage message(static_cast<QXmppMessage const &> (*stanza));
                    emit messageAcknowledged(message, false);
                    break;
                }
                case QXmppStanza::Iq:
                {
                    QXmppIq iq(static_cast<QXmppIq const &> (*stanza));
                    emit iqAcknowledged(iq, false);
                    break;
                }
                case QXmppStanza::Presence:
                {
                    QXmppPresence presence(static_cast<QXmppPresence const &>(*stanza));
                    emit presenceAcknowledged(presence, false);
                    break;
                }
                default:
                    break;
            }
            d->outboundBuffer.remove(i.key());
            delete stanza;
            debug(QString("SM h:%1 removed from the buffer").arg(i.key()));
        }
    }else{
        d->resumming = true;
    }


}
// Initialize the dialog widgets and connect the signals/slots
void AddRemoveLandscapesDialog::createDialogContent()
{
	ui->setupUi(dialog);
	
	//Signals and slots
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));

	connect(ui->pushButtonBrowseForArchive, SIGNAL(clicked()), this, SLOT(browseForArchiveClicked()));
	connect(ui->listWidgetUserLandscapes, SIGNAL(currentRowChanged(int)), this, SLOT(updateSidePane(int)));
	connect(ui->pushButtonRemove, SIGNAL(clicked()), this, SLOT(removeClicked()));
	connect(ui->pushButtonMessageOK, SIGNAL(clicked()), this, SLOT(messageAcknowledged()));

	connect(landscapeManager, SIGNAL(landscapesChanged()), this, SLOT(populateLists()));
	connect(landscapeManager, SIGNAL(errorUnableToOpen(QString)), this, SLOT(messageUnableToOpen(QString)));
	connect(landscapeManager, SIGNAL(errorNotArchive()), this, SLOT(messageNotArchive()));
	connect(landscapeManager, SIGNAL(errorNotUnique(QString)), this, SLOT(messageNotUnique(QString)));
	connect(landscapeManager, SIGNAL(errorRemoveManually(QString)), this, SLOT(messageRemoveManually(QString)));

	ui->groupBoxMessage->setVisible(false);

	populateLists();
}