class XMPP::Blocking

Overview

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("[email protected]") blocking.list # => [BlockItem(jid: "[email protected]")] blocking.unblock("[email protected]")

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

Defined in:

xmpp/blocking.cr

Constant Summary

NS_BLOCKING = "urn:xmpp:blocking"

Disco feature advertised by servers that support blocking.

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def 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).


[View source]
def block(jid : String, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil #

block is a convenience overload for a single JID.


[View source]
def list(timeout : Time::Span = 5.seconds) : Array(Stanza::BlockItem) | Nil #

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


[View source]
def 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.


[View source]
def 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.


[View source]
def unblock(jid : String, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil #

unblock is a convenience overload for a single JID.


[View source]