aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-19 11:14:33 +0000
committerGravatar jesopo2020-02-19 11:14:33 +0000
commit8ce7bd17ff22d3500503b39d4708d74f8340ea12 (patch)
treec00beb601b74715c83801abd5a06df446dca362f /src/core_modules
parentweeks and days should be absolute (divmod of days) (diff)
signature
simplify pruning quit/parted users
Diffstat (limited to 'src/core_modules')
-rw-r--r--src/core_modules/line_handler/channel.py7
-rw-r--r--src/core_modules/line_handler/user.py2
2 files changed, 2 insertions, 7 deletions
diff --git a/src/core_modules/line_handler/channel.py b/src/core_modules/line_handler/channel.py
index ce3ca90d..1d1d5d61 100644
--- a/src/core_modules/line_handler/channel.py
+++ b/src/core_modules/line_handler/channel.py
@@ -99,10 +99,7 @@ def part(events, event):
user = event["server"].get_user(event["line"].source.nickname)
reason = event["line"].args.get(1)
- channel.remove_user(user)
- user.part_channel(channel)
- if not len(user.channels):
- event["server"].remove_user(user)
+ event["server"].part_user(channel, user)
if not event["server"].is_own_nickname(event["line"].source.nickname):
events.on("received.part").call(channel=channel, reason=reason,
@@ -148,8 +145,6 @@ def kick(events, event):
channel.remove_user(target_user)
target_user.part_channel(channel)
- if not len(target_user.channels):
- event["server"].remove_user(target_user)
def rename(events, event):
old_name = event["line"].args[0]
diff --git a/src/core_modules/line_handler/user.py b/src/core_modules/line_handler/user.py
index 765d1da8..a5d407fb 100644
--- a/src/core_modules/line_handler/user.py
+++ b/src/core_modules/line_handler/user.py
@@ -27,9 +27,9 @@ def quit(events, event):
if (not event["server"].is_own_nickname(nickname) and
not event["line"].source.hostmask == "*"):
user = event["server"].get_user(nickname)
+ event["server"].quit_user(user)
events.on("received.quit").call(reason=reason, user=user,
server=event["server"])
- event["server"].remove_user(user)
else:
event["server"].disconnect()
else: