Exemplo n.º 1
0
    def removeSubscription(self, subscriber):
        try:
            del self._subscriptions[subscriber.full()]
        except KeyError:
            return defer.fail(error.NotSubscribed())

        return defer.succeed(None)
Exemplo n.º 2
0
        def interaction(cursor):
            cursor.execute(
                """DELETE FROM callbacks
                              WHERE service=%s and node=%s and uri=%s""",
                (service.full(), nodeIdentifier, callback))

            if cursor.rowcount != 1:
                raise error.NotSubscribed()

            last = not self._countCallbacks(cursor, service, nodeIdentifier)
            return last
Exemplo n.º 3
0
    def removeCallback(self, service, nodeIdentifier, callback):
        try:
            callbacks = self.callbacks[service, nodeIdentifier]
            callbacks.remove(callback)
        except KeyError:
            return defer.fail(error.NotSubscribed())
        else:
            if not callbacks:
                del self.callbacks[service, nodeIdentifier]

            return defer.succeed(not callbacks)
Exemplo n.º 4
0
    def _removeSubscription(self, cursor, subscriber):
        self._checkNodeExists(cursor)

        userhost = subscriber.userhost()
        resource = subscriber.resource or ''

        cursor.execute(
            """DELETE FROM subscriptions WHERE
                          node_id=(SELECT node_id FROM nodes
                                                  WHERE node=%s) AND
                          entity_id=(SELECT entity_id FROM entities
                                                      WHERE jid=%s) AND
                          resource=%s""",
            (self.nodeIdentifier, userhost, resource))
        if cursor.rowcount != 1:
            raise error.NotSubscribed()

        return None
Exemplo n.º 5
0
 def unsubscribe(self, nodeIdentifier, subscriber, requestor):
     return defer.fail(error.NotSubscribed())