PyBitmessage/src/helper_inbox.py

24 lines
740 B
Python
Raw Normal View History

2019-10-07 08:08:26 +00:00
"""Helper Inbox performs inbox messages related operations"""
2018-04-07 10:41:24 +00:00
from helper_sql import sqlExecute, sqlQuery
import queues
2018-04-07 10:41:24 +00:00
def insert(t):
2019-10-07 08:08:26 +00:00
"""Perform an insert into the "inbox" table"""
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))
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))
def isMessageAlreadyInInbox(sigHash):
2014-07-26 17:15:28 +00:00
queryReturn = sqlQuery(
'''SELECT COUNT(*) FROM inbox WHERE sighash=?''', sigHash)
return queryReturn[0][0] != 0