Class: Jabber::Bytestreams::IqSiFile

Class | Jabber::Bytestreams::IqSiFile
In: | lib/xmpp4r/bytestreams/iq/si.rb
Parent: | XMPPElement

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

### Methods

date date= description description= fname fname= hash hash= new range size size=

### Public Class methods

new(fname=nil, size=nil)

[Source]

        # File lib/xmpp4r/bytestreams/iq/si.rb, line 85
    85:       def initialize(fname=nil, size=nil)
    86:         super()
    87:         self.fname = fname
    88:         self.size = size
    89:       end

### Public Instance methods

date()

Get file date

result: | [Time] or nil

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 118
    118:       def date
    119:         begin
    120:           Time.xmlschema(attributes['date'])
    121:         rescue ArgumentError
    122:           nil
    123:         end
    124:       end

date=(d)

Set file date

d: | [Time] or nil

[Source]

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

description()

File description

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 148
    148:       def description
    149:         first_element_text('desc')
    150:       end

description=(s)

Set file description

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 154
    154:       def description=(s)
    155:         replace_element_text('desc', s)
    156:       end

fname()

Get filename (attribute ‘name’)

[Source]

        # File lib/xmpp4r/bytestreams/iq/si.rb, line 93
    93:       def fname
    94:         attributes['name']
    95:       end

fname=(s)

Set filename (attribute ‘name’)

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 99
     99:       def fname=(s)
    100:         attributes['name'] = s
    101:       end

hash()

Get MD5 hash

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 105
    105:       def hash
    106:         attributes['hash']
    107:       end

hash=(s)

Set MD5 hash

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 111
    111:       def hash=(s)
    112:         attributes['hash'] = s
    113:       end

range()

<range/> child

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

result: | [IqSiFileRange]

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 165
    165:       def range
    166:         first_element('range')
    167:       end

size()

File size in bytes

result: | [Fixnum]

[Source]

         # File lib/xmpp4r/bytestreams/iq/si.rb, line 136
    136:       def size
    137:         (attributes['size'] =~ /^\d+$/) ? attributes['size'].to_i : nil
    138:       end

size=(s)

Set file size

[Source]

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

[Validate]