How to use the pantalaimon.log.logger.info 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 decrypt_loop(client, body):
            while True:
                try:
                    logger.info("Trying to decrypt sync")
                    return decryption_method(body, ignore_failures=False)
                except EncryptionError:
                    logger.info("Error decrypting sync, waiting for next pan " "sync")
                    await client.synced.wait(),
                    logger.info("Pan synced, retrying decryption.")
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def decrypt_loop(client, body):
            while True:
                try:
                    logger.info("Trying to decrypt sync")
                    return decryption_method(body, ignore_failures=False)
                except EncryptionError:
                    logger.info("Error decrypting sync, waiting for next pan " "sync")
                    await client.synced.wait(),
                    logger.info("Pan synced, retrying decryption.")

        try:
            return await asyncio.wait_for(
                decrypt_loop(client, body), timeout=self.decryption_timeout
            )
        except asyncio.TimeoutError:
            logger.info("Decryption attempt timed out, decrypting with " "failures")
            return decryption_method(body, ignore_failures=True)
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def decrypt_loop(client, body):
            while True:
                try:
                    logger.info("Trying to decrypt sync")
                    return decryption_method(body, ignore_failures=False)
                except EncryptionError:
                    logger.info("Error decrypting sync, waiting for next pan " "sync")
                    await client.synced.wait(),
                    logger.info("Pan synced, retrying decryption.")
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
logger.info(info_msg)
                await self.send_response(
                    message.message_id, client.user_id, "m.ok", info_msg
                )

        elif isinstance(message, ImportKeysMessage):
            path = os.path.abspath(os.path.expanduser(message.file_path))
            logger.info(f"Importing keys from {path}")

            try:
                await client.import_keys(path, message.passphrase)
            except (OSError, EncryptionError) as e:
                info_msg = (
                    f"Error importing keys for {client.user_id} " f"from {path} {e}"
                )
                logger.info(info_msg)
                await self.send_response(
                    message.message_id, client.user_id, "m.os_error", str(e)
                )
            else:
                info_msg = (
                    f"Succesfully imported keys for {client.user_id} " f"from {path}"
                )
                logger.info(info_msg)
                await self.send_response(
                    message.message_id, client.user_id, "m.ok", info_msg
                )

        elif isinstance(message, UnverifiedResponse):
            client = self.pan_clients[message.pan_user]

            if message.room_id not in client.send_decision_queues:
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
token = keyring.get_password(
                        "pantalaimon", f"{user_id}-{device_id}-token"
                    )
                except RuntimeError as e:
                    logger.error(e)
            else:
                token = self.store.load_access_token(user_id, device_id)

            if not token:
                logger.warn(
                    f"Not restoring client for {user_id} {device_id}, "
                    f"missing access token."
                )
                continue

            logger.info(f"Restoring client for {user_id} {device_id}")

            pan_client = PanClient(
                self.name,
                self.store,
                self.conf,
                self.homeserver_url,
                self.send_queue,
                user_id,
                device_id,
                store_path=self.data_dir,
                ssl=self.ssl,
                proxy=self.proxy,
                store_class=self.client_store_class
            )
            pan_client.user_id = user_id
            pan_client.access_token = token
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def _unverify_device(self, message_id, client, device):
        ret = client.unverify_device(device)

        if ret:
            msg = (
                f"Device {device.id} of user "
                f"{device.user_id} succesfully unverified."
            )
            await client.send_update_device(device)
        else:
            msg = f"Device {device.id} of user " f"{device.user_id} already unverified."

        logger.info(msg)
        await self.send_response(message_id, client.user_id, "m.ok", msg)
github matrix-org / pantalaimon / pantalaimon / client.py View on Github external
def decrypt_sync_body(self, body, ignore_failures=True):
        # type: (Dict[Any, Any], bool) -> Dict[Any, Any]
        """Go through a json sync response and decrypt megolm encrypted events.

        Args:
            body (Dict[Any, Any]): The dictionary of a Sync response.

        Returns the json response with decrypted events.
        """
        logger.info("Decrypting sync")

        self.handle_to_device_from_sync_body(body)

        for room_id, room_dict in body["rooms"]["join"].items():
            try:
                if not self.rooms[room_id].encrypted:
                    logger.info(
                        "Room {} is not encrypted skipping...".format(
                            self.rooms[room_id].display_name
                        )
                    )
                    continue
            except KeyError:
                logger.info("Unknown room {} skipping...".format(room_id))
                continue
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
async def _verify_device(self, message_id, client, device):
        ret = client.verify_device(device)

        if ret:
            msg = (
                f"Device {device.id} of user " f"{device.user_id} succesfully verified."
            )
            await client.send_update_device(device)
        else:
            msg = f"Device {device.id} of user " f"{device.user_id} already verified."

        logger.info(msg)
        await self.send_response(message_id, client.user_id, "m.ok", msg)
github matrix-org / pantalaimon / pantalaimon / client.py View on Github external
async def undecrypted_event_cb(self, room, event):
        logger.info(
            "Unable to decrypt event from {} via {}.".format(
                event.sender, event.device_id
            )
        )

        if event.session_id not in self.outgoing_key_requests:
            logger.info("Requesting room key for undecrypted event.")

            # TODO we may want to retry this
            try:
                await self.request_room_key(event)
            except ClientConnectionError:
                pass