From 304dc4948a5fa20c82f413ffcbac28fc67a59bab Mon Sep 17 00:00:00 2001 From: dgw Date: Sun, 20 Oct 2019 11:46:06 -0500 Subject: [PATCH] Selectively prune gender cache on PART and KICK On PART, prune the user's cached gender only if Bucket no longer shares any channels with them. KICK did not prune the gender cache at all before, but it now follows the same (new) logic as PART. --- bucket.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bucket.pl b/bucket.pl index 5b9893e..7c9a4cb 100755 --- a/bucket.pl +++ b/bucket.pl @@ -273,6 +273,10 @@ sub irc_on_kick { ); delete $stats{users}{$chl}{$kickee}; + + if ( !@{$irc->nick_channels( $kickee )} ) { + delete $stats{users}{genders}{lc $who}; + } } sub irc_on_quit { @@ -2516,7 +2520,9 @@ sub irc_on_part { delete $stats{users}{$chl}{$who}; - delete $stats{users}{genders}{lc $who}; + if ( !@{$irc->nick_channels( $who )} ) { + delete $stats{users}{genders}{lc $who}; + } } sub irc_on_chan_sync {