Beispiel #1
0
    def deferreditemswrapper(self, tup, jidstr, id):
        """deferreditemswrapper(tup, jidstr, id) -- callback for deferred
        handlers.

        This is used by handlegetitems(), for the case where a disco handler
        wants to undertake a deferral operation. You should not call it,
        or even try to understand it.
        """

        items = sched.Deferred.extract(tup)
        if (not isinstance(items, DiscoItems)):
            raise TypeError('items must be or return a DiscoItems')

        msg = interface.Node('iq',
            attrs={ 'to':jidstr, 'type':'result', 'id':id })
        qnod = discodata.makediscoitems(items)
        msg.addchild(qnod)

        self.agent.send(msg)
Beispiel #2
0
            else:
                raise interface.StanzaItemNotFound('items for node "%s" do not exist' % node)

        items = self.items[node]
        if (not isinstance(items, DiscoItems)):
            try:
                items = items()
            except sched.Deferred, ex:
                ex.addcontext(self.deferreditemswrapper, jidstr, id)
                raise
            if (not isinstance(items, DiscoItems)):
                raise TypeError('items must be or return a DiscoItems')
        
        msg = interface.Node('iq',
            attrs={ 'to':jidstr, 'type':'result', 'id':id })
        qnod = discodata.makediscoitems(items)
        msg.addchild(qnod)

        self.agent.send(msg)
        raise interface.StanzaHandled

    def deferreditemswrapper(self, tup, jidstr, id):
        """deferreditemswrapper(tup, jidstr, id) -- callback for deferred
        handlers.

        This is used by handlegetitems(), for the case where a disco handler
        wants to undertake a deferral operation. You should not call it,
        or even try to understand it.
        """

        items = sched.Deferred.extract(tup)