From b6b47b5d3f9a3f8c417ff4f32afe05355ebbdf6f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 28 Aug 2003 23:11:43 +0000 Subject: [PATCH] Added example string. --- plugins/Notes.py | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/plugins/Notes.py b/plugins/Notes.py index 698de60eb..eab8346f9 100644 --- a/plugins/Notes.py +++ b/plugins/Notes.py @@ -52,6 +52,27 @@ import callbacks dbfilename = os.path.join(conf.dataDir, 'Notes.db') +example = utils.wrapLines(""" + @list Notes + note, notes, oldnotes, sendnote + @notes + You have no unread notes. + @oldnotes + 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 15, 17, 18, 19, 25, 26, 27, 28, 37, 40, 41, 47 + @note 1 + I read their site, lurk on their forums and help out with the dc competitions (Sent by jamessan 18 weeks, 1 day, 6 hours, 46 minutes, and 53 seconds ago) + @note 28 + er, you might want to change the ChannelStats module to ChannelDB in your conf file as well (Sent by Strike 2 weeks, 2 days, 20 hours, 11 minutes, and 58 seconds ago) + @sendnote jemfinch hey, this is a note from yourself. + The operation succeeded. +* jemfinch blah blah (he'll tell me I have unread notes) + You have 1 unread note; 1 that I haven't told you about before now.. + @notes + #49 from jemfinch + @note 49 + hey, this is a note from yourself. (Sent by jemfinch 20 seconds ago) +""") + class Notes(callbacks.Privmsg): def __init__(self): callbacks.Privmsg.__init__(self) @@ -116,6 +137,7 @@ class Notes(callbacks.Privmsg): "Called when module is unloaded/reloaded." self.db.commit() self.db.close() + del self.db def doJoin(self, irc, msg): try: @@ -226,11 +248,11 @@ class Notes(callbacks.Privmsg): return cursor = self.db.cursor() cursor.execute("""SELECT notes.id, notes.from_id, - notes.public, notes.read - FROM users, notes - WHERE users.name=%s AND - notes.to_id=users.id AND - notes.read=0""", sender) + notes.public, notes.read + FROM users, notes + WHERE users.name=%s AND + notes.to_id=users.id AND + notes.read=0""", sender) count = cursor.rowcount notes = cursor.fetchall() L = [] @@ -241,7 +263,7 @@ class Notes(callbacks.Privmsg): for (id, from_id, public, read) in notes: if not int(read): sender = self.getUserName(from_id) - if int(public): + if int(public) or not ircutils.isChannel(msg.args[0]): L.append(r'#%s from %s' % (id, sender)) else: L.append(r'#%s (private)' % id)