2018-04-07 10:41:24 +00:00
|
|
|
"""Helper Inbox performs inbox messagese related operations."""
|
|
|
|
|
|
|
|
from helper_sql import sqlExecute, sqlQuery
|
2017-02-08 12:41:56 +00:00
|
|
|
import queues
|
2013-06-20 23:25:01 +00:00
|
|
|
|
2018-04-07 10:41:24 +00:00
|
|
|
|
2013-06-20 23:25:01 +00:00
|
|
|
def insert(t):
|
2015-02-21 02:03:20 +00:00
|
|
|
sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t)
|
2018-04-07 10:41:24 +00:00
|
|
|
# shouldn't emit changedInboxUnread and displayNewInboxMessage
|
|
|
|
# at the same time
|
|
|
|
# queues.UISignalQueue.put(('changedInboxUnread', None))
|
|
|
|
|
|
|
|
|
2013-06-20 23:25:01 +00:00
|
|
|
def trash(msgid):
|
2013-08-27 12:13:40 +00:00
|
|
|
sqlExecute('''UPDATE inbox SET folder='trash' WHERE msgid=?''', msgid)
|
2018-04-07 10:41:24 +00:00
|
|
|
queues.UISignalQueue.put(('removeInboxRowByMsgid', msgid))
|
|
|
|
|
|
|
|
|
2015-02-21 02:03:20 +00:00
|
|
|
def isMessageAlreadyInInbox(sigHash):
|
2014-07-26 17:15:28 +00:00
|
|
|
queryReturn = sqlQuery(
|
2015-02-21 02:03:20 +00:00
|
|
|
'''SELECT COUNT(*) FROM inbox WHERE sighash=?''', sigHash)
|
2017-02-08 12:41:56 +00:00
|
|
|
return queryReturn[0][0] != 0
|