Sha256: decb88d93e296da29abf782a54d6f3407203a816aabe6861273e6bd653251d25

Contents?: true

Size: 955 Bytes

Versions: 11

Compression:

Stored size: 955 Bytes

Contents

module Blather
class Stanza
class Iq

  class Query < Iq
    register :query, :query

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

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

    ##
    # Query node accessor
    # This will ensure there actually is a query node
    def query
      q = find_first('query')
      q = find_first('//query_ns:query', :query_ns => self.class.ns) if !q && self.class.ns
      (self << (q = XMPPNode.new('query'))) unless q
      q
    end

    ##
    # A query reply should have type set to "result"
    def reply
      elem = super
      elem.type = :result
      elem
    end

    ##
    # A query reply should have type set to "result"
    def reply!
      super
      self.type = :result
      self
    end
  end #Query

end #Iq
end #Stanza
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sprsquish-blather-0.3.0 lib/blather/stanza/iq/query.rb
sprsquish-blather-0.3.1 lib/blather/stanza/iq/query.rb
sprsquish-blather-0.3.2 lib/blather/stanza/iq/query.rb
sprsquish-blather-0.3.3 lib/blather/stanza/iq/query.rb
sprsquish-blather-0.3.4 lib/blather/stanza/iq/query.rb
blather-0.2.2 lib/blather/stanza/iq/query.rb
blather-0.3.1 lib/blather/stanza/iq/query.rb
blather-0.3.0 lib/blather/stanza/iq/query.rb
blather-0.3.4 lib/blather/stanza/iq/query.rb
blather-0.3.2 lib/blather/stanza/iq/query.rb
blather-0.3.3 lib/blather/stanza/iq/query.rb