Sha256: e5e0d44d97dce5b49c312b768ad985775c3e7190c98c54c4d9adf4f286dab711

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

module Blather
class Stanza

  class PubSub < Iq
    register :pubsub, :pubsub, 'http://jabber.org/protocol/pubsub'

    ##
    # Ensure the namespace is set to the query node
    def initialize(type = nil, host = nil)
      super type
      self.to = host
      pubsub.namespace = self.class.ns unless pubsub.namespace
    end

    ##
    # Kill the pubsub node before running inherit
    def inherit(node)
      pubsub.remove!
      super
    end

    def pubsub
      unless p = find_first('//pubsub', Stanza::PubSub::Affiliations.ns)
        p = XMPPNode.new('pubsub')
        p.namespace = self.class.ns
        self << p
      end
      p
    end
  end

end #Stanza
end #Blather

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blather-0.2.2 lib/blather/stanza/pubsub.rb