| Class | Jabber::Delay::XDelay |
| In: |
lib/xmpp4r/delay/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/delay/x/delay.rb, line 93
93: def set_from(jid)
94: self.from = jid
95: self
96: end
Set the timestamp (chaining-friendly)
# File lib/xmpp4r/delay/x/delay.rb, line 68
68: def set_stamp(t)
69: self.stamp = t
70: self
71: end
Get the timestamp
| result: | [Time] or nil |
# File lib/xmpp4r/delay/x/delay.rb, line 41
41: def stamp
42: if attributes['stamp']
43: begin
44: # Actually this should be Time.xmlschema,
45: # but "unfortunately, the 'jabber:x:delay' namespace predates" JEP 0082
46: Time.parse(attributes['stamp'])
47: rescue ArgumentError
48: nil
49: end
50: else
51: nil
52: end
53: end