Changeset 133:2ea562934152 for wokkel


Ignore:
Timestamp:
Oct 23, 2009, 9:07:21 PM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
wokkel-muc-client-support-24
Parents:
132:1b19c49d30c2 (diff), 73:b0340948d17f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge in trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/disco.py

    r130 r133  
    1212
    1313from twisted.internet import defer
    14 from twisted.words.protocols.jabber import error, jid, xmlstream
     14from twisted.words.protocols.jabber import error, jid
    1515from twisted.words.xish import domish
    1616
    1717from wokkel import data_form
     18from wokkel.compat import IQ
    1819from wokkel.iwokkel import IDisco
    1920from wokkel.subprotocols import IQHandlerMixin, XMPPHandler
     
    346347
    347348
    348 class _DiscoRequest(xmlstream.IQ):
     349class _DiscoRequest(IQ):
    349350    """
    350351    Element representing an XMPP service discovery request.
     
    362363        @type nodeIdentifier: C{unicode}
    363364        """
    364         xmlstream.IQ.__init__(self, xs, "get")
     365        IQ.__init__(self, xs, "get")
    365366        query = self.addElement((namespace, 'query'))
    366367        if nodeIdentifier:
     
    374375    """
    375376
    376     def requestInfo(self, entity, nodeIdentifier=''):
     377    def requestInfo(self, entity, nodeIdentifier='', sender=None):
    377378        """
    378379        Request information discovery from a node.
     
    380381        @param entity: Entity to send the request to.
    381382        @type entity: L{jid.JID}
     383
    382384        @param nodeIdentifier: Optional node to request info from.
    383385        @type nodeIdentifier: C{unicode}
     386
     387        @param sender: Optional sender address.
     388        @type sender: L{jid.JID}
    384389        """
    385390
    386391        request = _DiscoRequest(self.xmlstream, NS_DISCO_INFO, nodeIdentifier)
     392        if sender is not None:
     393            request['from'] = unicode(sender)
    387394
    388395        d = request.send(entity.full())
     
    391398
    392399
    393     def requestItems(self, entity, nodeIdentifier=''):
     400    def requestItems(self, entity, nodeIdentifier='', sender=None):
    394401        """
    395402        Request items discovery from a node.
     
    397404        @param entity: Entity to send the request to.
    398405        @type entity: L{jid.JID}
     406
    399407        @param nodeIdentifier: Optional node to request info from.
    400408        @type nodeIdentifier: C{unicode}
     409
     410        @param sender: Optional sender address.
     411        @type sender: L{jid.JID}
    401412        """
    402413
    403414        request = _DiscoRequest(self.xmlstream, NS_DISCO_ITEMS, nodeIdentifier)
     415        if sender is not None:
     416            request['from'] = unicode(sender)
    404417
    405418        d = request.send(entity.full())
     
    526539        @rtype: L{defer.Deferred}
    527540        """
    528         dl = [handler.getDiscoInfo(requestor, target, nodeIdentifier)
     541        dl = [defer.maybeDeferred(handler.getDiscoInfo, requestor, target,
     542                                                        nodeIdentifier)
    529543              for handler in self.parent
    530544              if IDisco.providedBy(handler)]
     
    548562        @rtype: L{defer.Deferred}
    549563        """
    550         dl = [handler.getDiscoItems(requestor, target, nodeIdentifier)
     564        dl = [defer.maybeDeferred(handler.getDiscoItems, requestor, target,
     565                                                         nodeIdentifier)
    551566              for handler in self.parent
    552567              if IDisco.providedBy(handler)]
Note: See TracChangeset for help on using the changeset viewer.