Fix local variable overwrite for reason in formatted.quit logic

This commit is contained in:
jesopo 2019-03-08 17:20:57 +00:00
parent b3472c009a
commit 5165e53264

View file

@ -77,9 +77,8 @@ class Module(ModuleManager.BaseModule):
self._on_join(event, event["server"].get_user(event["server"].nickname)) self._on_join(event, event["server"].get_user(event["server"].nickname))
def _on_part(self, event, user): def _on_part(self, event, user):
reason = "" reason = event["reason"]
if event["reason"]: reason = reason if not reason else " (%s)" % reason
reason = " (%s)" % event["reason"]
line = "- %s left %s%s" % (user.nickname, event["channel"].name, reason) line = "- %s left %s%s" % (user.nickname, event["channel"].name, reason)
self._event("part", event["server"], line, event["channel"].name, self._event("part", event["server"], line, event["channel"].name,
channel=event["channel"], user=user) channel=event["channel"], user=user)
@ -159,9 +158,7 @@ class Module(ModuleManager.BaseModule):
self._on_kick(event, event["server"].nickname) self._on_kick(event, event["server"].nickname)
def _quit(self, event, user, reason): def _quit(self, event, user, reason):
reason = "" reason = reason if not reason else " (%s)" % reason
if reason:
reason = " (%s)" % reason
line = "- %s quit%s" % (user.nickname, reason) line = "- %s quit%s" % (user.nickname, reason)
self._event("quit", event["server"], line, None, user=user) self._event("quit", event["server"], line, None, user=user)
@utils.hook("received.quit") @utils.hook("received.quit")