| Class | Jabber::XDelay |
| In: |
lib/xmpp4r/x/delay.rb
|
| Parent: | X |
Implementation of JEP 0091 for <x xmlns=’jabber:x:delay’ stamp=’…’ …/> applied on <message/> and <presence/> stanzas
One may also use XDelay#text for a descriptive reason for the delay.
Please note that you must require ‘xmpp4r/xdelay’ to use this class as it’s not required by a basic XMPP implementation. <x/> elements with the specific namespace will then be converted to XDelay automatically.
Set the timestamp’s origin (chaining-friendly)
# File lib/xmpp4r/x/delay.rb, line 91
91: def set_from(jid)
92: self.from = jid
93: self
94: end
Set the timestamp (chaining-friendly)
# File lib/xmpp4r/x/delay.rb, line 66
66: def set_stamp(t)
67: self.stamp = t
68: self
69: end
Get the timestamp
| result: | [Time] or nil |
# File lib/xmpp4r/x/delay.rb, line 39
39: def stamp
40: if attributes['stamp']
41: begin
42: # Actually this should be Time.xmlschema,
43: # but "unfortunately, the 'jabber:x:delay' namespace predates" JEP 0082
44: Time.parse(attributes['stamp'])
45: rescue ArgumentError
46: nil
47: end
48: else
49: nil
50: end
51: end