Protect stopresending* settings from being overriden by zeroes
when lineEditDays and lineEditMonths is blank. Fixes: #1558.
This commit is contained in:
parent
ff1f451691
commit
31fc899060
|
@ -473,6 +473,8 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
" WHERE status='toodifficult'")
|
" WHERE status='toodifficult'")
|
||||||
queues.workerQueue.put(('sendmessage', ''))
|
queues.workerQueue.put(('sendmessage', ''))
|
||||||
|
|
||||||
|
stopResendingDefaults = False
|
||||||
|
|
||||||
# UI setting to stop trying to send messages after X days/months
|
# UI setting to stop trying to send messages after X days/months
|
||||||
# I'm open to changing this UI to something else if someone has a better idea.
|
# I'm open to changing this UI to something else if someone has a better idea.
|
||||||
if self.lineEditDays.text() == '' and self.lineEditMonths.text() == '':
|
if self.lineEditDays.text() == '' and self.lineEditMonths.text() == '':
|
||||||
|
@ -481,6 +483,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
self.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
|
self.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
|
||||||
self.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
|
self.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
||||||
|
stopResendingDefaults = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
days = float(self.lineEditDays.text())
|
days = float(self.lineEditDays.text())
|
||||||
|
@ -493,7 +496,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
self.lineEditMonths.setText("0")
|
self.lineEditMonths.setText("0")
|
||||||
months = 0.0
|
months = 0.0
|
||||||
|
|
||||||
if days >= 0 and months >= 0:
|
if days >= 0 and months >= 0 and not stopResendingDefaults:
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = \
|
shared.maximumLengthOfTimeToBotherResendingMessages = \
|
||||||
days * 24 * 60 * 60 + months * 60 * 60 * 24 * 365 / 12
|
days * 24 * 60 * 60 + months * 60 * 60 * 24 * 365 / 12
|
||||||
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
|
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
|
||||||
|
|
Reference in New Issue
Block a user