class XMPP::Jingle

Overview

Jingle is a high-level helper for XEP-0166 Jingle sessions used by the file-transfer (XEP-0234) and in-band bytestream (XEP-0261) application descriptions. It builds and parses session-initiate / session-accept stanzas for a single content offer.

jingle = XMPP::Jingle.new(client) offer = jingle.build_offer("[email protected]", "abc-123", name: "report.pdf", size: 2048_i64) jingle.send_offer(offer)

See: https://xmpp.org/extensions/xep-0166.html https://xmpp.org/extensions/xep-0234.html https://xmpp.org/extensions/xep-0261.html

Defined in:

xmpp/jingle.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def build_accept(to : JID | String, initiator : String, sid : String) : Stanza::IQ #

build_accept builds a session-accept IQ acknowledging a received offer.


[View source]
def build_offer(to : JID | String, sid : String, name : String, size : Int64 = 0_i64, ibb_block_size : Int32 = 0, initiator_domain : String | Nil = nil) : Stanza::IQ #

build_offer builds a session-initiate IQ offering a single file-transfer content. When ibb_block_size is greater than zero an In-Band Bytestream description is added alongside, negotiating a stream over XEP-0047.


[View source]
def build_terminate(to : JID | String, sid : String) : Stanza::IQ #

build_terminate builds a session-terminate IQ to end a session.


[View source]
def parse(iq : Stanza::IQ | Nil) : Stanza::Jingle | Nil #

parse extracts a Jingle stanza from an IQ response payload.


[View source]
def send_offer(iq : Stanza::IQ, timeout : Time::Span = 5.seconds) #

send_offer sends a session-initiate IQ and returns the negotiated content descriptions carried in the response, if any.


[View source]