mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Some small refactorings, fixed a problem in unsend.
This commit is contained in:
parent
0e68a44513
commit
1f49fc1e3e
@ -203,7 +203,7 @@ class Note(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
note = self.db.get(id)
|
note = self.db.get(id)
|
||||||
except KeyError:
|
except dbi.NoRecordError:
|
||||||
irc.error('That\'s not a note in my database.', Raise=True)
|
irc.error('That\'s not a note in my database.', Raise=True)
|
||||||
if note.to != user.id:
|
if note.to != user.id:
|
||||||
irc.error('You may only reply to notes '
|
irc.error('You may only reply to notes '
|
||||||
@ -226,7 +226,10 @@ class Note(callbacks.Plugin):
|
|||||||
Unsends the note with the id given. You must be the
|
Unsends the note with the id given. You must be the
|
||||||
author of the note, and it must be unread.
|
author of the note, and it must be unread.
|
||||||
"""
|
"""
|
||||||
note = self.db.get(id)
|
try:
|
||||||
|
note = self.db.get(id)
|
||||||
|
except dbi.NoRecordError:
|
||||||
|
irc.errorInvalid('note id')
|
||||||
if note.frm == user.id:
|
if note.frm == user.id:
|
||||||
if not note.read:
|
if not note.read:
|
||||||
self.db.unsend(id)
|
self.db.unsend(id)
|
||||||
@ -257,9 +260,8 @@ class Note(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
note = self.db.get(id)
|
note = self.db.get(id)
|
||||||
except KeyError:
|
except dbi.NoRecordError:
|
||||||
irc.error('That\'s not a valid note id.')
|
irc.errorInvalid('note id')
|
||||||
return
|
|
||||||
if user.id != note.frm and user.id != note.to:
|
if user.id != note.frm and user.id != note.to:
|
||||||
s = 'You may only retrieve notes you\'ve sent or received.'
|
s = 'You may only retrieve notes you\'ve sent or received.'
|
||||||
irc.error(s)
|
irc.error(s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user