delete history pointer after reporting

This commit is contained in:
Brian S. Stephan 2021-05-05 08:44:40 -05:00
parent 0b3386e183
commit 651399f5fc
1 changed files with 8 additions and 0 deletions

View File

@ -97,6 +97,7 @@ class History(Plugin):
for channel in self.channel_leave_points.keys(): for channel in self.channel_leave_points.keys():
logger.debug("checking history slice for %s", channel) logger.debug("checking history slice for %s", channel)
total_history += self._missed_slice(channel, who) total_history += self._missed_slice(channel, who)
self._delete_channel_leave_point(channel, who)
logger.debug("total history so far: %s", total_history) logger.debug("total history so far: %s", total_history)
channel_count += 1 channel_count += 1
logger.debug("final missed history: %s", total_history) logger.debug("final missed history: %s", total_history)
@ -106,6 +107,7 @@ class History(Plugin):
else: else:
where = event.target where = event.target
history = self._missed_slice(where, who) history = self._missed_slice(where, who)
self._delete_channel_leave_point(where, who)
self._send_history(who, history) self._send_history(who, history)
self.bot.reply(event, f"{len(history)} line(s) (PRIVMSGed)") self.bot.reply(event, f"{len(history)} line(s) (PRIVMSGed)")
return 'NO MORE' return 'NO MORE'
@ -121,6 +123,12 @@ class History(Plugin):
leave_points[who] = len(self.channel_history.setdefault(where, [])) - 1 leave_points[who] = len(self.channel_history.setdefault(where, [])) - 1
logger.debug("leave points for %s: %s", where, leave_points) 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): def _add_channel_participant(self, where, who):
"""Add a who to the list of people who are/were in a channel.""" """Add a who to the list of people who are/were in a channel."""
participants = self.channel_participants.setdefault(where, set()) participants = self.channel_participants.setdefault(where, set())