Sha256: 802b397410e815dc45a2a0b0dbb8940eb4ef3cbe91e2b16c188566939d9e73cc

Contents?: true

Size: 1.62 KB

Versions: 37

Compression:

Stored size: 1.62 KB

Contents

module Blather
class Stanza
class Iq
  # # In-Band Bytestreams Stanza
  #
  # [XEP-0047: In-Band Bytestreams](http://xmpp.org/extensions/xep-0047.html)
  #
  # @handler :ibb_open
  # @handler :ibb_data
  # @handler :ibb_close
  class Ibb < Iq
    # @private
    NS_IBB = 'http://jabber.org/protocol/ibb'

    # Overrides the parent method to remove open, close and data nodes
    #
    # @see Blather::Stanza#reply
    def reply
      reply = super
      reply.remove_children :open
      reply.remove_children :close
      reply.remove_children :data
      reply
    end

    # An Open stanza to
    class Open < Ibb
      register :ibb_open, :open, NS_IBB

      # Find open node
      #
      # @return [Nokogiri::XML::Element]
      def open
        find_first('ns:open', :ns => NS_IBB)
      end

      # Get the sid of the file transfer
      #
      # @return [String]
      def sid
        open['sid']
      end

    end

    # A Data stanza
    class Data < Ibb
      register :ibb_data, :data, NS_IBB

      # Find data node
      #
      # @return [Nokogiri::XML::Element]
      def data
        find_first('ns:data', :ns => NS_IBB)
      end

      # Get the sid of the file transfer
      #
      # @return [String]
      def sid
        data['sid']
      end
    end

    # A Close stanza
    class Close < Ibb
      register :ibb_close, :close, NS_IBB

      # Find close node
      #
      # @return [Nokogiri::XML::Element]
      def close
        find_first('ns:close', :ns => NS_IBB)
      end

      # Get the sid of the file transfer
      #
      # @return [String]
      def sid
        close['sid']
      end
    end
  end
end
end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
blather-2.0.0 lib/blather/stanza/iq/ibb.rb
blather-1.2.0 lib/blather/stanza/iq/ibb.rb
blather-1.1.4 lib/blather/stanza/iq/ibb.rb
blather-1.1.3 lib/blather/stanza/iq/ibb.rb
blather-1.1.2 lib/blather/stanza/iq/ibb.rb
blather-1.1.1 lib/blather/stanza/iq/ibb.rb
blather-1.1.0 lib/blather/stanza/iq/ibb.rb
blather-1.0.0 lib/blather/stanza/iq/ibb.rb
blather-0.8.8 lib/blather/stanza/iq/ibb.rb
blather-0.8.7 lib/blather/stanza/iq/ibb.rb
blather-0.8.6 lib/blather/stanza/iq/ibb.rb
blather-0.8.5 lib/blather/stanza/iq/ibb.rb
blather-0.8.4 lib/blather/stanza/iq/ibb.rb
blather-0.8.3 lib/blather/stanza/iq/ibb.rb
blather-0.8.2 lib/blather/stanza/iq/ibb.rb
tp-blather-0.8.5 lib/blather/stanza/iq/ibb.rb
tp-blather-0.8.4 lib/blather/stanza/iq/ibb.rb
tp-blather-0.8.3 lib/blather/stanza/iq/ibb.rb
tp-blather-0.8.2 lib/blather/stanza/iq/ibb.rb
blather-0.8.1 lib/blather/stanza/iq/ibb.rb