Class Jabber::Iq
In: lib/xmpp4r/iq.rb
Parent: XMPPStanza
XMPPElement ErrorResponse XMPPStanza X IqQuery Message Presence Iq JabberError ComponentAuthenticationFailure ArgumentError SOCKS5Error ServerError NoNameXmlnsRegistered ClientAuthenticationFailure Connection Client Component Client Singleton IdGenerator Comparable JID StandardError REXML::Element Stream IqQuery IqQueryRoster IqQueryBytestreams IqQueryVersion IqQueryRPC IqQueryMUCOwner IqQueryMUCAdmin IqQueryDiscoItems IqQueryDiscoInfo XRosterItem RosterXItem XMPPElement RosterItem StreamHost IqSiFile IqSiFileRange IqSi StreamHostUsed IqFeature C Body HTML UserItem XMUCUserInvite Configuration Items Item IqPubSub Publish Event IqPubSubOwner Subscription Unsubscribe Tune XDataField XDataReported XDataTitle XDataInstructions Feature Item Identity IqVcard XRoster RosterX X XMUC XMUCUser XDelay XData Iq IqCommand SOCKS5Bytestreams SOCKS5BytestreamsTarget SOCKS5BytestreamsInitiator SOCKS5BytestreamsServerStreamHost TCPSocket SOCKS5Socket IBB IBBTarget IBBInitiator Responder SimpleResponder XMLRPC::ParserWriterChooseMixin Client Server XMLRPC::ParseContentType XMLRPC::BasicServer MUCClient SimpleMUCClient MUC::UserItem XMUCUserItem IqQueryMUCAdminItem XParent SubscriptionConfig NodeConfig OwnerNodeConfig EventItems EventItem ServiceHelper NodeHelper Base Anonymous DigestMD5 Plain PubSub::ServiceHelper Helper FileSource Base Bot CallbackList Callback StreamParser Semaphore Helper Responder SOCKS5BytestreamsPeer SOCKS5BytestreamsServer IBBQueueItem Helper MUCBrowser NodeBrowser Helper Responder Helper lib/xmpp4r/message.rb lib/xmpp4r/connection.rb lib/xmpp4r/xmppstanza.rb lib/xmpp4r/iq.rb lib/xmpp4r/callbacks.rb lib/xmpp4r/idgenerator.rb lib/xmpp4r/stream.rb lib/xmpp4r/client.rb lib/xmpp4r/jid.rb lib/xmpp4r/x.rb lib/xmpp4r/streamparser.rb lib/xmpp4r/semaphore.rb lib/xmpp4r/errors.rb lib/xmpp4r/component.rb lib/xmpp4r/presence.rb lib/xmpp4r/xmppelement.rb lib/xmpp4r/query.rb lib/xmpp4r/roster/x/roster.rb lib/xmpp4r/roster/helper/roster.rb lib/xmpp4r/roster/iq/roster.rb Roster lib/xmpp4r/command/iq/command.rb lib/xmpp4r/command/helper/responder.rb Command XParent lib/xmpp4r/bytestreams/iq/si.rb lib/xmpp4r/bytestreams/helper/ibb/initiator.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb lib/xmpp4r/bytestreams/iq/bytestreams.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb lib/xmpp4r/bytestreams/helper/ibb/target.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb lib/xmpp4r/bytestreams/helper/ibb/base.rb Bytestreams lib/xmpp4r/version/helper/responder.rb lib/xmpp4r/version/helper/simpleresponder.rb lib/xmpp4r/version/iq/version.rb Version lib/xmpp4r/feature_negotiation/iq/feature.rb FeatureNegotiation lib/xmpp4r/caps/helper/helper.rb lib/xmpp4r/caps/c.rb Caps lib/xmpp4r/rpc/helper/server.rb lib/xmpp4r/rpc/helper/client.rb lib/xmpp4r/rpc/iq/rpc.rb RPC lib/xmpp4r/xhtml/html.rb XHTML lib/xmpp4r/muc/iq/mucadminitem.rb lib/xmpp4r/muc/x/muc.rb lib/xmpp4r/muc/item.rb lib/xmpp4r/muc/helper/simplemucclient.rb lib/xmpp4r/muc/iq/mucadmin.rb lib/xmpp4r/muc/helper/mucbrowser.rb lib/xmpp4r/muc/x/mucuseritem.rb lib/xmpp4r/muc/x/mucuserinvite.rb lib/xmpp4r/muc/iq/mucowner.rb lib/xmpp4r/muc/helper/mucclient.rb MUC lib/xmpp4r/delay/x/delay.rb Delay lib/xmpp4r/pubsub/children/item.rb lib/xmpp4r/pubsub/children/configuration.rb lib/xmpp4r/pubsub/children/subscription.rb lib/xmpp4r/pubsub/helper/servicehelper.rb lib/xmpp4r/pubsub/children/unsubscribe.rb lib/xmpp4r/pubsub/children/publish.rb lib/xmpp4r/pubsub/children/event.rb lib/xmpp4r/pubsub/iq/pubsub.rb lib/xmpp4r/pubsub/helper/nodebrowser.rb lib/xmpp4r/pubsub/helper/nodehelper.rb lib/xmpp4r/pubsub/children/items.rb lib/xmpp4r/pubsub/children/subscription_config.rb lib/xmpp4r/pubsub/children/node_config.rb PubSub lib/xmpp4r/sasl.rb SASL lib/xmpp4r/httpbinding/client.rb HTTPBinding lib/xmpp4r/tune/helper/helper.rb lib/xmpp4r/tune/tune.rb UserTune lib/xmpp4r/dataforms/x/data.rb Dataforms lib/xmpp4r/bytestreams/helper/filetransfer.rb TransferSource FileTransfer lib/xmpp4r/discovery/iq/discoinfo.rb lib/xmpp4r/discovery/helper/responder.rb lib/xmpp4r/discovery/iq/discoitems.rb Discovery lib/xmpp4r/framework/base.rb lib/xmpp4r/framework/bot.rb Framework lib/xmpp4r/vcard/helper/vcard.rb lib/xmpp4r/vcard/iq/vcard.rb Vcard Jabber dot/m_99_0.png

IQ: Information/Query (see RFC3920 - 9.2.3

A class used to build/parse IQ requests/responses

Methods

Public Class methods

Build a new <iq/> stanza

type:[Symbol] or nil, see Iq#type
to:[JID] Recipient

[Source]

    # File lib/xmpp4r/iq.rb, line 28
28:     def initialize(type = nil, to = nil)
29:       super()
30: 
31:       if not to.nil?
32:         set_to(to)
33:       end
34:       if not type.nil?
35:         set_type(type)
36:       end
37:     end

Create a new jabber:iq:auth set Stanza.

[Source]

     # File lib/xmpp4r/iq.rb, line 140
140:     def Iq.new_authset(jid, password)
141:       iq = Iq.new(:set)
142:       query = IqQuery.new
143:       query.add_namespace('jabber:iq:auth')
144:       query.add(REXML::Element.new('username').add_text(jid.node))
145:       query.add(REXML::Element.new('password').add_text(password))
146:       query.add(REXML::Element.new('resource').add_text(jid.resource)) if not jid.resource.nil?
147:       iq.add(query)
148:       iq
149:     end

Create a new jabber:iq:auth set Stanza for Digest authentication

[Source]

     # File lib/xmpp4r/iq.rb, line 153
153:     def Iq.new_authset_digest(jid, session_id, password)
154:       iq = Iq.new(:set)
155:       query = IqQuery.new
156:       query.add_namespace('jabber:iq:auth')
157:       query.add(REXML::Element.new('username').add_text(jid.node))
158:       query.add(REXML::Element.new('digest').add_text(Digest::SHA1.hexdigest(session_id + password)))
159:       query.add(REXML::Element.new('resource').add_text(jid.resource)) if not jid.resource.nil?
160:       iq.add(query)
161:       iq
162:     end

Create a new jabber:iq:roster get Stanza.

[Source]

     # File lib/xmpp4r/iq.rb, line 203
203:     def Iq.new_browseget
204:       iq = Iq.new(:get)
205:       query = IqQuery.new
206:       query.add_namespace('jabber:iq:browse')
207:       iq.add(query)
208:       iq
209:     end

Create a new Iq stanza with an unspecified query child (<query/> has no namespace)

[Source]

     # File lib/xmpp4r/iq.rb, line 131
131:     def Iq.new_query(type = nil, to = nil)
132:       iq = Iq.new(type, to)
133:       query = IqQuery.new
134:       iq.add(query)
135:       iq
136:     end

Create a new jabber:iq:register set stanza for service/server registration

username:[String] (Element will be ommited if unset)
password:[String] (Element will be ommited if unset)

[Source]

     # File lib/xmpp4r/iq.rb, line 168
168:     def Iq.new_register(username=nil, password=nil)
169:       iq = Iq.new(:set)
170:       query = IqQuery.new
171:       query.add_namespace('jabber:iq:register')
172:       query.add(REXML::Element.new('username').add_text(username)) if username
173:       query.add(REXML::Element.new('password').add_text(password)) if password
174:       iq.add(query)
175:       iq
176:     end

Create a new jabber:iq:register get stanza for retrieval of accepted registration information

[Source]

     # File lib/xmpp4r/iq.rb, line 181
181:     def Iq.new_registerget
182:       iq = Iq.new(:get)
183:       query = IqQuery.new
184:       query.add_namespace('jabber:iq:register')
185:       iq.add(query)
186:       iq
187:     end

Create a new jabber:iq:roster get Stanza.

IqQueryRoster is unused here because possibly not require‘d

[Source]

     # File lib/xmpp4r/iq.rb, line 193
193:     def Iq.new_rosterget
194:       iq = Iq.new(:get)
195:       query = IqQuery.new
196:       query.add_namespace('jabber:iq:roster')
197:       iq.add(query)
198:       iq
199:     end

Create a new jabber:iq:roster set Stanza.

[Source]

     # File lib/xmpp4r/iq.rb, line 213
213:     def Iq.new_rosterset
214:       iq = Iq.new(:set)
215:       query = IqQuery.new
216:       query.add_namespace('jabber:iq:roster')
217:       iq.add(query)
218:       iq
219:     end

Public Instance methods

Returns the iq‘s <command/> child, or nil

resulte:[IqCommand]

[Source]

     # File lib/xmpp4r/iq.rb, line 124
124:     def command
125:       first_element("command")
126:     end

Returns the iq‘s <pubsub/> child, or nil

result:[IqVcard]

[Source]

     # File lib/xmpp4r/iq.rb, line 117
117:     def pubsub
118:       first_element('pubsub')
119:     end

Returns the iq‘s query child, or nil

result:[IqQuery]

[Source]

    # File lib/xmpp4r/iq.rb, line 82
82:     def query
83:       first_element('query')
84:     end

Delete old elements named newquery.name

newquery:[REXML::Element] will be added

[Source]

    # File lib/xmpp4r/iq.rb, line 90
90:     def query=(newquery)
91:       delete_elements(newquery.name)
92:       add(newquery)
93:     end

Returns the iq‘s query‘s namespace, or nil

result:[String]

[Source]

     # File lib/xmpp4r/iq.rb, line 98
 98:     def queryns
 99:       e = first_element('query')
100:       if e
101:         return e.namespace
102:       else
103:         return nil
104:       end
105:     end

Set the type of the Iq stanza (chaining-friendly)

v:[Symbol] or nil

[Source]

    # File lib/xmpp4r/iq.rb, line 74
74:     def set_type(v)
75:       self.type = v
76:       self
77:     end

Get the type of the Iq stanza

The following values are allowed:

  • :get
  • :set
  • :result
  • :error
result:[Symbol] or nil

[Source]

    # File lib/xmpp4r/iq.rb, line 48
48:     def type
49:       case super
50:         when 'get' then :get
51:         when 'set' then :set
52:         when 'result' then :result
53:         when 'error' then :error
54:         else nil
55:       end
56:     end

Set the type of the Iq stanza (see Iq#type)

v:[Symbol] or nil

[Source]

    # File lib/xmpp4r/iq.rb, line 61
61:     def type=(v)
62:       case v
63:         when :get then super('get')
64:         when :set then super('set')
65:         when :result then super('result')
66:         when :error then super('error')
67:         else super(nil)
68:       end
69:     end

Returns the iq‘s <vCard/> child, or nil

result:[IqVcard]

[Source]

     # File lib/xmpp4r/iq.rb, line 110
110:     def vcard
111:       first_element('vCard')
112:     end

[Validate]