Class: JabberAdmin::Commands::SendStanzaC2s

Inherits:
Object
  • Object
show all
Defined in:
lib/jabber_admin/commands/send_stanza_c2s.rb

Overview

Send a message (stanza) as if sent from a c2s session.

Class Method Summary collapse

Class Method Details

.call(callable, user:, stanza:) ⇒ Object

Pass the correct data to the given callable.

Parameters:

  • callable (Proc, #call)

    the callable to call

  • user (String)

    user JID w/ resource (eg. tom@localhost/bot)

  • stanza (String)

    the XML stanz to send (eg. <message to='user1@localhost'> <ext attr='value'/></message>)



16
17
18
19
20
21
22
23
24
25
# File 'lib/jabber_admin/commands/send_stanza_c2s.rb', line 16

def self.call(callable, user:, stanza:)
  uid, host = user.split('@')
  host, resource = host.split('/')
  resource ||= 'bot'
  callable.call('send_stanza_c2s',
                user: uid,
                host: host,
                resource: resource,
                stanza: stanza)
end