comparison libervia/backend/plugins/plugin_exp_parrot.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 4b842c1fb686
children
comparison
equal deleted inserted replaced
4269:64a85ce8be70 4270:0d7bb4df2343
72 # if mess_data['to'].userhostJID() in _links.values(): 72 # if mess_data['to'].userhostJID() in _links.values():
73 # log.debug("Parrot link detected, skipping other triggers") 73 # log.debug("Parrot link detected, skipping other triggers")
74 # raise trigger.SkipOtherTriggers 74 # raise trigger.SkipOtherTriggers
75 75
76 def message_received_trigger(self, client, message_elt, post_treat): 76 def message_received_trigger(self, client, message_elt, post_treat):
77 """ Check if source is linked and repeat message, else do nothing """ 77 """Check if source is linked and repeat message, else do nothing"""
78 # TODO: many things are not repeated (subject, thread, etc) 78 # TODO: many things are not repeated (subject, thread, etc)
79 from_jid = message_elt["from"] 79 from_jid = message_elt["from"]
80 80
81 try: 81 try:
82 _links = client.parrot_links 82 _links = client.parrot_links
91 body = str(e) 91 body = str(e)
92 lang = e.getAttribute("lang") or "" 92 lang = e.getAttribute("lang") or ""
93 93
94 try: 94 try:
95 entity_type = self.host.memory.entity_data_get( 95 entity_type = self.host.memory.entity_data_get(
96 client, from_jid, [C.ENTITY_TYPE])[C.ENTITY_TYPE] 96 client, from_jid, [C.ENTITY_TYPE]
97 )[C.ENTITY_TYPE]
97 except (UnknownEntityError, KeyError): 98 except (UnknownEntityError, KeyError):
98 entity_type = "contact" 99 entity_type = "contact"
99 if entity_type == C.ENTITY_TYPE_MUC: 100 if entity_type == C.ENTITY_TYPE_MUC:
100 src_txt = from_jid.resource 101 src_txt = from_jid.resource
101 if src_txt == self.host.plugins["XEP-0045"].get_room_nick( 102 if src_txt == self.host.plugins["XEP-0045"].get_room_nick(