Sha256: 4ba8c8e6d9bcf05479e3f2379917d696e38368b32111f17b6131f6d3f3eb5d52
Contents?: true
Size: 1.73 KB
Versions: 7
Compression:
Stored size: 1.73 KB
Contents
module Blather class Stanza class PubSub class Event < Message register :pubsub_event, :event, 'http://jabber.org/protocol/pubsub#event' ## # Ensure the event_node is created def self.new(type = nil) node = super node.event_node node end ## # Kill the event_node node before running inherit def inherit(node) event_node.remove super end def node !purge? ? items_node[:node] : purge_node[:node] end def retractions items_node.find('//ns:retract', :ns => self.class.registered_ns).map { |i| i[:id] } end def retractions? !retractions.empty? end def items items_node.find('//ns:item', :ns => self.class.registered_ns).map { |i| PubSubItem.new(nil,nil,self.document).inherit i } end def items? !items.empty? end def purge? purge_node end def event_node node = find_first('//ns:event', :ns => self.class.registered_ns) node = find_first('//event', self.class.registered_ns) unless node unless node (self << (node = XMPPNode.new('event', self.document))) node.namespace = self.class.registered_ns end node end def items_node node = find_first('ns:event/ns:items', :ns => self.class.registered_ns) unless node (self.event_node << (node = XMPPNode.new('items', self.document))) node.namespace = event_node.namespace end node end def purge_node event_node.find_first('//ns:purge', :ns => self.class.registered_ns) end def subscription_ids find('//ns:header[@name="SubID"]', :ns => 'http://jabber.org/protocol/shim').map { |n| n.content } end end end #PubSub end #Stanza end #Blather
Version data entries
7 entries across 7 versions & 2 rubygems