Class: Jabber::Bytestreams::IqSi

Inherits:
REXML::Element show all
Defined in:
lib/xmpp4r/bytestreams/iq/si.rb

Overview

Iq child 'si' for Stream-Initiation

Constant Summary collapse

PROFILE_FILETRANSFER =
'http://jabber.org/protocol/si/profile/file-transfer'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from REXML::Element

#delete_elements, #first_element, #first_element_text, #import, #replace_element_text

Constructor Details

#initialize(id = nil, profile = nil, mime_type = nil) ⇒ IqSi

Returns a new instance of IqSi



16
17
18
19
20
21
22
23
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 16

def initialize(id=nil, profile=nil, mime_type=nil)
  super('si')

  add_namespace 'http://jabber.org/protocol/si'
  self.id = id
  self.profile = profile
  self.mime_type = mime_type
end

Class Method Details

.import(element) ⇒ Object



25
26
27
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 25

def IqSi.import(element)
  IqSi::new.import(element)
end

Instance Method Details

#featureObject

<feature/> child

result
IqFeature


85
86
87
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 85

def feature
  first_element('feature')
end

#fileObject

<file/> child

result
IqSiFile


78
79
80
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 78

def file
  first_element('file')
end

#idObject

Session ID of this stream



41
42
43
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 41

def id
  attributes['id']
end

#id=(s) ⇒ Object

Set Session ID of this stream



47
48
49
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 47

def id=(s)
  attributes['id'] = s
end

#mime_typeObject

MIME type of this stream



53
54
55
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 53

def mime_type
  attributes['mime-type']
end

#mime_type=(s) ⇒ Object

Set MIME type of this stream



59
60
61
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 59

def mime_type=(s)
  attributes['mime-type'] = s
end

#profileObject

Stream profile, can indicate file-transfer



65
66
67
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 65

def profile
  attributes['profile']
end

#profile=(s) ⇒ Object

Set stream profile



71
72
73
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 71

def profile=(s)
  attributes['profile'] = s
end

#typed_add(element) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 29

def typed_add(element)
  if element.kind_of?(REXML::Element) and element.name == 'file'
    super IqSiFile.new.import(element)
  elsif element.kind_of?(REXML::Element) and element.name == 'feature'
    super FeatureNegotiation::IqFeature.new.import(element)
  else
    super element
  end
end