Esempio n. 1
0
    def handlesend(self, res, msg=None):
        """handlesend() -- deferred operation handler for send(). Do not call.
        """
        
        if (res == 'timeout'):
            raise sched.TimeoutException('rpc timed out')
        assert msg
        if (msg.getattr('type') != 'result'):
            # Error reply
            raise interface.parseerrorstanza(msg)
        
        qnod = msg.getchild('query')
        if (not qnod):
            raise interface.StanzaBadRequest(
                'rpc reply lacks <query>')
        if (qnod.getnamespace() != interface.NS_RPC):
            raise interface.StanzaBadRequest(
                'rpc reply in wrong namespace')

        methnod = qnod.getchild('methodResponse')
        if (not methnod):
            raise interface.StanzaBadRequest(
                'rpc reply lacks <methodResponse>')
            
        info = rpcdata.parseresponse(methnod)
        return info
Esempio n. 2
0
 def handlequeryitems(self, res, msg=None):
     """handlequeryitems() -- deferred operation handler for queryitems().
     Do not call.
     """
     
     if (res == 'timeout'):
         raise sched.TimeoutException('disco query timed out')
     assert msg
     if (msg.getattr('type') != 'result'):
         # Error reply
         raise interface.parseerrorstanza(msg)
     
     qnod = msg.getchild('query')
     if (not qnod):
         raise interface.StanzaBadRequest(
             'disco items reply lacks <query>')
     if (qnod.getnamespace() != interface.NS_DISCO_ITEMS):
         raise interface.StanzaBadRequest(
             'disco items reply in wrong namespace')
         
     items = discodata.parsediscoitems(qnod)
     return items
Esempio n. 3
0
    def handlesend(self, res, msg=None):
        """handlesend() -- deferred operation handler for send(). Do not call.
        """

        if (res == 'timeout'):
            raise sched.TimeoutException('rpc timed out')
        assert msg
        if (msg.getattr('type') != 'result'):
            # Error reply
            raise interface.parseerrorstanza(msg)

        qnod = msg.getchild('query')
        if (not qnod):
            raise interface.StanzaBadRequest('rpc reply lacks <query>')
        if (qnod.getnamespace() != interface.NS_RPC):
            raise interface.StanzaBadRequest('rpc reply in wrong namespace')

        methnod = qnod.getchild('methodResponse')
        if (not methnod):
            raise interface.StanzaBadRequest(
                'rpc reply lacks <methodResponse>')

        info = rpcdata.parseresponse(methnod)
        return info