class

XMPP::Blocking

Inherits Reference / Object

Blocking is a high-level client for XEP-0191 - Blocking Command.

Blocking lets a client prevent inbound communication from selected JIDs (or their bare-JID domains) by managing a server-side blocklist.

blocking = XMPP::Blocking.new(client) return unless blocking.supported? blocking.block("spammer@example.org") blocking.list # => [BlockItem(jid: "spammer@example.org")] blocking.unblock("spammer@example.org")

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

Constants

NS_BLOCKING = "urn:xmpp:blocking"

Disco feature advertised by servers that support blocking.

Constructors

new(client : Client)
Source

Instance methods

block(jids : Enumerable(String), timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

block blocks the given jids. Returns the result/error IQ (nil on timeout).

Source
block(jid : String, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

block is a convenience overload for a single JID.

Source
list(timeout : Time::Span = 5.seconds) : Array(Stanza::BlockItem) | Nil

list returns the JIDs currently blocked (as BlockItem), or nil on error.

Source
supported?(timeout : Time::Span = 5.seconds) : Bool

supported? queries the server for blocking support and returns true when the urn:xmpp:blocking feature is advertised.

Source
unblock(jids : Enumerable(String) | Nil = nil, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

unblock unblocks the given jids. Returns the result/error IQ. When no jids are given the whole blocklist is cleared.

Source
unblock(jid : String, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

unblock is a convenience overload for a single JID.

Source