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