diff libervia/backend/plugins/plugin_xep_0199.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
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0199.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0199.py	Wed Jun 19 18:44:57 2024 +0200
@@ -49,7 +49,8 @@
         log.info(_("XMPP Ping plugin initialization"))
         self.host = host
         host.bridge.add_method(
-            "ping", ".plugin", in_sign='ss', out_sign='d', method=self._ping, async_=True)
+            "ping", ".plugin", in_sign="ss", out_sign="d", method=self._ping, async_=True
+        )
         try:
             self.text_cmds = self.host.plugins[C.TEXT_CMDS]
         except KeyError:
@@ -106,8 +107,12 @@
             txt_cmd.feed_back(client, "PONG ({time} s)".format(time=pong[1]), mess_data)
         else:
             txt_cmd.feed_back(
-                client, _("ping error ({err_msg}). Response time: {time} s")
-                .format(err_msg=pong[0], time=pong[1]), mess_data)
+                client,
+                _("ping error ({err_msg}). Response time: {time} s").format(
+                    err_msg=pong[0], time=pong[1]
+                ),
+                mess_data,
+            )
 
     def cmd_ping(self, client, mess_data):
         """ping an entity
@@ -120,8 +125,13 @@
                 entity_jid = jid.JID(mess_data["unparsed"].strip())
             except RuntimeError:
                 txt_cmd = self.host.plugins[C.TEXT_CMDS]
-                txt_cmd.feed_back(client, _('Invalid jid: "{entity_jid}"').format(
-                    entity_jid=mess_data["unparsed"].strip()), mess_data)
+                txt_cmd.feed_back(
+                    client,
+                    _('Invalid jid: "{entity_jid}"').format(
+                        entity_jid=mess_data["unparsed"].strip()
+                    ),
+                    mess_data,
+                )
                 return False
         else:
             entity_jid = mess_data["to"]
@@ -131,8 +141,11 @@
         return False
 
     def on_ping_request(self, iq_elt, client):
-        log.info(_("XMPP PING received from {from_jid} [{profile}]").format(
-            from_jid=iq_elt["from"], profile=client.profile))
+        log.info(
+            _("XMPP PING received from {from_jid} [{profile}]").format(
+                from_jid=iq_elt["from"], profile=client.profile
+            )
+        )
         iq_elt.handled = True
         iq_result_elt = xmlstream.toResponse(iq_elt, "result")
         client.send(iq_result_elt)