format and print ACCOUNT events
This commit is contained in:
parent
6982edcb78
commit
22cdafd354
3 changed files with 16 additions and 1 deletions
|
@ -121,6 +121,19 @@ class Module(ModuleManager.BaseModule):
|
||||||
self._event("chghost", event["server"], line, None, user=event["user"],
|
self._event("chghost", event["server"], line, None, user=event["user"],
|
||||||
minimal=minimal, formatting={"USER": username, "HOST": hostname})
|
minimal=minimal, formatting={"USER": username, "HOST": hostname})
|
||||||
|
|
||||||
|
@utils.hook("received.account.login")
|
||||||
|
def account_login(self, event):
|
||||||
|
self._account(event, "in")
|
||||||
|
@utils.hook("received.account.logout")
|
||||||
|
def account_logout(self, event):
|
||||||
|
self._account(event, "out")
|
||||||
|
def _account(self, event, action):
|
||||||
|
minimal = "{~NICK} logged %s as {ACC}" % action
|
||||||
|
line = "- %s" % minimal
|
||||||
|
|
||||||
|
self._event("account", event["server"], line, None, user=event["user"],
|
||||||
|
minimal=minimal, formatting={"ACC": event["account"]})
|
||||||
|
|
||||||
def _on_part(self, event, user):
|
def _on_part(self, event, user):
|
||||||
channel_name = event["channel"].name
|
channel_name = event["channel"].name
|
||||||
reason = event["reason"]
|
reason = event["reason"]
|
||||||
|
|
|
@ -100,6 +100,7 @@ def account(events, event):
|
||||||
events.on("received.account.login").call(user=user,
|
events.on("received.account.login").call(user=user,
|
||||||
server=event["server"], account=event["line"].args[0])
|
server=event["server"], account=event["line"].args[0])
|
||||||
else:
|
else:
|
||||||
|
account = user.account
|
||||||
user.account = None
|
user.account = None
|
||||||
events.on("received.account.logout").call(user=user,
|
events.on("received.account.logout").call(user=user,
|
||||||
server=event["server"])
|
server=event["server"], account=account)
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("formatted.quit")
|
@utils.hook("formatted.quit")
|
||||||
@utils.hook("formatted.rename")
|
@utils.hook("formatted.rename")
|
||||||
@utils.hook("formatted.chghost")
|
@utils.hook("formatted.chghost")
|
||||||
|
@utils.hook("formatted.account")
|
||||||
@utils.hook("formatted.delete")
|
@utils.hook("formatted.delete")
|
||||||
def formatted(self, event):
|
def formatted(self, event):
|
||||||
self._print(event)
|
self._print(event)
|
||||||
|
|
Loading…
Reference in a new issue