#
# History:
# 2013-11-08, Stefan Huber <shuber@sthu.org>
-# version 0.2.2: add match_prefix setting
+# version 0.2.2: add match_prefix setting, recall timestamp of message
# 2012-12-29, Stefan Huber <shuber@sthu.org>
# version 0.2.1: fix channel determination in join_cb
# 2010-05-20, Alexander Schremmer <alex@alexanderweb.de>
import weechat as w
import re
+from datetime import datetime
+from time import strftime
SCRIPT_NAME = "postpone"
SCRIPT_AUTHOR = "Alexander Schremmer <alex@alexanderweb.de>"
if server in postpone_data and channel in postpone_data[server] and\
nick in postpone_data[server][channel]:
messages = postpone_data[server][channel][nick]
- for msg in messages:
- w.command(buffer, msg + " (This message has been postponed.)")
+ for time, msg in messages:
+ tstr = strftime("%Y-%m-%d %H:%M:%S", time.timetuple())
+ w.command(buffer, msg + " (This message has been postponed on " + tstr + ".)")
messages[:] = []
return w.WEECHAT_RC_OK
nick, message = match.groups()
if not channel_has_nick(server, channel, nick):
w.prnt(buffer, "| Enqueued message for %s: %s" % (nick, message))
- save = nick + ": " + message
+ save = datetime.now(), nick + ": " + message
postpone_data.setdefault(server, {}).setdefault(channel,
{}).setdefault(nick.lower(), []).append(save)
w.buffer_set(buffer, 'input', "")