Sha256: e04bc90977cec9785d336947621ef48468b208cb607203f501231304becf3582
Contents?: true
Size: 1.12 KB
Versions: 8
Compression:
Stored size: 1.12 KB
Contents
module Blather class Stanza 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 end end #Stanza end #Blather
Version data entries
8 entries across 8 versions & 2 rubygems