Sha256: 503dd02af512a33d81efdb387e6ed0ebf8434e2bc08eb3e071dc6621d7506d50

Contents?: true

Size: 849 Bytes

Versions: 13

Compression:

Stored size: 849 Bytes

Contents

module Blather
class Stanza
class PubSub

  class Subscribe < PubSub
    register :pubsub_subscribe, :subscribe, self.registered_ns

    def self.new(type = :set, host = nil, node = nil, jid = nil)
      new_node = super(type, host)
      new_node.node = node
      new_node.jid = jid
      new_node
    end

    def jid
      JID.new(subscribe[:jid])
    end

    def jid=(jid)
      subscribe[:jid] = jid
    end

    def node
      subscribe[:node]
    end

    def node=(node)
      subscribe[:node] = node
    end

    def subscribe
      unless subscribe = pubsub.find_first('ns:subscribe', :ns => self.class.registered_ns)
        self.pubsub << (subscribe = XMPPNode.new('subscribe', self.document))
        subscribe.namespace = self.pubsub.namespace
      end
      subscribe
    end
  end #Subscribe

end #PubSub
end #Stanza
end #Blather

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
sprsquish-blather-0.4.0 lib/blather/stanza/pubsub/subscribe.rb
sprsquish-blather-0.4.1 lib/blather/stanza/pubsub/subscribe.rb
sprsquish-blather-0.4.2 lib/blather/stanza/pubsub/subscribe.rb
sprsquish-blather-0.4.3 lib/blather/stanza/pubsub/subscribe.rb
sprsquish-blather-0.4.4 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.7 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.6 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.5 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.4 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.3 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.2 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.1 lib/blather/stanza/pubsub/subscribe.rb
blather-0.4.0 lib/blather/stanza/pubsub/subscribe.rb