Sha256: e5eff9ac2d9ec53048322a15eb7f385df49b39cdc7f1c5d805f1c15edcaf921f

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

module Blather
class Stanza

  ##
  # Base Error stanza
  class Error < Stanza
    def self.new_from(stanza, defined_condition, type, text = nil)
      err = XMPPNode.new(defined_condition)
      err['type'] = type
      err.xmlns = 'urn:ietf:params:xml:ns:xmpp-stanzas'

      if text
        text = XMPPNode.new('text', text)
        text.xmlns = 'urn:ietf:params:xml:ns:xmpp-stanzas'
        err << text
      end

      elem = stanza.copy(true)
      elem.type = 'error'
      elem << err

      elem
    end

    def error?
      true
    end
  end #ErrorStanza

end #Stanza
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blather-0.2.1 lib/blather/stanza/error.rb
blather-0.2 lib/blather/stanza/error.rb