QXmpp: QXmppVCardManager Class Reference

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppVCardManager Class Reference
Managers

The QXmppVCardManager class gets/sets XMPP vCards. It is an implementation of XEP-0054: vcard-temp. More...

`#include <QXmppVCardManager.h>`

Inheritance diagram for QXmppVCardManager:

## Public Types
using | Result = std::variant<QXmpp::Success, QXmppError>
| Success or QXmppError.
using | VCardIqResult = std::variant<QXmppVCardIq, QXmppError>
| QXmppVCardIq or QXmppError.

## Public Member Functions
QXmppTask< VCardIqResult > | fetchVCard (const QString &bareJid)
QXmppTask< Result > | setVCard (const QXmppVCardIq &)
QString | requestVCard (const QString &bareJid=QString())
const QXmppVCardIq & | clientVCard () const
| Returns the vCard of the connected client.
void | setClientVCard (const QXmppVCardIq &)
| Sets the vCard of the connected client.
QString | requestClientVCard ()
bool | isClientVCardReceived () const
| Returns true if vCard of the connected client has been received else false.
Q_SIGNAL void | vCardReceived (const QXmppVCardIq &)
Q_SIGNAL void | clientVCardReceived ()
Public Member Functions inherited from QXmppClientExtension
| QXmppClientExtension ()
virtual QStringList | discoveryFeatures () const
virtual QList< QXmppDiscoIdentity > | discoveryIdentities () const
virtual bool | handleStanza (const QDomElement &stanza)
| You need to implement this method to process incoming XMPP stanzas.
virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
| You need to implement this method to process incoming XMPP stanzas.
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)
Q_SIGNAL void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
Q_SIGNAL void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
Q_SIGNAL void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Protected Member Functions
void | onRegistered (QXmppClient *client) override
void | onUnregistered (QXmppClient *client) override
Protected Member Functions inherited from QXmppClientExtension
QXmppClient * | client () const
virtual void | setClient (QXmppClient *client)
void | injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
bool | injectMessage (QXmppMessage &&message)
Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
| Logs a debugging message.
void | info (const QString &message)
| Logs an informational message.
void | warning (const QString &message)
| Logs a warning message.
void | logReceived (const QString &message)
| Logs a received packet.
void | logSent (const QString &message)
| Logs a sent packet.

## Detailed Description

The QXmppVCardManager class gets/sets XMPP vCards. It is an implementation of XEP-0054: vcard-temp.

Note
  Its object should not be created using its constructor. Instead `QXmppClient::findExtension<QXmppVCardManager>()` should be used to get the instantiated object of this class.

Getting vCards of entries in Roster:
It doesn't store vCards of the JIDs in the roster of connected user. Instead client has to request for a particular vCard using requestVCard(). And connect to the signal vCardReceived() to get the requested vCard.

Getting vCard of the connected client:
For getting the vCard of the connected user itself. Client can call requestClientVCard() and on the signal clientVCardReceived() it can get its vCard using clientVCard().

Setting vCard of the client:
Using setClientVCard() client can set its vCard.

Note
  Client can't set/change vCards of roster entries.

## Member Function Documentation

## ◆ clientVCardReceived()

Q_SIGNAL void QXmppVCardManager::clientVCardReceived | ( |  | ) |

This signal is emitted when the client's vCard is received after calling the requestClientVCard() function.

## ◆ fetchVCard()

QXmppTask< QXmppVCardManager::VCardIqResult > QXmppVCardManager::fetchVCard | ( | const QString & | bareJid | ) |

Fetches the VCard of a bare JID.

Since
  QXmpp 1.8

## ◆ onRegistered()

void QXmppVCardManager::onRegistered | ( | QXmppClient * | client | ) |
| overrideprotectedvirtual

Called after the extension has been added to a QXmppClient.

Parameters

  client |

Reimplemented from QXmppClientExtension.

## ◆ onUnregistered()

void QXmppVCardManager::onUnregistered | ( | QXmppClient * | client | ) |
| overrideprotectedvirtual

Called after the extension has been removed from a QXmppClient.

Parameters

  client |

Reimplemented from QXmppClientExtension.

## ◆ requestClientVCard()

QString QXmppVCardManager::requestClientVCard | ( |  | ) |

This function requests the server for vCard of the connected user itself. Once received the signal clientVCardReceived() is emitted. Received vCard can be get using clientVCard().

## ◆ requestVCard()

QString QXmppVCardManager::requestVCard | ( | const QString & | jid = QString() | ) |

This function requests the server for vCard of the specified jid. Once received the signal vCardReceived() is emitted.

Parameters

  jid | Jid of the specific entry in the roster

## ◆ setVCard()

QXmppTask< QXmppVCardManager::Result > QXmppVCardManager::setVCard | ( | const QXmppVCardIq & | vCard | ) |

Sets the VCard of the currently connected account.

Since
  QXmpp 1.8

## ◆ vCardReceived()

Q_SIGNAL void QXmppVCardManager::vCardReceived | ( | const QXmppVCardIq & |  | ) |

This signal is emitted when the requested vCard is received after calling the requestVCard() function.

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

- QXmppVCardManager.h
- QXmppVCardManager.cpp