From 7d7e396bac91ab527cb3a03dd407854f0da1a393 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 8 Dec 2003 13:15:00 +0000 Subject: [PATCH] Converted to use a DBHandler. --- plugins/Todo.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/Todo.py b/plugins/Todo.py index ee80ed5e3..3f4f0539c 100644 --- a/plugins/Todo.py +++ b/plugins/Todo.py @@ -152,19 +152,28 @@ class Todo(callbacks.Privmsg): s = 'Todos for %s: %s' % (arg, utils.commaAndify(L)) irc.reply(msg, s) else: - cursor.execute("""SELECT userid, priority, added_at, task + cursor.execute("""SELECT userid,priority,added_at,task,active FROM todo WHERE id = %s""", taskid) if cursor.rowcount == 0: irc.error(msg, '%r is not a valid task id' % taskid) return - userid, pri, added_at, task = cursor.fetchone() + (userid, pri, added_at, task, active) = cursor.fetchone() # Construct and return the reply - username = ircdb.users.getUser(userid).name + user = ircdb.users.getUser(userid) + if user is None: + name = 'a removed user' + else: + name = user.name + if int(active): + active = 'Active' + else: + active = 'Inactive' if pri: task += ', priority: %s' % pri added_at = time.strftime(conf.humanTimestampFormat, time.localtime(int(added_at))) - s = "Todo for %s: %s (Added at %s)" % (username,task,added_at) + s = "%s todo for %s: %s (Added at %s)" % \ + (active, name, task, added_at) irc.reply(msg, s) def add(self, irc, msg, args):