diff --git a/plugins/Factoids.py b/plugins/Factoids.py index dde5d997b..92fc16f45 100644 --- a/plugins/Factoids.py +++ b/plugins/Factoids.py @@ -348,7 +348,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): counter = 0 for (added_by, added_at) in factoids: counter += 1 - added_at = time.strftime(conf.supybot.humanTimestampFormat(), + added_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(added_at))) L.append('#%s was added by %s at %s' % (counter,added_by,added_at)) factoids = '; '.join(L) diff --git a/plugins/Later.py b/plugins/Later.py index 76a98a03b..04d74ee22 100644 --- a/plugins/Later.py +++ b/plugins/Later.py @@ -103,7 +103,7 @@ class Later(callbacks.Privmsg): fd.close() def _timestamp(self, when): - #format = conf.supybot.humanTimestampFormat() + #format = conf.supybot.reply.format.time() diff = time.time() - when try: return utils.timeElapsed(diff, seconds=False) + ' ago' diff --git a/plugins/MoobotFactoids.py b/plugins/MoobotFactoids.py index 078477fc7..33835c269 100644 --- a/plugins/MoobotFactoids.py +++ b/plugins/MoobotFactoids.py @@ -496,19 +496,19 @@ class MoobotFactoids(callbacks.Privmsg): # First, creation info. # Map the integer created_by to the username creat_by = ircdb.users.getUser(created_by).name - creat_at = time.strftime(conf.supybot.humanTimestampFormat(), + creat_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(created_at))) s += "Created by %s on %s." % (creat_by, creat_at) # Next, modification info, if any. if modified_by is not None: mod_by = ircdb.users.getUser(modified_by).name - mod_at = time.strftime(conf.supybot.humanTimestampFormat(), + mod_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(modified_at))) s += " Last modified by %s on %s." % (mod_by, mod_at) # Next, last requested info, if any if last_requested_by is not None: last_by = last_requested_by # not an int user id - last_at = time.strftime(conf.supybot.humanTimestampFormat(), + last_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(last_requested_at))) req_count = requested_count times_str = utils.nItems('time', requested_count) @@ -516,7 +516,7 @@ class MoobotFactoids(callbacks.Privmsg): (last_by, last_at, times_str) # Last, locked info if locked_at is not None: - lock_at = time.strftime(conf.supybot.humanTimestampFormat(), + lock_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(locked_at))) lock_by = ircdb.users.getUser(locked_by).name s += " Locked by %s on %s." % (lock_by, lock_at) diff --git a/plugins/Network.py b/plugins/Network.py index 2d8242910..f1b4c3357 100644 --- a/plugins/Network.py +++ b/plugins/Network.py @@ -189,7 +189,7 @@ class Network(callbacks.Privmsg): channels = utils.commaAndify(L) if '317' in d: idle = utils.timeElapsed(d['317'].args[2]) - signon = time.strftime(conf.supybot.humanTimestampFormat(), + signon = time.strftime(conf.supybot.reply.format.time(), time.localtime(float(d['317'].args[3]))) else: idle = '' diff --git a/plugins/News.py b/plugins/News.py index ef2aae597..3ec1b943a 100644 --- a/plugins/News.py +++ b/plugins/News.py @@ -60,7 +60,7 @@ class DbiNewsDB(plugins.DbiChannelDB): ] def __str__(self): - format = conf.supybot.humanTimestampFormat() + format = conf.supybot.reply.format.time() user = plugins.getUserName(self.by) if self.expires == 0: s = '%s (Subject: "%s", added by %s on %s)' % \ diff --git a/plugins/Poll.py b/plugins/Poll.py index 7124047c0..0dd720538 100644 --- a/plugins/Poll.py +++ b/plugins/Poll.py @@ -70,7 +70,7 @@ class PollRecord(dbi.Record): 'status' ] def __str__(self): - format = conf.supybot.humanTimestampFormat() + format = conf.supybot.reply.format.time() user = plugins.getUserName(self.by) if self.options: options = 'Options: %s' % '; '.join(map(str, self.options)) diff --git a/plugins/QuoteGrabs.py b/plugins/QuoteGrabs.py index 659623d53..5de3225ec 100644 --- a/plugins/QuoteGrabs.py +++ b/plugins/QuoteGrabs.py @@ -83,7 +83,7 @@ class QuoteGrabsRecord(dbi.Record): ] def __str__(self): - at = time.strftime(conf.supybot.humanTimestampFormat(), + at = time.strftime(conf.supybot.reply.format.time(), time.localtime(float(self.at))) grabber = plugins.getUserName(self.grabber) return '%s (Said by: %s; grabbed by %s at %s)' % \ diff --git a/plugins/Quotes.py b/plugins/Quotes.py index 12ec6b9ee..d748e881a 100644 --- a/plugins/Quotes.py +++ b/plugins/Quotes.py @@ -62,7 +62,7 @@ class QuoteRecord(dbi.Record): 'text' ] def __str__(self): - format = conf.supybot.humanTimestampFormat() + format = conf.supybot.reply.format.time() user = plugins.getUserName(self.by) return 'Quote %s added by %s at %s.' % \ (utils.quoted(self.text), user, diff --git a/plugins/Relay.py b/plugins/Relay.py index 69bd4e10a..dafe0e259 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -288,7 +288,7 @@ class Relay(callbacks.Privmsg): channels = utils.commaAndify(L) if '317' in d: idle = utils.timeElapsed(d['317'].args[2]) - signon = time.strftime(conf.supybot.humanTimestampFormat(), + signon = time.strftime(conf.supybot.reply.format.time(), time.localtime(float(d['317'].args[3]))) else: idle = '' diff --git a/plugins/Time.py b/plugins/Time.py index 87a7996ba..b14521b23 100644 --- a/plugins/Time.py +++ b/plugins/Time.py @@ -62,7 +62,7 @@ def configure(advanced): conf.registerPlugin('Time') conf.registerChannelValue(conf.supybot.plugins.Time, 'format', - registry.String(str(conf.supybot.humanTimestampFormat()), """Determines the + registry.String(str(conf.supybot.reply.format.time()), """Determines the format string for timestamps. Refer to the Python documentation for the time module to see what formats are accepted. If you set this variable to the empty string, the timestamp will not be shown.""")) diff --git a/plugins/Todo.py b/plugins/Todo.py index aa86e1a9d..cd7c8651c 100644 --- a/plugins/Todo.py +++ b/plugins/Todo.py @@ -163,7 +163,7 @@ class Todo(callbacks.Privmsg): active = 'Inactive' if pri: task += ', priority: %s' % pri - added_at = time.strftime(conf.supybot.humanTimestampFormat(), + added_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(added_at))) s = "%s todo for %s: %s (Added at %s)" % \ (active, name, task, added_at) diff --git a/plugins/__init__.py b/plugins/__init__.py index fc5c226cc..4776045b0 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -480,7 +480,7 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg): def showRecord(self, record): name = getUserName(record.by) at = time.localtime(record.at) - timeS = time.strftime(conf.supybot.humanTimestampFormat(), at) + timeS = time.strftime(conf.supybot.reply.format.time(), at) return '%s #%s: %s (added by %s at %s)' % \ (self.name(), record.id, utils.quoted(record.text), name, timeS) diff --git a/src/conf.py b/src/conf.py index d23a15f92..ffab34bc1 100644 --- a/src/conf.py +++ b/src/conf.py @@ -274,7 +274,12 @@ for (name, s) in registry._cache.iteritems(): registerGroup(supybot, 'reply') registerGroup(supybot.reply, 'format') -registerGroup(supybot.reply.format, 'time') +registerChannelValue(supybot.reply.format, 'time', + registry.String('%I:%M %p, %B %d, %Y', """Determines how timestamps printed + for human reading should be formatted. Refer to the Python documentation + for the time module to see valid formatting characters for time + formats.""")) + registerGroup(supybot.reply.format.time, 'elapsed') registerChannelValue(supybot.reply.format.time.elapsed, 'short', registry.Boolean(False, """Determines whether elapsed times will be given @@ -910,12 +915,6 @@ registerGlobalValue(supybot, 'defaultIgnore', hard for those users to register or identify with the bot, but that's your problem to solve.""")) -registerChannelValue(supybot, 'humanTimestampFormat', - registry.String('%I:%M %p, %B %d, %Y', """Determines how timestamps printed - for human reading should be formatted. Refer to the Python documentation - for the time module to see valid formatting characters for time - formats.""")) - class IP(registry.String): """Value must be a valid IP.""" def setValue(self, v):