How to use pantalaimon - 10 common examples

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 / ui.py View on Github external
def message_callback(self):
            try:
                message = self.receive_queue.get_nowait()
            except Empty:
                return True

            logger.debug(f"UI loop received message {message}")

            if isinstance(message, UpdateDevicesMessage):
                self.device_if.update_devices(message)

            elif isinstance(message, UpdateUsersMessage):
                self.control_if.update_users(message)

            elif isinstance(message, UnverifiedDevicesSignal):
                self.control_if.UnverifiedDevices(
                    message.pan_user, message.room_id, message.room_display_name
                )

                if self.notifications:
                    self.unverified_notification(message)

            elif isinstance(message, InviteSasSignal):
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 / ui.py View on Github external
def run(self):
            self.loop = GLib.MainLoop()

            if self.config.notifications:
                try:
                    notify2.init("pantalaimon", mainloop=self.loop)
                    self.notifications = True
                except dbus.DBusException:
                    logger.error(
                        "Notifications are enabled but no notification "
                        "server could be found, disabling notifications."
                    )
                    self.notifications = False

            GLib.timeout_add(100, self.message_callback)
            self.loop.run()
github matrix-org / pantalaimon / pantalaimon / index.py View on Github external
def _load_context(self, user, event, before, after):
            context = {}

            if before > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
                    .where(
                        (Event.date <= event.date)
                        & (Event.room_id == event.room_id)
                        & (Event.id != event.id)
                        & (UserMessages.user == user)
                    )
                    .order_by(Event.date.desc())
                    .limit(before)
                )

                context["events_before"] = [e.source for e in query]
            else:
                context["events_before"] = []

            if after > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
github matrix-org / pantalaimon / pantalaimon / index.py View on Github external
.order_by(Event.date.desc())
                    .limit(before)
                )

                context["events_before"] = [e.source for e in query]
            else:
                context["events_before"] = []

            if after > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
                    .where(
                        (Event.date >= event.date)
                        & (Event.room_id == event.room_id)
                        & (Event.id != event.id)
                        & (UserMessages.user == user)
                    )
                    .order_by(Event.date)
                    .limit(after)
                )

                context["events_after"] = [e.source for e in query]
            else:
                context["events_after"] = []

            return context
github matrix-org / pantalaimon / pantalaimon / index.py View on Github external
(Event.date <= event.date)
                        & (Event.room_id == event.room_id)
                        & (Event.id != event.id)
                        & (UserMessages.user == user)
                    )
                    .order_by(Event.date.desc())
                    .limit(before)
                )

                context["events_before"] = [e.source for e in query]
            else:
                context["events_before"] = []

            if after > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
                    .where(
                        (Event.date >= event.date)
                        & (Event.room_id == event.room_id)
                        & (Event.id != event.id)
                        & (UserMessages.user == user)
                    )
                    .order_by(Event.date)
                    .limit(after)
                )

                context["events_after"] = [e.source for e in query]
            else:
                context["events_after"] = []

            return context
github matrix-org / pantalaimon / pantalaimon / index.py View on Github external
def _load_context(self, user, event, before, after):
            context = {}

            if before > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
                    .where(
                        (Event.date <= event.date)
                        & (Event.room_id == event.room_id)
                        & (Event.id != event.id)
                        & (UserMessages.user == user)
                    )
                    .order_by(Event.date.desc())
                    .limit(before)
                )

                context["events_before"] = [e.source for e in query]
            else:
                context["events_before"] = []

            if after > 0:
                query = (
                    Event.select()
                    .join(UserMessages)
                    .where(