diff --git a/plugins/Notes.py b/plugins/Notes.py index ab8666a8d..689afa56c 100644 --- a/plugins/Notes.py +++ b/plugins/Notes.py @@ -158,11 +158,16 @@ class Notes(callbacks.Privmsg): else: public = 0 cursor = self.db.cursor() + now = int(time.time()) cursor.execute("""INSERT INTO notes VALUES (NULL, %s, %s, %s, 0, 0, %s, %s)""", - fromId, toId, int(time.time()), public, note) + fromId, toId, now, public, note) self.db.commit() - irc.reply(msg, conf.replySuccess) + cursor.execute("""SELECT id FROM notes WHERE + from_id=%s AND to_id=%s AND added_at=%s""", + fromId, toId, now) + id = cursor.fetchone()[0] + irc.reply(msg, 'Note #%s sent to %s.' % (id, name)) def note(self, irc, msg, args): """ diff --git a/test/test_Notes.py b/test/test_Notes.py index f0c60363b..b45666bbe 100644 --- a/test/test_Notes.py +++ b/test/test_Notes.py @@ -42,10 +42,6 @@ except ImportError: if sqlite is not None: class NotesTestCase(PluginTestCase, PluginDocumentation): plugins = ('Notes', 'Misc', 'User') - def testHelps(self): - self.assertNotError('help sendnote') - self.assertNotError('list Notes') - def testSendnote(self): #print repr(ircdb.users.getUser(self.prefix)) self.prefix = 'foo!bar@baz' @@ -53,8 +49,9 @@ if sqlite is not None: (id, u) = ircdb.users.newUser() u.name = 'inkedmn' ircdb.users.setUser(id, u) - self.assertNotError('sendnote inkedmn test') + self.assertRegexp('sendnote inkedmn test', '#1') self.assertError('sendnote alsdkjfasldk foo') + self.assertNotRegexp('sendnote inkedmn test2', 'the operation') def testNote(self): # self.assertNotError('note 1')