Sha256: 2d07296b97d9c313a94fa55c3024747eb6b699e68652d5c6ecf8056539ef1b72
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
module Blather class Stanza class Iq class DiscoItems < Disco register :disco_items, nil, 'http://jabber.org/protocol/disco#items' def initialize(type = nil, node = nil, items = []) super type self.node = node [items].flatten.each do |item| query << (item.is_a?(Item) ? item : Item.new(item[:jid], item[:node], item[:name])) end end def items items = query.find('item') items = query.find('query_ns:item', :query_ns => self.class.ns) if items.empty? items.map { |i| Item.new i } end def node=(node) query.attributes[:node] = node end def node query.attributes[:node] end class Item < XMPPNode def initialize(jid, node = nil, name = nil) super :item if jid.is_a?(XML::Node) self.inherit jid else self.jid = jid self.node = node self.name = name end end def jid (j = attributes[:jid]) ? JID.new(j) : nil end attribute_writer :jid attribute_accessor :node, :name, :to_sym => false end def eql?(other) other.kind_of?(self.class) && other.jid == self.jid && other.node == self.node && other.name == self.name end end end #Iq end #Stanza end #Blather
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
sprsquish-blather-0.2.3 | lib/blather/stanza/iq/discos/disco_items.rb |
blather-0.2.3 | lib/blather/stanza/iq/discos/disco_items.rb |