How to use the pantalaimon.thread_messages.DeviceUnverifyMessage function in pantalaimon

To help you get started, we’ve selected a few pantalaimon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def receive_message(self, message):
        client = self.pan_clients.get(message.pan_user)

        if isinstance(
            message,
            (
                DeviceVerifyMessage,
                DeviceUnverifyMessage,
                StartSasMessage,
                DeviceBlacklistMessage,
                DeviceUnblacklistMessage,
            ),
        ):

            device = client.device_store[message.user_id].get(message.device_id, None)

            if not device:
                msg = (
                    f"No device found for {message.user_id} and " f"{message.device_id}"
                )
                await self.send_response(
                    message.message_id, message.pan_user, "m.unknown_device", msg
                )
                logger.info(msg)
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def receive_message(self, message):
        client = self.pan_clients.get(message.pan_user)

        if isinstance(
            message,
            (
                DeviceVerifyMessage,
                DeviceUnverifyMessage,
                StartSasMessage,
                DeviceBlacklistMessage,
                DeviceUnblacklistMessage,
            ),
        ):

            device = client.device_store[message.user_id].get(message.device_id, None)

            if not device:
                msg = (
                    f"No device found for {message.user_id} and " f"{message.device_id}"
                )
                await self.send_response(
                    message.message_id, message.pan_user, "m.unknown_device", msg
                )
                logger.info(msg)
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
device = client.device_store[message.user_id].get(message.device_id, None)

            if not device:
                msg = (
                    f"No device found for {message.user_id} and " f"{message.device_id}"
                )
                await self.send_response(
                    message.message_id, message.pan_user, "m.unknown_device", msg
                )
                logger.info(msg)
                return

            if isinstance(message, DeviceVerifyMessage):
                await self._verify_device(message.message_id, client, device)
            elif isinstance(message, DeviceUnverifyMessage):
                await self._unverify_device(message.message_id, client, device)
            elif isinstance(message, DeviceBlacklistMessage):
                await self._blacklist_device(message.message_id, client, device)
            elif isinstance(message, DeviceUnblacklistMessage):
                await self._unblacklist_device(message.message_id, client, device)
            elif isinstance(message, StartSasMessage):
                await client.start_sas(message, device)

        elif isinstance(message, SasMessage):
            if isinstance(message, AcceptSasMessage):
                await client.accept_sas(message)
            elif isinstance(message, ConfirmSasMessage):
                await client.confirm_sas(message)
            elif isinstance(message, CancelSasMessage):
                await client.cancel_sas(message)
github matrix-org / pantalaimon / pantalaimon / ui.py View on Github external
def Unverify(self, pan_user, user_id, device_id):
            message = DeviceUnverifyMessage(
                self.message_id, pan_user, user_id, device_id
            )
            self.queue.put(message)
            return message.message_id
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
device = client.device_store[message.user_id].get(message.device_id, None)

            if not device:
                msg = (
                    f"No device found for {message.user_id} and " f"{message.device_id}"
                )
                await self.send_response(
                    message.message_id, message.pan_user, "m.unknown_device", msg
                )
                logger.info(msg)
                return

            if isinstance(message, DeviceVerifyMessage):
                await self._verify_device(message.message_id, client, device)
            elif isinstance(message, DeviceUnverifyMessage):
                await self._unverify_device(message.message_id, client, device)
            elif isinstance(message, DeviceBlacklistMessage):
                await self._blacklist_device(message.message_id, client, device)
            elif isinstance(message, DeviceUnblacklistMessage):
                await self._unblacklist_device(message.message_id, client, device)
            elif isinstance(message, StartSasMessage):
                await client.start_sas(message, device)

        elif isinstance(message, SasMessage):
            if isinstance(message, AcceptSasMessage):
                await client.accept_sas(message)
            elif isinstance(message, ConfirmSasMessage):
                await client.confirm_sas(message)
            elif isinstance(message, CancelSasMessage):
                await client.cancel_sas(message)