factor out Mailbox._touch
This commit is contained in:
parent
0158df9b63
commit
6176500cf4
|
@ -50,10 +50,13 @@ class Mailbox:
|
||||||
" (`mailbox_id`, `opened`, `side`, `added`)"
|
" (`mailbox_id`, `opened`, `side`, `added`)"
|
||||||
" VALUES(?,?,?,?)",
|
" VALUES(?,?,?,?)",
|
||||||
(self._mailbox_id, True, side, when))
|
(self._mailbox_id, True, side, when))
|
||||||
db.execute("UPDATE `mailboxes` SET `updated`=? WHERE `id`=?",
|
self._touch(when)
|
||||||
(when, self._mailbox_id))
|
|
||||||
db.commit() # XXX: reconcile the need for this with the comment above
|
db.commit() # XXX: reconcile the need for this with the comment above
|
||||||
|
|
||||||
|
def _touch(self, when):
|
||||||
|
self._db.execute("UPDATE `mailboxes` SET `updated`=? WHERE `id`=?",
|
||||||
|
(when, self._mailbox_id))
|
||||||
|
|
||||||
def get_messages(self):
|
def get_messages(self):
|
||||||
messages = []
|
messages = []
|
||||||
db = self._db
|
db = self._db
|
||||||
|
@ -89,8 +92,7 @@ class Mailbox:
|
||||||
" VALUES (?,?,?,?,?, ?,?)",
|
" VALUES (?,?,?,?,?, ?,?)",
|
||||||
(self._app_id, self._mailbox_id, sm.side,
|
(self._app_id, self._mailbox_id, sm.side,
|
||||||
sm.phase, sm.body, sm.server_rx, sm.msg_id))
|
sm.phase, sm.body, sm.server_rx, sm.msg_id))
|
||||||
self._db.execute("UPDATE `mailboxes` SET `updated`=? WHERE `id`=?",
|
self._touch(sm.server_rx)
|
||||||
(sm.server_rx, self._mailbox_id))
|
|
||||||
self._db.commit()
|
self._db.commit()
|
||||||
|
|
||||||
def add_message(self, sm):
|
def add_message(self, sm):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user