Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0249.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | a7d4007a8fa5 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0249.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0249.py Wed Jun 19 18:44:57 2024 +0200 @@ -33,7 +33,6 @@ log = getLogger(__name__) - try: from twisted.words.protocols.xmlstream import XMPPHandler except ImportError: @@ -95,7 +94,7 @@ self.host.plugins[C.TEXT_CMDS].register_text_commands(self) except KeyError: log.info(_("Text commands not available")) - host.register_namespace('x-conference', NS_X_CONFERENCE) + host.register_namespace("x-conference", NS_X_CONFERENCE) host.trigger.add("message_received", self._message_received_trigger) def get_handler(self, client): @@ -120,7 +119,7 @@ room: jid.JID, # the dict is only used internally, so we can safely use a default dict instead of # None here. - **options + **options, ) -> None: """Invite a user to a room @@ -156,15 +155,16 @@ def _message_received_trigger(self, client, message_elt, post_treat): """Check if a direct invitation is in the message, and handle it""" - x_elt = next(message_elt.elements(NS_X_CONFERENCE, 'x'), None) + x_elt = next(message_elt.elements(NS_X_CONFERENCE, "x"), None) if x_elt is None: return True try: room_jid_s = x_elt["jid"] except KeyError: - log.warning(_("invalid invitation received: {xml}").format( - xml=message_elt.toXml())) + log.warning( + _("invalid invitation received: {xml}").format(xml=message_elt.toXml()) + ) return False log.info( _("Invitation received for room %(room)s [%(profile)s]") @@ -200,7 +200,7 @@ "type": C.META_TYPE_CONFIRM, "subtype": C.META_TYPE_MUC_INVIRATION, "from_jid": from_jid_s, - "room_jid": room_jid_s + "room_jid": room_jid_s, } confirm_msg = D_( "You have been invited by %(user)s to join the room %(room)s. " @@ -208,8 +208,11 @@ ) % {"user": from_jid_s, "room": room_jid_s} confirm_title = D_("MUC invitation") d = xml_tools.defer_confirm( - self.host, confirm_msg, confirm_title, profile=client.profile, - action_extra=action_extra + self.host, + confirm_msg, + confirm_title, + profile=client.profile, + action_extra=action_extra, ) def accept_cb(accepted):