From 651399f5fcbc69123541f69f18ad66f7a4196654 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 5 May 2021 08:44:40 -0500 Subject: [PATCH] delete history pointer after reporting --- history/ircplugin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/history/ircplugin.py b/history/ircplugin.py index d16f1a1..2d383eb 100644 --- a/history/ircplugin.py +++ b/history/ircplugin.py @@ -97,6 +97,7 @@ class History(Plugin): for channel in self.channel_leave_points.keys(): logger.debug("checking history slice for %s", channel) total_history += self._missed_slice(channel, who) + self._delete_channel_leave_point(channel, who) logger.debug("total history so far: %s", total_history) channel_count += 1 logger.debug("final missed history: %s", total_history) @@ -106,6 +107,7 @@ class History(Plugin): else: where = event.target history = self._missed_slice(where, who) + self._delete_channel_leave_point(where, who) self._send_history(who, history) self.bot.reply(event, f"{len(history)} line(s) (PRIVMSGed)") return 'NO MORE' @@ -121,6 +123,12 @@ class History(Plugin): leave_points[who] = len(self.channel_history.setdefault(where, [])) - 1 logger.debug("leave points for %s: %s", where, leave_points) + def _delete_channel_leave_point(self, where, who): + """Remove tracking for user's history point.""" + leave_points = self.channel_leave_points.setdefault(where, {}) + leave_points.pop(who, None) + logger.debug("leave points for %s: %s", where, leave_points) + def _add_channel_participant(self, where, who): """Add a who to the list of people who are/were in a channel.""" participants = self.channel_participants.setdefault(where, set())