| Class | Jabber::Bytestreams::IqSiFile |
| In: |
lib/xmpp4r/bytestreams/iq/si.rb
|
| Parent: | REXML::Element |
File-transfer meta-information, may appear as <file/> in IqSi
# File lib/xmpp4r/bytestreams/iq/si.rb, line 92
92: def initialize(fname=nil, size=nil)
93: super 'file'
94: add_namespace IqSi::PROFILE_FILETRANSFER
95: self.fname = fname
96: self.size = size
97: end
Get file date
| result: | [Time] or nil |
# File lib/xmpp4r/bytestreams/iq/si.rb, line 134
134: def date
135: begin
136: Time.xmlschema(attributes['date'])
137: rescue ArgumentError
138: nil
139: end
140: end
Set file date
| d: | [Time] or nil |
# File lib/xmpp4r/bytestreams/iq/si.rb, line 145
145: def date=(d)
146: attributes['date'] = (d ? d.xmlschema : nil)
147: end
File description
# File lib/xmpp4r/bytestreams/iq/si.rb, line 164
164: def description
165: first_element_text('desc')
166: end
Set file description
# File lib/xmpp4r/bytestreams/iq/si.rb, line 170
170: def description=(s)
171: replace_element_text('desc', s)
172: end
Get filename (attribute ‘name’)
# File lib/xmpp4r/bytestreams/iq/si.rb, line 109
109: def fname
110: attributes['name']
111: end
Set filename (attribute ‘name’)
# File lib/xmpp4r/bytestreams/iq/si.rb, line 115
115: def fname=(s)
116: attributes['name'] = s
117: end
Get MD5 hash
# File lib/xmpp4r/bytestreams/iq/si.rb, line 121
121: def hash
122: attributes['hash']
123: end
Set MD5 hash
# File lib/xmpp4r/bytestreams/iq/si.rb, line 127
127: def hash=(s)
128: attributes['hash'] = s
129: end
<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 181
181: def range
182: first_element('range')
183: end
File size in bytes
| result: | [Fixnum] |
# File lib/xmpp4r/bytestreams/iq/si.rb, line 152
152: def size
153: (attributes['size'] =~ /^\d+$/) ? attributes['size'].to_i : nil
154: end
Set file size
# File lib/xmpp4r/bytestreams/iq/si.rb, line 158
158: def size=(s)
159: attributes['size'] = s ? s.to_s : nil
160: end