Class Jabber::PubSub::NodeBrowser
In: lib/xmpp4r/pubsub/helper/nodebrowser.rb
Parent: Object
Message Presence XMPPStanza Iq Singleton IdGenerator XMPPElement X IqQuery Error Connection Client Component Client Comparable JID RuntimeError AuthenticationFailure ErrorException NoNameXmlnsRegistered SOCKS5Error REXML::Element Stream SOCKS5Bytestreams SOCKS5BytestreamsTarget SOCKS5BytestreamsInitiator XMPPElement StreamHost IqSiFileRange IqSiFile StreamHostUsed IqSi XRosterItem RosterItem IqFeature XMUCUserItem XMUCUserInvite IqPubSub Items Subscription IqPubSubOwner Item Event Feature Item Identity XDataField XDataReported XDataTitle XDataInstructions IqVcard SOCKS5BytestreamsServerStreamHost TCPSocket SOCKS5Socket IqQuery IqQueryBytestreams IqQueryVersion IqQueryRoster IqQueryMUCOwner IqQueryRPC IqQueryDiscoItems IqQueryDiscoInfo IBB IBBTarget IBBInitiator Responder SimpleResponder Iq IqCommand RosterXItem XRoster RosterX X XMUCUser XMUC XDelay XData XParent MUCClient SimpleMUCClient XMLRPC::ParserWriterChooseMixin Client Server XMLRPC::ParseContentType XMLRPC::BasicServer Base DigestMD5 Plain ServiceHelper NodeHelper FileSource CallbackList Callback Semaphore StreamParser SOCKS5BytestreamsPeer SOCKS5BytestreamsServer IBBQueueItem Responder Helper MUCBrowser NodeBrowser Helper Helper lib/xmpp4r/authenticationfailure.rb lib/xmpp4r/xmppstanza.rb lib/xmpp4r/callbacks.rb lib/xmpp4r/idgenerator.rb lib/xmpp4r/connection.rb lib/xmpp4r/iq.rb lib/xmpp4r/jid.rb lib/xmpp4r/errorexception.rb lib/xmpp4r/client.rb lib/xmpp4r/stream.rb lib/xmpp4r/semaphore.rb lib/xmpp4r/streamparser.rb lib/xmpp4r/x.rb lib/xmpp4r/error.rb lib/xmpp4r/component.rb lib/xmpp4r/query.rb lib/xmpp4r/xmppelement.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/server.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.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 XParent lib/xmpp4r/version/iq/version.rb lib/xmpp4r/version/helper/responder.rb lib/xmpp4r/version/helper/simpleresponder.rb Version lib/xmpp4r/command/iq/command.rb lib/xmpp4r/command/helper/responder.rb Command 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/iq/mucowner.rb lib/xmpp4r/muc/helper/simplemucclient.rb MUC lib/xmpp4r/rpc/helper/server.rb lib/xmpp4r/rpc/helper/client.rb lib/xmpp4r/rpc/iq/rpc.rb RPC lib/xmpp4r/sasl.rb SASL lib/xmpp4r/delay/x/delay.rb Delay lib/xmpp4r/pubsub/stanzas/subscription.rb lib/xmpp4r/pubsub/helper/servicehelper.rb lib/xmpp4r/pubsub/stanzas/item.rb lib/xmpp4r/pubsub/helper/nodehelper.rb lib/xmpp4r/pubsub/iq/pubsub.rb lib/xmpp4r/pubsub/stanzas/event.rb lib/xmpp4r/pubsub/helper/nodebrowser.rb lib/xmpp4r/pubsub/stanzas/items.rb PubSub lib/xmpp4r/httpbinding/client.rb HTTPBinding 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 dot/m_80_0.png

Methods

category   get_info   items   new   nodes   nodes_names   type  

External Aliases

get_info -> get_metadata
  this is only for a xep <-> nodebrowser.rb understanding

Public Class methods

Initialize a new NodeBrowser new(stream,pubsubservice)

stream:[Jabber::Stream]

[Source]

    # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 14
14:       def initialize(stream)
15:         @stream = stream
16:       end

Public Instance methods

get category of node

jid:[Jabber::JID]
node:[String]

[Source]

     # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 167
167:       def category(jid,node)
168:         info = get_info(jid,node)
169:         return info['category']
170:       end

[Source]

     # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 116
116:       def get_info(jid,node)
117:         iq = Iq.new(:get,jid)
118:         iq.from = @stream.jid
119:         discoinfo = Discovery::IqQueryDiscoInfo.new
120:         discoinfo.node = node
121:         iq.add(discoinfo)
122:         info = {}
123:         @stream.send_with_id(iq) { |answer|
124:           if answer.type == :result
125:             
126:             identity = answer.query.identity
127:             info['type'] = identity.type
128:             info['category'] = identity.category
129:             
130:             info['features'] = answer.query.features
131:             
132: # i think its not needed - if you think so then delete it           
133: #           answer.query.each_element('identity') { |identity|
134: #             info['type'] = identity.type
135: #             info['category'] = identity.category
136: #           }
137: #           
138: #           features = []
139: #           answer.query.each_element('feature') { |feature|
140: #            features.push(feature)
141: #           }
142: #           info['features'] = features
143: #           
144:             answer.query.each_element('x') { |x|
145:               info['nodeinformation'] = x 
146:             }
147:           end
148:         }
149:         return info
150:       end

Retrive the items from a node Throws an ErrorExeption when reciving <iq type=‘error’/>

jid:[Jabber::JID] Target entity (set only domain!)
node:[String]
return:[Array] of [Hash] with keys ‘name’ => [String] and ‘jid’ => [Jabber::JID]

[Source]

     # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 82
 82:       def items(jid,node)
 83:         iq = Iq.new(:get,jid)
 84:         iq.from = @stream.jid
 85:         discoitems = Discovery::IqQueryDiscoItems.new
 86:         discoitems.node = node
 87:         iq.add(discoitems)
 88:         items = []
 89:         err = nil
 90:         @stream.send_with_id(iq) { |answer|
 91:           if answer.type == :result
 92:             answer.query.each_element('item') { |item|
 93:               items.push( {'jid' => item.jid,'name' => item.iname } )
 94:             }
 95:             true
 96:           elsif answer.type == :error
 97:             err = answer.error
 98:             true
 99:           else
100:             false
101:           end
102:         }
103:         return items
104:       end

Retrive the nodes Throws an ErrorException when receiving <iq type=‘error’/>

jid:[JID] Target entity (set only domain!)
return:[Array] of [String] or [nil]

[Source]

    # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 24
24:       def nodes(jid)
25:         iq = Iq.new(:get,jid)
26:         iq.from = @stream.jid
27:         iq.add(Discovery::IqQueryDiscoItems.new)
28:         nodes = []
29:         err = nil
30:         @stream.send_with_id(iq) { |answer|
31:           if answer.type == :result
32:             answer.query.each_element('item') { |item|
33:               nodes.push(item.node)
34:             }
35:             true
36:           elsif answer.type == :error
37:             err = answer.error
38:             true
39:           else
40:             false
41:           end
42:         }
43:         return nodes
44:       end

Retrive the nodes with names Throws an ErrorExeption when reciving <iq type=‘error’/>

jid:[Jabber::JID] Target entity (set only domain!)
return:[Array] of [Hash] with keys ‘node’ => [String] and ‘name’ => [String] or [nil]

[Source]

    # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 52
52:       def nodes_names(jid)
53:         iq = Iq.new(:get,jid)
54:         iq.from = @stream.jid
55:         iq.add(Discovery::IqQueryDiscoItems.new)
56:         nodes = []
57:         err = nil
58:         @stream.send_with_id(iq) { |answer|
59:           if answer.type == :result
60:             answer.query.each_element('item') { |item|
61:               nodes.push( {'node' => item.node,'name' => item.iname } )
62:             }
63:             true
64:           elsif answer.type == :error
65:             err = answer.error
66:             true
67:           else
68:             false
69:           end
70:         }
71:         return nodes
72:       end

get type of node

jid:[Jabber::JID]
node:[String]

[Source]

     # File lib/xmpp4r/pubsub/helper/nodebrowser.rb, line 157
157:       def type(jid,node)
158:         info = get_info(jid,node)
159:         return info['type']
160:       end

[Validate]