summaryrefslogtreecommitdiff
path: root/plugins/time_marker.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/time_marker.py')
-rw-r--r--plugins/time_marker.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/time_marker.py b/plugins/time_marker.py
index bd6af1c4..6ce511a0 100644
--- a/plugins/time_marker.py
+++ b/plugins/time_marker.py
@@ -31,12 +31,13 @@ Messages like “2 hours, 25 minutes passed…” are automatically displayed in
from poezio.plugin import BasePlugin
from datetime import datetime, timedelta
+from poezio.ui.types import InfoMessage
class Plugin(BasePlugin):
def init(self):
self.api.add_event_handler("muc_msg", self.on_muc_msg)
- # Dict of MucTab.name: last_message date, so we don’t have to
+ # Dict of MucTab.jid.bare: last_message date, so we don’t have to
# retrieve the messages of the given muc to look for the last
# message’s date each time. Also, now that I think about it, the
# date of the message is not event kept in the Message object, so…
@@ -66,10 +67,11 @@ class Plugin(BasePlugin):
res += "%s seconds, " % seconds
return res[:-2]
- last_message_date = self.last_messages.get(tab.name)
- self.last_messages[tab.name] = datetime.now()
+ last_message_date = self.last_messages.get(tab.jid.bare)
+ self.last_messages[tab.jid.bare] = datetime.now()
if last_message_date:
delta = datetime.now() - last_message_date
if delta >= timedelta(0, self.config.get('delay', 900)):
tab.add_message(
- "%s passed…" % (format_timedelta(delta), ), str_time='')
+ InfoMessage("%s passed…" % (format_timedelta(delta), ))
+ )