Esempio n. 1
0
    def send_org_message(self, msg, add_color=True, fire_outgoing_event=True):
        org_channel_id = self.public_channel_service.org_channel_id
        if org_channel_id is None:
            self.logger.debug(
                "ignoring message to org channel since the org_channel_id is unknown"
            )
        else:
            color = self.setting_service.get(
                "org_channel_color").get_font_color() if add_color else ""
            pages = self.get_text_pages(
                msg,
                self.setting_service.get(
                    "org_channel_max_page_length").get_value())
            for page in pages:
                packet = client_packets.PublicChannelMessage(
                    org_channel_id, color + page, "")
                self.packet_queue.enqueue(packet)
                self.check_outgoing_message_queue()

            if fire_outgoing_event:
                self.event_service.fire_event(
                    self.OUTGOING_ORG_MESSAGE_EVENT,
                    DictObject({
                        "org_channel_id": org_channel_id,
                        "message": msg
                    }))
Esempio n. 2
0
 def send_org_message(self, msg):
     org_channel_id = self.public_channel_manager.org_channel_id
     if org_channel_id is None:
         self.logger.warning("Could not send message to org channel, unknown org id")
     else:
         for page in self.get_text_pages(msg, self.setting_manager.get("org_channel_max_page_length").get_value()):
             packet = client_packets.PublicChannelMessage(org_channel_id, page, "")
             # self.send_packet(packet)
             self.packet_queue.enqueue(packet)
Esempio n. 3
0
 def send_org_message(self, msg):
     org_channel_id = self.public_channel_service.org_channel_id
     if org_channel_id is None:
         self.logger.warning(
             "Could not send message to org channel, unknown org id")
     else:
         color = self.setting_service.get(
             "org_channel_color").get_font_color()
         for page in self.get_text_pages(
                 msg,
                 self.setting_service.get(
                     "org_channel_max_page_length").get_value()):
             packet = client_packets.PublicChannelMessage(
                 org_channel_id, color + page, "")
             # self.send_packet(packet)
             self.packet_queue.enqueue(packet)
             self.check_outgoing_message_queue()
Esempio n. 4
0
    def send_org_message(self, msg, add_color=True, conn=None):
        if not conn:
            conn = self.get_primary_conn()

        if not conn.org_channel_id:
            self.logger.debug(
                f"Ignoring message to org channel for {conn.id} since the org_channel_id is unknown"
            )
        else:
            color = self.setting_service.get(
                "org_channel_color").get_font_color() if add_color else ""
            pages = self.get_text_pages(
                msg, conn,
                self.setting_service.get(
                    "org_channel_max_page_length").get_value())
            for page in pages:
                packet = client_packets.PublicChannelMessage(
                    conn.org_channel_id, color + page, "")
                conn.add_packet_to_queue(packet)
Esempio n. 5
0
 def map_page(page):
     return client_packets.PublicChannelMessage(
         conn.org_channel_id, color + page, "")