Loading...
Searching...
No Matches
QXmppStream Class Referenceabstract

The QXmppStream class is the base class for all XMPP streams. More...

`#include <QXmppStream.h>`

Inheritance diagram for QXmppStream:
[legend]
Collaboration diagram for QXmppStream:
[legend]

## Public Types

using | IqResult = std::variant< QDomElement, QXmppError >

## Public Slots

virtual void | disconnectFromHost ()
virtual bool | sendData (const QByteArray &)

## Signals

void | connected ()
| This signal is emitted when the stream is connected.
void | disconnected ()
| This signal is emitted when the stream is disconnected.
Signals inherited from QXmppLoggable
void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Public Member Functions

| QXmppStream (QObject *parent)
| ~QXmppStream () override
virtual bool | isConnected () const
bool | sendPacket (const QXmppNonza &)
QXmppTask< QXmpp::SendResult > | send (QXmppNonza &&)
QXmppTask< QXmpp::SendResult > | send (QXmppPacket &&)
QXmppTask< IqResult > | sendIq (QXmppIq &&, const QString &to)
QXmppTask< IqResult > | sendIq (QXmppPacket &&, const QString &id, const QString &to)
void | cancelOngoingIqs ()
bool | hasIqId (const QString &id) const
void | resetPacketCache ()
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)

## Protected Member Functions

QSslSocket * | socket () const
void | setSocket (QSslSocket *socket)
virtual void | handleStart ()
virtual void | handleStanza (const QDomElement &element)=0
virtual void | handleStream (const QDomElement &element)=0
void | enableStreamManagement (bool resetSequenceNumber)
unsigned int | lastIncomingSequenceNumber () const
void | setAcknowledgedSequenceNumber (unsigned int sequenceNumber)
Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
void | info (const QString &message)
void | warning (const QString &message)
void | logReceived (const QString &message)
void | logSent (const QString &message)

## Friends

class | QXmppStreamManager
class | tst_QXmppStream
class | TestClient

## Detailed Description

The QXmppStream class is the base class for all XMPP streams.

## Member Typedef Documentation

## IqResult

QXmppStream::IqResult

Contains a QDomElement containing the IQ response or if the request couldn't be sent a QXmpp::PacketState.

Warning
  THIS API IS NOT FINALIZED YET!

Since
  QXmpp 1.5

## Constructor & Destructor Documentation

## QXmppStream()

QXmppStream::QXmppStream | ( | QObject * | parent | ) |

Constructs a base XMPP stream.

Parameters

  parent |

## ~QXmppStream()

QXmppStream::~QXmppStream | ( |  | ) |

override

Destroys a base XMPP stream.

## Member Function Documentation

## cancelOngoingIqs()

void QXmppStream::cancelOngoingIqs | ( |  | ) |

Cancels all ongoing IQ requests and reports QXmpp::SendError::Disconnected.

Since
  QXmpp 1.5

## disconnectFromHost

void QXmppStream::disconnectFromHost | ( |  | ) |

virtual slot

Disconnects from the remote host.

## enableStreamManagement()

void QXmppStream::enableStreamManagement | ( | bool | resetSequenceNumber | ) |

protected

Enables Stream Management acks / reqs (XEP-0198).

Parameters

  resetSequenceNumber | Indicates if the sequence numbers should be reset. This must be done if the stream is not resumed.

Since
  QXmpp 1.0

## handleStanza()

virtual void QXmppStream::handleStanza | ( | const QDomElement & | element | ) |

protected pure virtual

Handles an incoming XMPP stanza.

Parameters

  element |

## handleStart()

void QXmppStream::handleStart | ( |  | ) |

protected virtual

Handles a stream start event, which occurs when the underlying transport becomes ready (socket connected, encryption started).

If you redefine handleStart(), make sure to call the base class's method.

## handleStream()

virtual void QXmppStream::handleStream | ( | const QDomElement & | element | ) |

protected pure virtual

Handles an incoming XMPP stream start.

Parameters

  element |

## hasIqId()

bool QXmppStream::hasIqId | ( | const QString & | id | ) | const

Returns whether the IQ ID is currently in use.

Since
  QXmpp 1.5

## isConnected()

bool QXmppStream::isConnected | ( |  | ) | const

virtual

Returns true if the stream is connected.

Reimplemented in QXmppOutgoingClient, QXmppIncomingClient, QXmppIncomingServer, and QXmppOutgoingServer.

## lastIncomingSequenceNumber()

unsigned int QXmppStream::lastIncomingSequenceNumber | ( |  | ) | const

protected

Returns the sequence number of the last incoming stanza (XEP-0198).

Since
  QXmpp 1.0

## resetPacketCache()

void QXmppStream::resetPacketCache | ( |  | ) |

Resets the stream management packages cache.

This can be done to prevent that packages from the last connection are being resent.

Since
  QXmpp 1.4

## send() [1/2]

QXmppTask< QXmpp::SendResult > QXmppStream::send | ( | QXmppNonza && | nonza | ) |

Sends an XMPP packet to the peer.

Since
  QXmpp 1.5

## send() [2/2]

QXmppTask< QXmpp::SendResult > QXmppStream::send | ( | QXmppPacket && | packet | ) |

Sends an XMPP packet to the peer.

Since
  QXmpp 1.5

## sendData

bool QXmppStream::sendData | ( | const QByteArray & | data | ) |

virtual slot

Sends raw data to the peer.

Parameters

  data |

## sendIq() [1/2]

QXmppTask< QXmppStream::IqResult > QXmppStream::sendIq | ( | QXmppIq && | iq,
|  | const QString & | to
| ) |  |

Sends an IQ packet and returns the response asynchronously.

Warning
  THIS API IS NOT FINALIZED YET!

Since
  QXmpp 1.5

## sendIq() [2/2]

QXmppTask< QXmppStream::IqResult > QXmppStream::sendIq | ( | QXmppPacket && | packet,
|  | const QString & | id,
|  | const QString & | to
| ) |  |

Sends an IQ packet and returns the response asynchronously.

Warning
  THIS API IS NOT FINALIZED YET!

Since
  QXmpp 1.5

## sendPacket()

bool QXmppStream::sendPacket | ( | const QXmppNonza & | nonza | ) |

Sends an XMPP packet to the peer.

Parameters

  nonza |

## setAcknowledgedSequenceNumber()

void QXmppStream::setAcknowledgedSequenceNumber | ( | unsigned int | sequenceNumber | ) |

protected

Sets the last acknowledged sequence number for outgoing stanzas (XEP-0198).

Since
  QXmpp 1.0

## setSocket()

void QXmppStream::setSocket | ( | QSslSocket * | socket | ) |

protected

Sets the QSslSocket used for this stream.

## socket()

QSslSocket * QXmppStream::socket | ( |  | ) | const

protected

Returns the QSslSocket used for this stream.

The documentation for this class was generated from the following files:

- QXmppStream.h
- QXmppStream.cpp