void QXmppStreamManagement::failedReceived(const QDomElement &element, QXmppStanza::Error::Condition &condition) { QXmppStanza::Error error; error.parse(element); condition = error.condition(); d->resumeEnabled = false; d->inboundCounter = false; d->outboundEnabled = false; /// TO-DO if resume failed the buffer has to be emptied notifying the packets that couldn't be acknoledged. d->resumming = false; }
void QXmppClient::invokeInterfaceMethod( const QXmppRpcInvokeIq &iq ) { QXmppStanza::Error error; const QStringList methodBits = iq.method().split('.'); if (methodBits.size() != 2) return; const QString interface = methodBits.first(); const QString method = methodBits.last(); QXmppInvokable *iface = d->interfaces.value(interface); if (iface) { if ( iface->isAuthorized( iq.from() ) ) { if ( iface->interfaces().contains(method) ) { QVariant result = iface->dispatch(method.toLatin1(), iq.arguments() ); QXmppRpcResponseIq resultIq; resultIq.setId(iq.id()); resultIq.setTo(iq.from()); resultIq.setFrom(d->stream->configuration().jid()); resultIq.setValues(QVariantList() << result); d->stream->sendPacket( resultIq ); return; } else { error.setType(QXmppStanza::Error::Cancel); error.setCondition(QXmppStanza::Error::ItemNotFound); } } else { error.setType(QXmppStanza::Error::Auth); error.setCondition(QXmppStanza::Error::Forbidden); } } else { error.setType(QXmppStanza::Error::Cancel); error.setCondition(QXmppStanza::Error::ItemNotFound); } QXmppRpcErrorIq errorIq; errorIq.setId(iq.id()); errorIq.setTo(iq.from()); errorIq.setFrom(d->stream->configuration().jid()); errorIq.setQuery( iq ); errorIq.setError( error ); d->stream->sendPacket( errorIq ); }
void CFrmGroupChat::slotError(const QXmppStanza::Error &error) { LOG_MODEL_DEBUG("Group chat", "code:%d;type:%d;Condition:%d;error:%s", error.code(), error.type(), error.condition(), qPrintable(error.text())); QString szMsg; switch(error.type()) { case QXmppStanza::Error::Auth: szMsg = tr("Don't join room"); break; default: szMsg = tr("Error code:") + QString::number(error.code()) + tr("type:") + QString::number(error.type()) + tr("condition:") + QString::number(error.condition()) + tr("text:") + error.text(); }; QMessageBox::critical(this, tr("Error"), szMsg); }