Ignore:
Timestamp:
Apr 15, 2008, 7:32:14 PM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@47
Message:

Add client support for getting items from a node.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/pubsub.py

    r15 r17  
    231231        return item
    232232
     233class Items(PubSubRequest):
     234    verb = 'items'
     235    method = 'get'
     236
     237    def __init__(self, xs, node):
     238        PubSubRequest.__init__(self, xs)
     239        self.command["node"] = node
    233240
    234241class PubSubClient(XMPPHandler):
     
    334341        return request.send(service)
    335342
     343    def items(self, service, nodeIdentifier):
     344        def cb(iq):
     345            items = []
     346            for element in iq.pubsub.items.elements():
     347                if element.uri == NS_PUBSUB and element.name == 'item':
     348                    items.append(element)
     349            return items
     350
     351        request = Items(self.xmlstream, nodeIdentifier)
     352        return request.send(service).addCallback(cb)
    336353
    337354class PubSubService(XMPPHandler, IQHandlerMixin):
Note: See TracChangeset for help on using the changeset viewer.