2019-10-07 13:58:12 +00:00
|
|
|
"""
|
2019-10-09 13:27:51 +00:00
|
|
|
Insert values into sent table
|
2019-10-07 13:58:12 +00:00
|
|
|
"""
|
|
|
|
|
2020-09-15 11:18:24 +00:00
|
|
|
import uuid
|
|
|
|
from bmconfigparser import BMConfigParser
|
2019-12-23 09:49:03 +00:00
|
|
|
from helper_sql import sqlExecute
|
|
|
|
|
2019-10-09 13:27:51 +00:00
|
|
|
|
2013-06-20 23:25:01 +00:00
|
|
|
def insert(t):
|
2019-10-09 13:27:51 +00:00
|
|
|
"""Perform an insert into the `sent` table"""
|
2020-09-15 11:18:24 +00:00
|
|
|
if not t[0] or not t[-1]:
|
|
|
|
temp = list(t)
|
|
|
|
if not t[0]:
|
|
|
|
print('zero index is not available')
|
|
|
|
temp[0] = uuid.uuid4().bytes # if msgid is empty the put uuid
|
|
|
|
if not t[-1]:
|
|
|
|
print('Lasr index is not available')
|
|
|
|
temp[-1] = BMConfigParser().getint('bitmessagesettings', 'ttl')
|
|
|
|
t = tuple(temp)
|
2015-03-09 06:35:32 +00:00
|
|
|
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
|