mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 20:14:20 +01:00
Added the note id to the response to sendnote.
This commit is contained in:
parent
589172a5f0
commit
dd40523197
@ -158,11 +158,16 @@ class Notes(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
public = 0
|
public = 0
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
|
now = int(time.time())
|
||||||
cursor.execute("""INSERT INTO notes VALUES
|
cursor.execute("""INSERT INTO notes VALUES
|
||||||
(NULL, %s, %s, %s, 0, 0, %s, %s)""",
|
(NULL, %s, %s, %s, 0, 0, %s, %s)""",
|
||||||
fromId, toId, int(time.time()), public, note)
|
fromId, toId, now, public, note)
|
||||||
self.db.commit()
|
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):
|
def note(self, irc, msg, args):
|
||||||
"""<note id>
|
"""<note id>
|
||||||
|
@ -42,10 +42,6 @@ except ImportError:
|
|||||||
if sqlite is not None:
|
if sqlite is not None:
|
||||||
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('Notes', 'Misc', 'User')
|
plugins = ('Notes', 'Misc', 'User')
|
||||||
def testHelps(self):
|
|
||||||
self.assertNotError('help sendnote')
|
|
||||||
self.assertNotError('list Notes')
|
|
||||||
|
|
||||||
def testSendnote(self):
|
def testSendnote(self):
|
||||||
#print repr(ircdb.users.getUser(self.prefix))
|
#print repr(ircdb.users.getUser(self.prefix))
|
||||||
self.prefix = 'foo!bar@baz'
|
self.prefix = 'foo!bar@baz'
|
||||||
@ -53,8 +49,9 @@ if sqlite is not None:
|
|||||||
(id, u) = ircdb.users.newUser()
|
(id, u) = ircdb.users.newUser()
|
||||||
u.name = 'inkedmn'
|
u.name = 'inkedmn'
|
||||||
ircdb.users.setUser(id, u)
|
ircdb.users.setUser(id, u)
|
||||||
self.assertNotError('sendnote inkedmn test')
|
self.assertRegexp('sendnote inkedmn test', '#1')
|
||||||
self.assertError('sendnote alsdkjfasldk foo')
|
self.assertError('sendnote alsdkjfasldk foo')
|
||||||
|
self.assertNotRegexp('sendnote inkedmn test2', 'the operation')
|
||||||
|
|
||||||
def testNote(self):
|
def testNote(self):
|
||||||
# self.assertNotError('note 1')
|
# self.assertNotError('note 1')
|
||||||
|
Loading…
Reference in New Issue
Block a user