removed the inset sent query and using the comman helper_sent.inset method for data insertion

This commit is contained in:
navjot 2020-09-15 22:13:22 +05:30
parent e0eb795696
commit 8850a68347
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 42 additions and 15 deletions

View File

@ -62,6 +62,7 @@ from uikivysignaler import UIkivySignaler
import identiconGeneration
from addresses import addBMIfNotPresent, decodeAddress
import helper_sent
def toast(text):
@ -606,15 +607,24 @@ class DropDownWidget(BoxLayout):
'bitmessagesettings', 'ackstealthlevel')
from helper_ackPayload import genAckPayload
ackdata = genAckPayload(streamNumber, stealthLevel)
# t = ()
sqlExecute(
'''INSERT INTO sent VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
'', toAddress, ripe, fromAddress, subject, message,
ackdata, int(time.time()), int(time.time()), 0,
'msgqueued', 0, 'sent', encoding,
BMConfigParser().getint(
'bitmessagesettings', 'ttl'))
t = (
'',
toAddress,
ripe,
fromAddress,
subject,
message,
ackdata,
int(time.time()),
int(time.time()),
0,
'msgqueued',
0,
'sent',
encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')
)
helper_sent.insert(t)
state.check_sent_acc = fromAddress
state.msg_counter_objs = self.parent.parent.parent.parent\
.parent.parent.children[2].children[0].ids
@ -2253,12 +2263,24 @@ class Draft(Screen):
'bitmessagesettings', 'ackstealthlevel')
from helper_ackPayload import genAckPayload
ackdata = genAckPayload(streamNumber, stealthLevel)
sqlExecute(
'''INSERT INTO sent VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', '', toAddress, ripe,
fromAddress, subject, message, ackdata, int(time.time()),
int(time.time()), 0, 'msgqueued', 0, 'draft', encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl'))
t = (
'',
toAddress,
ripe,
fromAddress,
subject,
message,
ackdata,
int(time.time()),
int(time.time()),
0,
'msgqueued',
0,
'draft',
encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')
)
helper_sent.insert(t)
state.msg_counter_objs = src_object.children[2].children[0].ids
state.draft_count = str(int(state.draft_count) + 1)
src_object.ids.sc16.clear_widgets()

View File

@ -2,9 +2,14 @@
Insert values into sent table
"""
import uuid
from helper_sql import sqlExecute
def insert(t):
"""Perform an insert into the `sent` table"""
msgid = uuid.uuid4().bytes
temp = list(t)
temp[0] = msgid
t = tuple(temp)
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)