Message Expire #548

Merged
Atheros1 merged 17 commits from master into master 2013-11-06 05:47:19 +01:00
3 changed files with 48 additions and 2 deletions
Showing only changes of commit e1fc820226 - Show all commits

View File

@ -2036,6 +2036,23 @@ class MyForm(QtGui.QMainWindow):
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0:
shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float(
self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
#my implementation starts here,it was a line here
time_period = (int(str(self.settingsDialogInstance.ui.lineEditHours.text())) * 60 * 60 + int(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60 +
int(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)
if time_period < shared.maximumAgeOfAnObjectThatIAmWillingToAccept * 2:
QMessageBox.about(self, _translate("MainWindow", "Error"), _translate(
"MainWindow", "You must insert a time period longer than 5 days."))
shared.config.set('bitmessagesettings', 'hours', '0')
shared.config.set('bitmessagesettings', 'days', '5')
shared.config.set('bitmessagesettings', 'months', '0')
else:
shared.config.set('bitmessagesettings', 'hours', str(
self.settingsDialogInstance.ui.lineEditHours.text()))
shared.config.set('bitmessagesettings', 'days', str(
self.settingsDialogInstance.ui.lineEditDays.text()))
shared.config.set('bitmessagesettings', 'months', str(
self.settingsDialogInstance.ui.lineEditMonths.text()))
#my implementation stops here, there is a line
# if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All':
# shared.config.set('bitmessagesettings', 'maxcores', '99999')
@ -2964,7 +2981,7 @@ class settingsDialog(QtGui.QDialog):
self.ui.lineEditNamecoinPassword.setEnabled(False)
self.ui.labelNamecoinPassword.setEnabled(False)
else:
assert False
assert False
QtCore.QObject.connect(self.ui.radioButtonNamecoinNamecoind, QtCore.SIGNAL(
"toggled(bool)"), self.namecoinTypeChanged)
@ -2973,6 +2990,15 @@ class settingsDialog(QtGui.QDialog):
QtCore.QObject.connect(self.ui.pushButtonNamecoinTest, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonNamecoinTest)
#Adjust tab
self.ui.lineEditHours.setText(str(
shared.config.get('bitmessagesettings', 'hours')))
self.ui.lineEditDays.setText(str(
shared.config.get('bitmessagesettings', 'days')))
self.ui.lineEditMonths.setText(str(
shared.config.get('bitmessagesettings', 'months')))
#'System' tab removed for now.
"""try:
maxCores = shared.config.getint('bitmessagesettings', 'maxcores')

View File

@ -256,6 +256,19 @@ class sqlThread(threading.Thread):
# Are you hoping to add a new option to the keys.dat file of existing
# Bitmessage users? Add it right above this line!
#my new implementation starts here
if shared.config.getint('bitmessagesettings', 'settingsversion') == 6:
shared.config.set(
'bitmessagesettings', 'hours', '0')
shared.config.set(
'bitmessagesettings', 'days', '5')
shared.config.set(
'bitmessagesettings', 'months', '0')
shared.config.set('bitmessagesettings', 'settingsversion', '7')
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
#my new implementation stops here
try:
testpayload = '\x00\x00'
t = ('1234', testpayload, '12345678', 'no')

View File

@ -84,12 +84,19 @@ def loadConfig():
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0')
shared.config.set('bitmessagesettings', 'dontconnect', 'true')
shared.config.set('bitmessagesettings', 'userlocale', 'system')
# Are you hoping to add a new option to the keys.dat file? You're in
# the right place for adding it to users who install the software for
# the first time. But you must also add it to the keys.dat file of
# existing users. To do that, search the class_sqlThread.py file for the
# text: "right above this line!"
shared.config.set(
'bitmessagesettings', 'hours', '0')
shared.config.set(
'bitmessagesettings', 'days', '5')
shared.config.set(
'bitmessagesettings', 'months', '0')
ensureNamecoinOptions()