Class: Blather::Stanza::Message::MUCUser

Inherits:
Blather::Stanza::Message show all
Includes:
Blather::Stanza::MUC::MUCUserBase
Defined in:
lib/blather/stanza/message/muc_user.rb

Defined Under Namespace

Classes: Decline, Invite, InviteBase

Constant Summary

Constants included from Blather::Stanza::MUC::MUCUserBase

Blather::Stanza::MUC::MUCUserBase::MUC_USER_NAMESPACE

Constants inherited from Blather::Stanza::Message

CHAT_STATE_NS, HTML_BODY_NS, HTML_NS, VALID_CHAT_STATES, VALID_TYPES

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Instance Attribute Summary

Attributes inherited from Blather::Stanza

#handler_hierarchy

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Blather::Stanza::MUC::MUCUserBase

#find_password_node, included, #inherit, #muc_user, #password, #password=, #password_node

Methods inherited from Blather::Stanza::Message

#body, #body=, #chat?, #chat_state, #chat_state=, #delay, #delayed?, #error?, #form, #groupchat?, #headline?, import, #inherit, #normal?, #parent_thread, #subject, #subject=, #thread, #thread=, #type=, #xhtml, #xhtml=, #xhtml_node

Methods inherited from Blather::Stanza

#as_error, #error?, #from, #from=, handler_list, #id, #id=, #initialize, next_id, register, #reply, #reply!, #to, #to=, #type, #type=

Methods inherited from XMPPNode

class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza

Constructor Details

This class inherits a constructor from Blather::Stanza

Class Method Details

.new(to = nil, body = nil, type = :normal) ⇒ Object



12
13
14
# File 'lib/blather/stanza/message/muc_user.rb', line 12

def self.new(to = nil, body = nil, type = :normal)
  super
end

Instance Method Details

#declineObject



37
38
39
40
41
42
43
44
# File 'lib/blather/stanza/message/muc_user.rb', line 37

def decline
  if decline = find_decline_node
    Decline.new decline
  else
    muc_user << (decline = Decline.new nil, nil, nil, self.document)
    decline
  end
end

#find_decline_nodeObject



46
47
48
# File 'lib/blather/stanza/message/muc_user.rb', line 46

def find_decline_node
  muc_user.find_first 'ns:decline', :ns => self.class.registered_ns
end

#find_invite_nodeObject



33
34
35
# File 'lib/blather/stanza/message/muc_user.rb', line 33

def find_invite_node
  muc_user.find_first 'ns:invite', :ns => self.class.registered_ns
end

#inviteObject



24
25
26
27
28
29
30
31
# File 'lib/blather/stanza/message/muc_user.rb', line 24

def invite
  if invite = find_invite_node
    Invite.new invite
  else
    muc_user << (invite = Invite.new nil, nil, nil, self.document)
    invite
  end
end

#invite?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/blather/stanza/message/muc_user.rb', line 16

def invite?
  !!find_invite_node
end

#invite_decline?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/blather/stanza/message/muc_user.rb', line 20

def invite_decline?
  !!find_decline_node
end