Reformatted code base using black.
This commit is contained in:
parent
56319cbad3
commit
53fdaa9d09
1 changed files with 12604 additions and 8966 deletions
|
|
@ -49,7 +49,8 @@ class XEP_0199(object):
|
|||
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 @@ class XEP_0199(object):
|
|||
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 @@ class XEP_0199(object):
|
|||
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 @@ class XEP_0199(object):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue