aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-09 23:04:36 +0000
committerGravatar jesopo2020-02-09 23:04:36 +0000
commit22cdafd354080dbcd2dc9d1e0f8fe23a3826d2fc (patch)
tree846a168f52b589adbf0bddecb42228fea4bcb504 /src/core_modules
parentcorrectly handle cron / "step" schedule (diff)
signature
format and print ACCOUNT events
Diffstat (limited to 'src/core_modules')
-rw-r--r--src/core_modules/format_activity.py13
-rw-r--r--src/core_modules/line_handler/user.py3
-rw-r--r--src/core_modules/print_activity.py1
3 files changed, 16 insertions, 1 deletions
diff --git a/src/core_modules/format_activity.py b/src/core_modules/format_activity.py
index 95c37e19..12573675 100644
--- a/src/core_modules/format_activity.py
+++ b/src/core_modules/format_activity.py
@@ -121,6 +121,19 @@ class Module(ModuleManager.BaseModule):
self._event("chghost", event["server"], line, None, user=event["user"],
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):
channel_name = event["channel"].name
reason = event["reason"]
diff --git a/src/core_modules/line_handler/user.py b/src/core_modules/line_handler/user.py
index 15b71673..765d1da8 100644
--- a/src/core_modules/line_handler/user.py
+++ b/src/core_modules/line_handler/user.py
@@ -100,6 +100,7 @@ def account(events, event):
events.on("received.account.login").call(user=user,
server=event["server"], account=event["line"].args[0])
else:
+ account = user.account
user.account = None
events.on("received.account.logout").call(user=user,
- server=event["server"])
+ server=event["server"], account=account)
diff --git a/src/core_modules/print_activity.py b/src/core_modules/print_activity.py
index 2d17e2be..e9968370 100644
--- a/src/core_modules/print_activity.py
+++ b/src/core_modules/print_activity.py
@@ -38,6 +38,7 @@ class Module(ModuleManager.BaseModule):
@utils.hook("formatted.quit")
@utils.hook("formatted.rename")
@utils.hook("formatted.chghost")
+ @utils.hook("formatted.account")
@utils.hook("formatted.delete")
def formatted(self, event):
self._print(event)