class Jabber::Bytestreams::IqSiFile

File-transfer meta-information, may appear as <file/> in IqSi

Public Class Methods

new(fname=nil, size=nil) click to toggle source
Calls superclass method
# File lib/xmpp4r/bytestreams/iq/si.rb, line 85
def initialize(fname=nil, size=nil)
  super()
  self.fname = fname
  self.size = size
end

Public Instance Methods

date() click to toggle source

Get file date

result
Time

or nil

# File lib/xmpp4r/bytestreams/iq/si.rb, line 118
def date
  begin
    Time.xmlschema(attributes['date'])
  rescue ArgumentError
    nil
  end
end
date=(d) click to toggle source

Set file date

d
Time

or nil

# File lib/xmpp4r/bytestreams/iq/si.rb, line 129
def date=(d)
  attributes['date'] = (d ? d.xmlschema : nil)
end
description() click to toggle source

File description

# File lib/xmpp4r/bytestreams/iq/si.rb, line 148
def description
  first_element_text('desc')
end
description=(s) click to toggle source

Set file description

# File lib/xmpp4r/bytestreams/iq/si.rb, line 154
def description=(s)
  replace_element_text('desc', s)
end
fname() click to toggle source

Get filename (attribute 'name')

# File lib/xmpp4r/bytestreams/iq/si.rb, line 93
def fname
  attributes['name']
end
fname=(s) click to toggle source

Set filename (attribute 'name')

# File lib/xmpp4r/bytestreams/iq/si.rb, line 99
def fname=(s)
  attributes['name'] = s
end
hash() click to toggle source

Get MD5 hash

# File lib/xmpp4r/bytestreams/iq/si.rb, line 105
def hash
  attributes['hash']
end
hash=(s) click to toggle source

Set MD5 hash

# File lib/xmpp4r/bytestreams/iq/si.rb, line 111
def hash=(s)
  attributes['hash'] = s
end
range() click to toggle source

<range/> child

A file-transfer offer may contain this with no attributes set, indicating the ability to do ranged transfers.

result
IqSiFileRange
# File lib/xmpp4r/bytestreams/iq/si.rb, line 165
def range
  first_element('range')
end
size() click to toggle source

File size in bytes

result
Fixnum
# File lib/xmpp4r/bytestreams/iq/si.rb, line 136
def size
  (attributes['size'] =~ /^\d+$/) ? attributes['size'].to_i : nil
end
size=(s) click to toggle source

Set file size

# File lib/xmpp4r/bytestreams/iq/si.rb, line 142
def size=(s)
  attributes['size'] = s ? s.to_s : nil
end