Class Jabber::Delay::XDelay
In: lib/xmpp4r/delay/x/delay.rb
Parent: X
XMLStanza Message Presence Iq REXML::Element X IqQuery Error StreamHost IqSiFileRange IqSiFile StreamHostUsed IqSi IqFeature XRosterItem RosterItem XMUCUserItem XMUCUserInvite XDataField XDataReported XDataTitle XDataInstructions Feature Identity Item IqVcard Singleton IdGenerator Connection Client Component Comparable JID RuntimeError AuthenticationFailure ErrorException SOCKS5Error Stream SOCKS5Bytestreams SOCKS5BytestreamsTarget SOCKS5BytestreamsInitiator SOCKS5BytestreamsServerStreamHost TCPSocket SOCKS5Socket IqQuery IqQueryBytestreams IqQueryVersion IqQueryRoster IqQueryDiscoItems IqQueryDiscoInfo IBB IBBTarget IBBInitiator Responder SimpleResponder X XRoster XMUCUser XMUC XDelay XData MUCClient SimpleMUCClient Base DigestMD5 Plain FileSource StreamParser SOCKS5BytestreamsPeer SOCKS5BytestreamsServer IBBQueueItem Helper MUCBrowser Helper Helper lib/xmpp4r/authenticationfailure.rb lib/xmpp4r/idgenerator.rb lib/xmpp4r/connection.rb lib/xmpp4r/iq.rb lib/xmpp4r/jid.rb lib/xmpp4r/xmlstanza.rb lib/xmpp4r/errorexception.rb lib/xmpp4r/stream.rb lib/xmpp4r/client.rb lib/xmpp4r/x.rb lib/xmpp4r/streamparser.rb lib/xmpp4r/error.rb lib/xmpp4r/component.rb lib/xmpp4r/query.rb lib/xmpp4r/message.rb lib/xmpp4r/presence.rb lib/xmpp4r/bytestreams/helper/ibb/initiator.rb lib/xmpp4r/bytestreams/iq/si.rb lib/xmpp4r/bytestreams/iq/bytestreams.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb lib/xmpp4r/bytestreams/helper/ibb/base.rb lib/xmpp4r/bytestreams/helper/ibb/target.rb Bytestreams lib/xmpp4r/version/iq/version.rb lib/xmpp4r/version/helper/responder.rb lib/xmpp4r/version/helper/simpleresponder.rb Version lib/xmpp4r/feature_negotiation/iq/feature.rb FeatureNegotiation lib/xmpp4r/roster/helper/roster.rb lib/xmpp4r/roster/iq/roster.rb lib/xmpp4r/roster/x/roster.rb Roster lib/xmpp4r/muc/x/muc.rb lib/xmpp4r/muc/helper/mucclient.rb lib/xmpp4r/muc/x/mucuseritem.rb lib/xmpp4r/muc/helper/mucbrowser.rb lib/xmpp4r/muc/x/mucuserinvite.rb lib/xmpp4r/muc/helper/simplemucclient.rb MUC lib/xmpp4r/sasl.rb SASL lib/xmpp4r/bytestreams/helper/filetransfer.rb TransferSource FileTransfer lib/xmpp4r/delay/x/delay.rb Delay lib/xmpp4r/dataforms/x/data.rb Dataforms lib/xmpp4r/discovery/iq/discoinfo.rb lib/xmpp4r/discovery/iq/discoitems.rb Discovery lib/xmpp4r/vcard/helper/vcard.rb lib/xmpp4r/vcard/iq/vcard.rb Vcard Jabber Module: Jabber

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.

Methods

from   from=   new   set_from   set_stamp   stamp   stamp=  

Public Class methods

Initialize a new XDelay element

insertnow:[Boolean] Set the stamp to [Time::now]

[Source]

    # File lib/xmpp4r/delay/x/delay.rb, line 28
28:       def initialize(insertnow=true)
29:         super()
30:         add_namespace('jabber:x:delay')
31: 
32:         if insertnow
33:           set_stamp(Time.now)
34:         end
35:       end

Public Instance methods

Get the timestamp’s origin

result:[JID]

[Source]

    # File lib/xmpp4r/delay/x/delay.rb, line 75
75:       def from
76:         if attributes['from']
77:           JID::new(attributes['from'])
78:         else
79:           nil
80:         end
81:       end

Set the timestamp’s origin

jid:[JID]

[Source]

    # File lib/xmpp4r/delay/x/delay.rb, line 86
86:       def from=(jid)
87:         attributes['from'] = jid.nil? ? nil : jid.to_s
88:       end

Set the timestamp’s origin (chaining-friendly)

[Source]

    # 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)

[Source]

    # 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

[Source]

    # 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

Set the timestamp

t:[Time] or nil

[Source]

    # File lib/xmpp4r/delay/x/delay.rb, line 57
57:       def stamp=(t)
58:         if t.nil?
59:           attributes['stamp'] = nil
60:         else
61:           attributes['stamp'] = t.strftime("%Y%m%dT%H:%M:%S")
62:         end
63:       end

[Validate]