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.



12
13
14
15
16
17
18
19
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 12

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



21
22
23
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 21

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

Instance Method Details

#featureObject

<feature/> child

result
IqFeature


81
82
83
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 81

def feature
  first_element('feature')
end

#fileObject

<file/> child

result
IqSiFile


74
75
76
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 74

def file
  first_element('file')
end

#idObject

Session ID of this stream



37
38
39
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 37

def id
  attributes['id']
end

#id=(s) ⇒ Object

Set Session ID of this stream



43
44
45
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 43

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

#mime_typeObject

MIME type of this stream



49
50
51
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 49

def mime_type
  attributes['mime-type']
end

#mime_type=(s) ⇒ Object

Set MIME type of this stream



55
56
57
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 55

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

#profileObject

Stream profile, can indicate file-transfer



61
62
63
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 61

def profile
  attributes['profile']
end

#profile=(s) ⇒ Object

Set stream profile



67
68
69
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 67

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

#typed_add(element) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/xmpp4r/bytestreams/iq/si.rb', line 25

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