Class Jabber::Dataforms::XData
In: lib/xmpp4r/dataforms/x/data.rb
Parent: X
XMLStanza Message Presence Iq REXML::Element X IqQuery Error StreamHost IqSiFileRange IqSiFile StreamHostUsed IqSi XRosterItem RosterItem IqFeature XMUCUserItem XMUCUserInvite Feature Identity Item XDataField XDataReported XDataTitle XDataInstructions IqVcard Singleton IdGenerator Connection Client Component Comparable JID RuntimeError ErrorException AuthenticationFailure 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/streamparser.rb lib/xmpp4r/x.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/roster/helper/roster.rb lib/xmpp4r/roster/iq/roster.rb lib/xmpp4r/roster/x/roster.rb Roster lib/xmpp4r/feature_negotiation/iq/feature.rb FeatureNegotiation 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/delay/x/delay.rb Delay lib/xmpp4r/bytestreams/helper/filetransfer.rb TransferSource FileTransfer lib/xmpp4r/discovery/iq/discoinfo.rb lib/xmpp4r/discovery/iq/discoitems.rb Discovery lib/xmpp4r/dataforms/x/data.rb Dataforms lib/xmpp4r/vcard/helper/vcard.rb lib/xmpp4r/vcard/iq/vcard.rb Vcard Jabber Module: Jabber

Data Forms (JEP-0004) implementation

Methods

field   new   type   type=   typed_add  

Public Class methods

[Source]

    # File lib/xmpp4r/dataforms/x/data.rb, line 13
13:       def initialize(type=nil)
14:         super()
15:         add_namespace('jabber:x:data')
16:         self.type = type
17:       end

Public Instance methods

Search a field by it’s var-name

var:[String]
result:[XDataField] or [nil]

[Source]

    # File lib/xmpp4r/dataforms/x/data.rb, line 38
38:       def field(var)
39:         each_element { |xe|
40:           return xe if xe.kind_of?(XDataField) and xe.var == var
41:         }
42:         nil
43:       end

Type of this Data Form

result:* :cancel
  • :form
  • :result
  • :submit
  • nil

[Source]

    # File lib/xmpp4r/dataforms/x/data.rb, line 52
52:       def type
53:         case attributes['type']
54:           when 'cancel' then :cancel
55:           when 'form' then :form
56:           when 'result' then :result
57:           when 'submit' then :submit
58:           else nil
59:         end
60:       end

Set the type (see type)

[Source]

    # File lib/xmpp4r/dataforms/x/data.rb, line 64
64:       def type=(t)
65:         case t
66:           when :cancel then attributes['type'] = 'cancel'
67:           when :form then attributes['type'] = 'form'
68:           when :result then attributes['type'] = 'result'
69:           when :submit then attributes['type'] = 'submit'
70:           else attributes['type'] = nil
71:         end
72:       end

[Source]

    # File lib/xmpp4r/dataforms/x/data.rb, line 19
19:       def typed_add(xe)
20:         if xe.kind_of?(REXML::Element)
21:           case xe.name
22:             when 'instructions' then super XDataInstructions.new.import(xe)
23:             when 'title' then super XDataTitle.new.import(xe)
24:             when 'field' then super XDataField.new.import(xe)
25:             when 'reported' then super XDataReported.new.import(xe)
26:             #when 'item' then super XDataItem.new.import(xe)
27:             else super xe
28:           end
29:         else
30:           super xe
31:         end
32:       end

[Validate]