Home | Trees | Indices | Help |
---|
|
client.PlugIn --+ | Browser
WARNING! This class is for components only. It will not work in client mode! Standart xmpppy class that is ancestor of PlugIn and can be attached to your application. All processing will be performed in the handlers registered in the browser instance. You can register any number of handlers ensuring that for each node/jid combination only one (or none) handler registered. You can register static information or the fully-blown function that will calculate the answer dynamically. Example of static info (see JEP-0030, examples 13-14): # cl - your xmpppy connection instance. b=xmpp.browser.Browser() b.PlugIn(cl) items=[] item={} item['jid']='catalog.shakespeare.lit' item['node']='books' item['name']='Books by and about Shakespeare' items.append(item) item={} item['jid']='catalog.shakespeare.lit' item['node']='clothing' item['name']='Wear your literary taste with pride' items.append(item) item={} item['jid']='catalog.shakespeare.lit' item['node']='music' item['name']='Music from the time of Shakespeare' items.append(item) info={'ids':[], 'features':[]} b.setDiscoHandler({'items':items,'info':info}) items should be a list of item elements. every item element can have any of these four keys: 'jid', 'node', 'name', 'action' info should be a dicionary and must have keys 'ids' and 'features'. Both of them should be lists: ids is a list of dictionaries and features is a list of text strings. Example (see JEP-0030, examples 1-2) # cl - your xmpppy connection instance. b=xmpp.browser.Browser() b.PlugIn(cl) items=[] ids=[] ids.append({'category':'conference','type':'text','name':'Play-Specific Chatrooms'}) ids.append({'category':'directory','type':'chatroom','name':'Play-Specific Chatrooms'}) features=[NS_DISCO_INFO,NS_DISCO_ITEMS,NS_MUC,NS_REGISTER,NS_SEARCH,NS_TIME,NS_VERSION] info={'ids':ids,'features':features} # info['xdata']=xmpp.protocol.DataForm() # JEP-0128 b.setDiscoHandler({'items':[],'info':info})
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|
|
|
|
This is the main method that you will use in this class. It is used to register supplied DISCO handler (or dictionary with static info) as handler of some disco tree branch. If you do not specify the node this handler will be used for all queried nodes. If you do not specify the jid this handler will be used for all queried JIDs. Usage: cl.Browser.setDiscoHandler(someDict,node,jid) or cl.Browser.setDiscoHandler(someDISCOHandler,node,jid) where someDict={ 'items':[ {'jid':'jid1','action':'action1','node':'node1','name':'name1'}, {'jid':'jid2','action':'action2','node':'node2','name':'name2'}, {'jid':'jid3','node':'node3','name':'name3'}, {'jid':'jid4','node':'node4'} ], 'info' :{ 'ids':[ {'category':'category1','type':'type1','name':'name1'}, {'category':'category2','type':'type2','name':'name2'}, {'category':'category3','type':'type3','name':'name3'}, ], 'features':['feature1','feature2','feature3','feature4'], 'xdata':DataForm } } and/or def someDISCOHandler(session,request,TYR): # if TYR=='items': # returns items list of the same format as shown above # elif TYR=='info': # returns info dictionary of the same format as shown above # else: # this case is impossible for now. |
|
|
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Sat Dec 15 22:25:14 2007 | http://epydoc.sourceforge.net |