Class | Jabber::MUC::XMUCUser |
In: |
lib/xmpp4r/muc/x/muc.rb
|
Parent: | X |
Class for <x/> elements with namespace jabber.org/protocol/muc#user
See JEP-0058 for details
Initialize an <x/> element and set namespace to jabber.org/protocol/muc#user
# File lib/xmpp4r/muc/x/muc.rb, line 51 51: def initialize 52: super 53: add_namespace('http://jabber.org/protocol/muc#user') 54: end
Get all <item/> elements
result: | [Array] of [XMUCUserItem] |
# File lib/xmpp4r/muc/x/muc.rb, line 86 86: def items 87: res = [] 88: each_element('item') { |item| 89: res << item 90: } 91: res 92: end
Retrieve the three-digit code in <x xmlns=’jabber.org/protocol/muc#user'>
result: | [Fixnum] or nil |
# File lib/xmpp4r/muc/x/muc.rb, line 73 73: def status_code 74: e = nil 75: each_element('status') { |xe| e = xe } 76: if e and e.attributes['code'].size == 3 and e.attributes['code'].to_i != 0 77: e.attributes['code'].to_i 78: else 79: nil 80: end 81: end
Add a children element, will be imported to [XMUCUserItem] if name is "item"
# File lib/xmpp4r/muc/x/muc.rb, line 59 59: def typed_add(element) 60: if element.kind_of?(REXML::Element) && (element.name == 'item') 61: super(XMUCUserItem::new.import(element)) 62: elsif element.kind_of?(REXML::Element) && (element.name == 'invite') 63: super(XMUCUserInvite::new.import(element)) 64: else 65: super(element) 66: end 67: end