class

XMPP::VCard

Inherits Reference / Object

VCard is a high-level client for XEP-0054 - vcard-temp.

vcard-temp is a legacy form of structured user data (name, address, photo) exchanged as an IQ get/set against a user's bare JID. Servers that support it do not advertise a disco feature; support is instead determined by whether the vcard-temp IQ succeeds.

vc = XMPP::VCard.new(client) card = vc.fetch # => Stanza::VCard? for the current user card.fn = "Juliet Capulet" card.set(card)

See: https://xmpp.org/extensions/xep-0054.html

Constants

NS_VCARD_TEMP = "vcard-temp"

Disco feature is not used by vcard-temp, but is exposed for symmetry.

Constructors

new(client : Client)
Source

Instance methods

fetch(jid : String | Nil = nil, timeout : Time::Span = 5.seconds) : Stanza::VCard | Nil

fetch retrieves the vCard stored for the given bare JID (defaults to the current user). Returns the Stanza::VCard payload on a successful result, or nil on error or timeout.

Source
set(vcard : Stanza::VCard, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

set stores the given vCard against the current user. Returns the result/error IQ (nil on timeout); callers check type == "result".

Source