How to use the pantalaimon.thread_messages.SendAnywaysMessage 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 / ui.py View on Github external
def SendAnyways(self, pan_user, room_id):
            message = SendAnywaysMessage(self.message_id, pan_user, room_id)
            self.queue.put(message)
            return message.message_id
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
if isinstance(response, CancelSendingMessage):
                        # The send was canceled notify the client that sent the
                        # request about this.
                        info_msg = (
                            f"Canceled message sending for room "
                            f"{room.display_name} ({room_id})."
                        )
                        logger.info(info_msg)
                        await self.send_response(
                            response.message_id, client.user_id, "m.ok", info_msg
                        )

                        return web.Response(status=503, text=str(e))

                    elif isinstance(response, SendAnywaysMessage):
                        # We are sending and ignoring devices along the way.
                        info_msg = (
                            f"Ignoring unverified devices and sending "
                            f"message to room "
                            f"{room.display_name} ({room_id})."
                        )
                        logger.info(info_msg)
                        await self.send_response(
                            response.message_id, client.user_id, "m.ok", info_msg
                        )

                        ret = await _send(True)
                        await client.send_update_devices(client.room_devices(room_id))
                        return ret

                except asyncio.TimeoutError:
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
if isinstance(response, CancelSendingMessage):
                        # The send was canceled notify the client that sent the
                        # request about this.
                        info_msg = (
                            f"Canceled message sending for room "
                            f"{room.display_name} ({room_id})."
                        )
                        logger.info(info_msg)
                        await self.send_response(
                            response.message_id, client.user_id, "m.ok", info_msg
                        )

                        return web.Response(status=503, text=str(e))

                    elif isinstance(response, SendAnywaysMessage):
                        # We are sending and ignoring devices along the way.
                        info_msg = (
                            f"Ignoring unverified devices and sending "
                            f"message to room "
                            f"{room.display_name} ({room_id})."
                        )
                        logger.info(info_msg)
                        await self.send_response(
                            response.message_id, client.user_id, "m.ok", info_msg
                        )

                        ret = await _send(True)
                        await client.send_update_devices(client.room_devices(room_id))
                        return ret

                except asyncio.TimeoutError:
github matrix-org / pantalaimon / pantalaimon / daemon.py View on Github external
queue = asyncio.Queue()
                client.send_decision_queues[room_id] = queue

                message = UnverifiedDevicesSignal(
                    client.user_id, room_id, room.display_name
                )

                await self.send_ui_message(message)

                try:
                    if self.send_queue:
                        response = await asyncio.wait_for(
                            queue.get(), self.unverified_send_timeout
                        )
                    else:
                        response = SendAnywaysMessage("irrelevant_message_ID", client, room_id)

                    if isinstance(response, CancelSendingMessage):
                        # The send was canceled notify the client that sent the
                        # request about this.
                        info_msg = (
                            f"Canceled message sending for room "
                            f"{room.display_name} ({room_id})."
                        )
                        logger.info(info_msg)
                        await self.send_response(
                            response.message_id, client.user_id, "m.ok", info_msg
                        )

                        return web.Response(status=503, text=str(e))

                    elif isinstance(response, SendAnywaysMessage):