Added the note ids that are unread to the notification message.

This commit is contained in:
Jeremy Fincher 2004-07-28 20:25:11 +00:00
parent 2ca430403f
commit 206d8bd527

View File

@ -135,16 +135,19 @@ class Note(callbacks.Privmsg):
return return
db = self.dbHandler.getDb() db = self.dbHandler.getDb()
cursor = db.cursor() cursor = db.cursor()
cursor.execute("""SELECT COUNT(*) FROM notes cursor.execute("""SELECT id FROM notes
WHERE notes.to_id=%s AND notified=0""", id) WHERE notes.to_id=%s AND notified=0""", id)
unnotified = int(cursor.fetchone()[0]) unnotifiedIds = ['#%s' % t[0] for t in cursor.fetchall()]
unnotified = len(unnotifiedIds)
if unnotified != 0 or repeatedly: if unnotified != 0 or repeatedly:
cursor.execute("""SELECT COUNT(*) FROM notes cursor.execute("""SELECT id FROM notes
WHERE notes.to_id=%s AND read=0""", id) WHERE notes.to_id=%s AND read=0""", id)
unread = int(cursor.fetchone()[0]) unreadIds = ['#%s' % t[0] for t in cursor.fetchall()]
s = 'You have %s; ' \ unread = len(unreadIds)
'%s that I haven\'t told you about before now..' % \ s = 'You have %s; %s that I haven\'t told you about before now. '\
(utils.nItems('note', unread, 'unread'), unnotified) '%s %s still unread.' % \
(utils.nItems('note', unread, 'unread'), unnotified,
utils.commaAndify(unreadIds), utils.be(unread))
maker = ircmsgs.privmsg maker = ircmsgs.privmsg
if self.userValue('notifyWithNotice', msg.prefix): if self.userValue('notifyWithNotice', msg.prefix):
maker = ircmsgs.notice maker = ircmsgs.notice