Class: Jabber::MUC::XMUCUser

Inherits:
X show all
Defined in:
lib/xmpp4r/muc/x/muc.rb

Overview

Class for <x/> elements with namespace jabber.org/protocol/muc#user

See JEP-0058 for details

Instance Method Summary collapse

Methods inherited from XMPPElement

class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, #initialize, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=

Methods inherited from REXML::Element

#==, #delete_elements, #each_elements, #first_element, #first_element_content, #first_element_text, #import, import, #replace_element_content, #replace_element_text, #typed_add

Constructor Details

This class inherits a constructor from Jabber::XMPPElement

Instance Method Details

#itemsObject

Get all <item/> elements

result
Array

of [XMUCUserItem]



61
62
63
64
65
66
67
# File 'lib/xmpp4r/muc/x/muc.rb', line 61

def items
  res = []
  each_element('item') { |item|
    res << item
  }
  res
end

#status_codeObject

Retrieve the three-digit code in <x xmlns='http://jabber.org/protocol/muc#user'><status code='...'/></x>

result
Fixnum

or nil



48
49
50
51
52
53
54
55
56
# File 'lib/xmpp4r/muc/x/muc.rb', line 48

def status_code
  e = nil
  each_element('status') { |xe| e = xe }
  if e and e.attributes['code'].size == 3 and e.attributes['code'].to_i != 0
    e.attributes['code'].to_i
  else
    nil
  end
end