Sha256: 67187951da66d0fbbdf9e8e2dcd1f6d2f047ccbc0459eeeec1a9b6479376c524

Contents?: true

Size: 1.67 KB

Versions: 15

Compression:

Stored size: 1.67 KB

Contents

# =XMPP4R - XMPP Library for Ruby
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
# Website::http://home.gna.org/xmpp4r/

require 'xmpp4r/xmppelement'

module Jabber
  module Caps
    NS_CAPS='http://jabber.org/protocol/caps'

    ##
    # The <c/> XMPP element, used to advertise entity capabilities.
    #
    # See http://www.xmpp.org/extensions/xep-0115.html#protocol.
    #
    # You should not need to construct this element directly, see
    # Jabber::Caps::Helper.
    class C < XMPPElement
      name_xmlns 'c', NS_CAPS
      force_xmlns true

      def initialize(node = nil, ver = nil)
        super()
        add_attribute('node', node) if node
        if ver
          add_attribute('ver', ver)
          add_attribute('hash', 'sha-1')
        end
      end

      ##
      # Get the value of this element's 'ver' attribute,
      # an opaque hash representing this entity's capabilities.
      def ver
        attributes['ver']
      end

      ##
      # Get the value of this element's 'node' attribute,
      # a 'unique identifier for the software underlying the entity'
      def node
        attributes['node']
      end

      ##
      # Get the value of this element's 'hash' attribute,
      # the algorithm used in generating the 'ver' attribute
      def hash
        attributes['hash']
      end

      ##
      # Get the value of this element's 'ext' attribute,
      # the list of extensions for legacy clients.
      def ext
        attributes['ext']
      end

      ##
      # Is this a legacy caps response, as defined by version 1.3 of
      # the XEP-0115 specification?
      def legacy?
        hash.nil? || hash.empty?
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
brontes3d-xmpp4r-0.4 lib/xmpp4r/caps/c.rb
ln-xmpp4r-0.5 lib/xmpp4r/caps/c.rb
mojodna-xmpp4r-0.4.0.2 lib/xmpp4r/caps/c.rb
mojodna-xmpp4r-0.4.0.3 lib/xmpp4r/caps/c.rb
seanohalpin-xmpp4r-0.4.1 lib/xmpp4r/caps/c.rb
xmpp4r-0.5.5 lib/xmpp4r/caps/c.rb
gmcmillan-xmpp4r-0.6.2 lib/xmpp4r/caps/c.rb
gmcmillan-xmpp4r-0.6.1 lib/xmpp4r/caps/c.rb
gmcmillan-xmpp4r-0.6 lib/xmpp4r/caps/c.rb
gmcmillan-xmpp4r-0.5 lib/xmpp4r/caps/c.rb
mad-p-xmpp4r-0.6.3 lib/xmpp4r/caps/c.rb
mad-p-xmpp4r-0.6.2 lib/xmpp4r/caps/c.rb
mad-p-xmpp4r-0.6.1 lib/xmpp4r/caps/c.rb
mad-p-xmpp4r-0.6.0 lib/xmpp4r/caps/c.rb
xmpp4r-0.5 lib/xmpp4r/caps/c.rb