PyBitmessage-2021-04-27/src/helper_sent.py

20 lines
549 B
Python
Raw Normal View History

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
"""
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
def insert(t):
2019-10-09 13:27:51 +00:00
"""Perform an insert into the `sent` table"""
if not t[0] or not t[-1]:
temp = list(t)
if not t[0]:
temp[0] = uuid.uuid4().bytes # if msgid is empty the put uuid
if not t[-1]:
temp[-1] = BMConfigParser().getint('bitmessagesettings', 'ttl')
t = tuple(temp)
2015-03-09 06:35:32 +00:00
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)