implemented filter query in sent table on the bases of folder= 'sent'
This commit is contained in:
parent
b650e97edc
commit
30044f7516
|
@ -179,7 +179,7 @@ class singleCleaner(StoppableThread):
|
||||||
'Doing work necessary to again attempt to request a public key...'
|
'Doing work necessary to again attempt to request a public key...'
|
||||||
))
|
))
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='msgqueued' WHERE toaddress=?''',
|
'''UPDATE sent SET status='msgqueued' WHERE toaddress=? AND folder='sent' ''',
|
||||||
address)
|
address)
|
||||||
queues.workerQueue.put(('sendmessage', ''))
|
queues.workerQueue.put(('sendmessage', ''))
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class singleCleaner(StoppableThread):
|
||||||
' to our msg. Sending again.'
|
' to our msg. Sending again.'
|
||||||
)
|
)
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='msgqueued' WHERE ackdata=?''',
|
'''UPDATE sent SET status='msgqueued' WHERE ackdata=? AND folder='sent' ''',
|
||||||
ackdata)
|
ackdata)
|
||||||
queues.workerQueue.put(('sendmessage', ''))
|
queues.workerQueue.put(('sendmessage', ''))
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
|
|
|
@ -96,7 +96,7 @@ class singleWorker(StoppableThread):
|
||||||
|
|
||||||
# Initialize the state.ackdataForWhichImWatching data structure
|
# Initialize the state.ackdataForWhichImWatching data structure
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''SELECT ackdata FROM sent WHERE status = 'msgsent' ''')
|
'''SELECT ackdata FROM sent WHERE status = 'msgsent' AND folder = 'sent' ''')
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
ackdata, = row
|
ackdata, = row
|
||||||
self.logger.info('Watching for ackdata %s', hexlify(ackdata))
|
self.logger.info('Watching for ackdata %s', hexlify(ackdata))
|
||||||
|
@ -109,7 +109,7 @@ class singleWorker(StoppableThread):
|
||||||
newack = '\x00\x00\x00\x02\x01\x01' + oldack
|
newack = '\x00\x00\x00\x02\x01\x01' + oldack
|
||||||
state.ackdataForWhichImWatching[newack] = 0
|
state.ackdataForWhichImWatching[newack] = 0
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'UPDATE sent SET ackdata=? WHERE ackdata=?',
|
'UPDATE sent SET ackdata=? WHERE ackdata=? AND folder = "sent" ',
|
||||||
newack, oldack
|
newack, oldack
|
||||||
)
|
)
|
||||||
del state.ackdataForWhichImWatching[oldack]
|
del state.ackdataForWhichImWatching[oldack]
|
||||||
|
@ -522,7 +522,7 @@ class singleWorker(StoppableThread):
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='broadcastqueued' '''
|
'''UPDATE sent SET status='broadcastqueued' '''
|
||||||
|
|
||||||
'''WHERE status = 'doingbroadcastpow' ''')
|
'''WHERE status = 'doingbroadcastpow' AND folder = 'sent' ''')
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''SELECT fromaddress, subject, message, '''
|
'''SELECT fromaddress, subject, message, '''
|
||||||
''' ackdata, ttl, encodingtype FROM sent '''
|
''' ackdata, ttl, encodingtype FROM sent '''
|
||||||
|
@ -556,10 +556,12 @@ class singleWorker(StoppableThread):
|
||||||
))
|
))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
sqlExecute(
|
if not sqlExecute(
|
||||||
'''UPDATE sent SET status='doingbroadcastpow' '''
|
'''UPDATE sent SET status='doingbroadcastpow' '''
|
||||||
''' WHERE ackdata=? AND status='broadcastqueued' ''',
|
''' WHERE ackdata=? AND status='broadcastqueued' '''
|
||||||
ackdata)
|
''' AND folder='sent' ''',
|
||||||
|
ackdata):
|
||||||
|
continue
|
||||||
|
|
||||||
# At this time these pubkeys are 65 bytes long
|
# At this time these pubkeys are 65 bytes long
|
||||||
# because they include the encoding byte which we won't
|
# because they include the encoding byte which we won't
|
||||||
|
@ -681,7 +683,7 @@ class singleWorker(StoppableThread):
|
||||||
# a 'broadcastsent' status
|
# a 'broadcastsent' status
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'UPDATE sent SET msgid=?, status=?, lastactiontime=?'
|
'UPDATE sent SET msgid=?, status=?, lastactiontime=?'
|
||||||
' WHERE ackdata=?',
|
' WHERE ackdata=? AND folder="sent" ',
|
||||||
inventoryHash, 'broadcastsent', int(time.time()), ackdata
|
inventoryHash, 'broadcastsent', int(time.time()), ackdata
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -691,7 +693,8 @@ class singleWorker(StoppableThread):
|
||||||
# Reset just in case
|
# Reset just in case
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='msgqueued' '''
|
'''UPDATE sent SET status='msgqueued' '''
|
||||||
''' WHERE status IN ('doingpubkeypow', 'doingmsgpow')''')
|
''' WHERE status IN ('doingpubkeypow', 'doingmsgpow') '''
|
||||||
|
''' AND folder='sent' ''')
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''SELECT toaddress, fromaddress, subject, message, '''
|
'''SELECT toaddress, fromaddress, subject, message, '''
|
||||||
''' ackdata, status, ttl, retrynumber, encodingtype FROM '''
|
''' ackdata, status, ttl, retrynumber, encodingtype FROM '''
|
||||||
|
@ -727,11 +730,12 @@ class singleWorker(StoppableThread):
|
||||||
# we can calculate the needed pubkey using the private keys
|
# we can calculate the needed pubkey using the private keys
|
||||||
# in our keys.dat file.
|
# in our keys.dat file.
|
||||||
elif BMConfigParser().has_section(toaddress):
|
elif BMConfigParser().has_section(toaddress):
|
||||||
sqlExecute(
|
if not sqlExecute(
|
||||||
'''UPDATE sent SET status='doingmsgpow' '''
|
'''UPDATE sent SET status='doingmsgpow' '''
|
||||||
''' WHERE toaddress=? AND status='msgqueued' ''',
|
''' WHERE toaddress=? AND status='msgqueued' AND folder='sent' ''',
|
||||||
toaddress
|
toaddress
|
||||||
)
|
):
|
||||||
|
continue
|
||||||
status = 'doingmsgpow'
|
status = 'doingmsgpow'
|
||||||
elif status == 'msgqueued':
|
elif status == 'msgqueued':
|
||||||
# Let's see if we already have the pubkey in our pubkeys table
|
# Let's see if we already have the pubkey in our pubkeys table
|
||||||
|
@ -742,11 +746,12 @@ class singleWorker(StoppableThread):
|
||||||
# If we have the needed pubkey in the pubkey table already,
|
# If we have the needed pubkey in the pubkey table already,
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
# set the status of this msg to doingmsgpow
|
# set the status of this msg to doingmsgpow
|
||||||
sqlExecute(
|
if not sqlExecute(
|
||||||
'''UPDATE sent SET status='doingmsgpow' '''
|
'''UPDATE sent SET status='doingmsgpow' '''
|
||||||
''' WHERE toaddress=? AND status='msgqueued' ''',
|
''' WHERE toaddress=? AND status='msgqueued' AND folder='sent' ''',
|
||||||
toaddress
|
toaddress
|
||||||
)
|
):
|
||||||
|
continue
|
||||||
status = 'doingmsgpow'
|
status = 'doingmsgpow'
|
||||||
# mark the pubkey as 'usedpersonally' so that
|
# mark the pubkey as 'usedpersonally' so that
|
||||||
# we don't delete it later. If the pubkey version
|
# we don't delete it later. If the pubkey version
|
||||||
|
@ -829,7 +834,8 @@ class singleWorker(StoppableThread):
|
||||||
''' toaddress=? AND '''
|
''' toaddress=? AND '''
|
||||||
''' (status='msgqueued' or '''
|
''' (status='msgqueued' or '''
|
||||||
''' status='awaitingpubkey' or '''
|
''' status='awaitingpubkey' or '''
|
||||||
''' status='doingpubkeypow')''',
|
''' status='doingpubkeypow') AND '''
|
||||||
|
''' folder='sent' ''',
|
||||||
toaddress)
|
toaddress)
|
||||||
del state.neededPubkeys[tag]
|
del state.neededPubkeys[tag]
|
||||||
break
|
break
|
||||||
|
@ -846,7 +852,7 @@ class singleWorker(StoppableThread):
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET '''
|
'''UPDATE sent SET '''
|
||||||
''' status='doingpubkeypow' WHERE '''
|
''' status='doingpubkeypow' WHERE '''
|
||||||
''' toaddress=? AND status='msgqueued' ''',
|
''' toaddress=? AND status='msgqueued' AND folder='sent' ''',
|
||||||
toaddress
|
toaddress
|
||||||
)
|
)
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
|
@ -1039,7 +1045,7 @@ class singleWorker(StoppableThread):
|
||||||
# we are willing to do.
|
# we are willing to do.
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='toodifficult' '''
|
'''UPDATE sent SET status='toodifficult' '''
|
||||||
''' WHERE ackdata=? ''',
|
''' WHERE ackdata=? AND folder='sent' ''',
|
||||||
ackdata)
|
ackdata)
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateSentItemStatusByAckdata', (
|
'updateSentItemStatusByAckdata', (
|
||||||
|
@ -1187,7 +1193,7 @@ class singleWorker(StoppableThread):
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='badkey' WHERE ackdata=?''',
|
'''UPDATE sent SET status='badkey' WHERE ackdata=? AND folder='sent' ''',
|
||||||
ackdata
|
ackdata
|
||||||
)
|
)
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
|
@ -1292,13 +1298,12 @@ class singleWorker(StoppableThread):
|
||||||
newStatus = 'msgsent'
|
newStatus = 'msgsent'
|
||||||
# wait 10% past expiration
|
# wait 10% past expiration
|
||||||
sleepTill = int(time.time() + TTL * 1.1)
|
sleepTill = int(time.time() + TTL * 1.1)
|
||||||
sqlExecute(
|
au = sqlExecute(
|
||||||
'''UPDATE sent SET msgid=?, status=?, retrynumber=?, '''
|
'''UPDATE sent SET msgid=?, status=?, retrynumber=?, '''
|
||||||
''' sleeptill=?, lastactiontime=? WHERE ackdata=?''',
|
''' sleeptill=?, lastactiontime=? WHERE ackdata=? AND folder='sent' ''',
|
||||||
inventoryHash, newStatus, retryNumber + 1,
|
inventoryHash, newStatus, retryNumber + 1,
|
||||||
sleepTill, int(time.time()), ackdata
|
sleepTill, int(time.time()), ackdata
|
||||||
)
|
)
|
||||||
|
|
||||||
# If we are sending to ourselves or a chan, let's put
|
# If we are sending to ourselves or a chan, let's put
|
||||||
# the message in our own inbox.
|
# the message in our own inbox.
|
||||||
if BMConfigParser().has_section(toaddress):
|
if BMConfigParser().has_section(toaddress):
|
||||||
|
@ -1340,7 +1345,7 @@ class singleWorker(StoppableThread):
|
||||||
queryReturn = sqlQuery(
|
queryReturn = sqlQuery(
|
||||||
'''SELECT retrynumber FROM sent WHERE toaddress=? '''
|
'''SELECT retrynumber FROM sent WHERE toaddress=? '''
|
||||||
''' AND (status='doingpubkeypow' OR status='awaitingpubkey') '''
|
''' AND (status='doingpubkeypow' OR status='awaitingpubkey') '''
|
||||||
''' LIMIT 1''',
|
''' AND folder='sent' LIMIT 1''',
|
||||||
toAddress
|
toAddress
|
||||||
)
|
)
|
||||||
if not queryReturn:
|
if not queryReturn:
|
||||||
|
@ -1426,7 +1431,7 @@ class singleWorker(StoppableThread):
|
||||||
'''UPDATE sent SET lastactiontime=?, '''
|
'''UPDATE sent SET lastactiontime=?, '''
|
||||||
''' status='awaitingpubkey', retrynumber=?, sleeptill=? '''
|
''' status='awaitingpubkey', retrynumber=?, sleeptill=? '''
|
||||||
''' WHERE toaddress=? AND (status='doingpubkeypow' OR '''
|
''' WHERE toaddress=? AND (status='doingpubkeypow' OR '''
|
||||||
''' status='awaitingpubkey') ''',
|
''' status='awaitingpubkey') AND folder='sent' ''',
|
||||||
int(time.time()), retryNumber + 1, sleeptill, toAddress)
|
int(time.time()), retryNumber + 1, sleeptill, toAddress)
|
||||||
|
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
|
|
Reference in New Issue
Block a user