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.
Initialize a new XDelay element
insertnow |
|
# File lib/xmpp4r/delay/x/delay.rb, line 30 def initialize(insertnow=true) super() if insertnow set_stamp(Time.now) end end
Get the timestamp's origin
result |
# File lib/xmpp4r/delay/x/delay.rb, line 76 def from if attributes['from'] JID.new(attributes['from']) else nil end end
Set the timestamp's origin
jid |
# File lib/xmpp4r/delay/x/delay.rb, line 87 def from=(jid) attributes['from'] = jid.nil? ? nil : jid.to_s end
Set the timestamp's origin (chaining-friendly)
# File lib/xmpp4r/delay/x/delay.rb, line 93 def set_from(jid) self.from = jid self end
Set the timestamp (chaining-friendly)
# File lib/xmpp4r/delay/x/delay.rb, line 68 def set_stamp(t) self.stamp = t self end
Get the timestamp
result |
|
# File lib/xmpp4r/delay/x/delay.rb, line 41 def stamp if attributes['stamp'] begin # Actually this should be Time.xmlschema, # but "unfortunately, the 'jabber:x:delay' namespace predates" JEP 0082 Time.parse(attributes['stamp']) rescue ArgumentError nil end else nil end end
Generated with the Darkfish Rdoc Generator 2.