Class: Jabber::Roster::XRoster
- Inherits:
-
X
- Object
- REXML::Element
- X
- Jabber::Roster::XRoster
- Defined in:
- lib/xmpp4r/roster/x/roster.rb
Overview
Implementation of JEP-0144 for <x xmlns='http://jabber.org/protocol/rosterx'/>
attached to <message/>
stanzas
Should be backwards compatible to JEP-0093, as only action attribute of roster items are missing there. Pay attention to the namespace which is jabber:x:roster
for JEP-0093!
Instance Method Summary collapse
-
#initialize ⇒ XRoster
constructor
Initialize a new XRoster element.
-
#typed_add(element) ⇒ Object
Add an element to the roster attachment.
Methods inherited from X
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text
Constructor Details
#initialize ⇒ XRoster
Initialize a new XRoster element
22 23 24 25 |
# File 'lib/xmpp4r/roster/x/roster.rb', line 22 def initialize super() add_namespace('http://jabber.org/protocol/rosterx') end |
Instance Method Details
#typed_add(element) ⇒ Object
Add an element to the roster attachment
Converts <item/> elements to XRosterItem
31 32 33 34 35 36 37 |
# File 'lib/xmpp4r/roster/x/roster.rb', line 31 def typed_add(element) if element.kind_of?(REXML::Element) && (element.name == 'item') super(XRosterItem::new.import(element)) else super(element) end end |