commit
793b8a87e9
|
@ -2165,6 +2165,41 @@ 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)))
|
||||
#start: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.
|
||||
if ((self.settingsDialogInstance.ui.lineEditDays.text()=='') and (self.settingsDialogInstance.ui.lineEditMonths.text()=='')):#We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
|
||||
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
||||
try:
|
||||
float(self.settingsDialogInstance.ui.lineEditDays.text())
|
||||
lineEditDaysIsValidFloat = True
|
||||
except:
|
||||
lineEditDaysIsValidFloat = False
|
||||
try:
|
||||
float(self.settingsDialogInstance.ui.lineEditMonths.text())
|
||||
lineEditMonthsIsValidFloat = True
|
||||
except:
|
||||
lineEditMonthsIsValidFloat = False
|
||||
if lineEditDaysIsValidFloat and not lineEditMonthsIsValidFloat:
|
||||
self.settingsDialogInstance.ui.lineEditMonths.setText("0")
|
||||
if lineEditMonthsIsValidFloat and not lineEditDaysIsValidFloat:
|
||||
self.settingsDialogInstance.ui.lineEditDays.setText("0")
|
||||
if lineEditDaysIsValidFloat or lineEditMonthsIsValidFloat:
|
||||
if (float(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0):
|
||||
shared.maximumLengthOfTimeToBotherResendingMessages = (float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60) + (float(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)
|
||||
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000: # If the time period is less than 5 hours, we give zero values to all fields. No message will be sent again.
|
||||
QMessageBox.about(self, _translate("MainWindow", "Will not resend ever"), _translate(
|
||||
"MainWindow", "Note that the time limit you entered is less than the amount of time Bitmessage waits for the first resend attempt therefore your messages will never be resent."))
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxdays', '0')
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxmonths', '0')
|
||||
shared.maximumLengthOfTimeToBotherResendingMessages = 0
|
||||
else:
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxdays', str(float(
|
||||
self.settingsDialogInstance.ui.lineEditDays.text())))
|
||||
shared.config.set('bitmessagesettings', 'stopresendingafterxmonths', str(float(
|
||||
self.settingsDialogInstance.ui.lineEditMonths.text())))
|
||||
#end
|
||||
|
||||
# if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All':
|
||||
# shared.config.set('bitmessagesettings', 'maxcores', '99999')
|
||||
|
@ -3233,6 +3268,13 @@ class settingsDialog(QtGui.QDialog):
|
|||
QtCore.QObject.connect(self.ui.pushButtonNamecoinTest, QtCore.SIGNAL(
|
||||
"clicked()"), self.click_pushButtonNamecoinTest)
|
||||
|
||||
#Message Resend tab
|
||||
self.ui.lineEditDays.setText(str(
|
||||
shared.config.get('bitmessagesettings', 'stopresendingafterxdays')))
|
||||
self.ui.lineEditMonths.setText(str(
|
||||
shared.config.get('bitmessagesettings', 'stopresendingafterxmonths')))
|
||||
|
||||
|
||||
#'System' tab removed for now.
|
||||
"""try:
|
||||
maxCores = shared.config.getint('bitmessagesettings', 'maxcores')
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'settings.ui'
|
||||
#
|
||||
# Created: Sat Nov 2 18:03:44 2013
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Tue Nov 05 22:56:35 2013
|
||||
# by: PyQt4 UI code generator 4.10.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -26,7 +26,7 @@ except AttributeError:
|
|||
class Ui_settingsDialog(object):
|
||||
def setupUi(self, settingsDialog):
|
||||
settingsDialog.setObjectName(_fromUtf8("settingsDialog"))
|
||||
settingsDialog.resize(585, 437)
|
||||
settingsDialog.resize(521, 399)
|
||||
self.gridLayout = QtGui.QGridLayout(settingsDialog)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
|
||||
|
@ -160,21 +160,42 @@ class Ui_settingsDialog(object):
|
|||
spacerItem1 = QtGui.QSpacerItem(20, 70, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_4.addItem(spacerItem1, 2, 0, 1, 1)
|
||||
self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8(""))
|
||||
self.tab = QtGui.QWidget()
|
||||
self.tab.setObjectName(_fromUtf8("tab"))
|
||||
self.gridLayout_6 = QtGui.QGridLayout(self.tab)
|
||||
self.tabDemandedDifficulty = QtGui.QWidget()
|
||||
self.tabDemandedDifficulty.setObjectName(_fromUtf8("tabDemandedDifficulty"))
|
||||
self.gridLayout_6 = QtGui.QGridLayout(self.tabDemandedDifficulty)
|
||||
self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6"))
|
||||
self.label_8 = QtGui.QLabel(self.tab)
|
||||
self.label_9 = QtGui.QLabel(self.tabDemandedDifficulty)
|
||||
self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_9.setObjectName(_fromUtf8("label_9"))
|
||||
self.gridLayout_6.addWidget(self.label_9, 1, 1, 1, 1)
|
||||
self.label_10 = QtGui.QLabel(self.tabDemandedDifficulty)
|
||||
self.label_10.setWordWrap(True)
|
||||
self.label_10.setObjectName(_fromUtf8("label_10"))
|
||||
self.gridLayout_6.addWidget(self.label_10, 2, 0, 1, 3)
|
||||
self.label_11 = QtGui.QLabel(self.tabDemandedDifficulty)
|
||||
self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_11.setObjectName(_fromUtf8("label_11"))
|
||||
self.gridLayout_6.addWidget(self.label_11, 3, 1, 1, 1)
|
||||
self.label_8 = QtGui.QLabel(self.tabDemandedDifficulty)
|
||||
self.label_8.setWordWrap(True)
|
||||
self.label_8.setObjectName(_fromUtf8("label_8"))
|
||||
self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3)
|
||||
spacerItem2 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_6.addItem(spacerItem2, 1, 0, 1, 1)
|
||||
self.label_9 = QtGui.QLabel(self.tab)
|
||||
self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_9.setObjectName(_fromUtf8("label_9"))
|
||||
self.gridLayout_6.addWidget(self.label_9, 1, 1, 1, 1)
|
||||
self.lineEditTotalDifficulty = QtGui.QLineEdit(self.tab)
|
||||
self.label_12 = QtGui.QLabel(self.tabDemandedDifficulty)
|
||||
self.label_12.setWordWrap(True)
|
||||
self.label_12.setObjectName(_fromUtf8("label_12"))
|
||||
self.gridLayout_6.addWidget(self.label_12, 4, 0, 1, 3)
|
||||
self.lineEditSmallMessageDifficulty = QtGui.QLineEdit(self.tabDemandedDifficulty)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.lineEditSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
||||
self.lineEditSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
||||
self.lineEditSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||
self.lineEditSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditSmallMessageDifficulty"))
|
||||
self.gridLayout_6.addWidget(self.lineEditSmallMessageDifficulty, 3, 2, 1, 1)
|
||||
self.lineEditTotalDifficulty = QtGui.QLineEdit(self.tabDemandedDifficulty)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -185,44 +206,25 @@ class Ui_settingsDialog(object):
|
|||
self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1)
|
||||
spacerItem3 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_6.addItem(spacerItem3, 3, 0, 1, 1)
|
||||
self.label_11 = QtGui.QLabel(self.tab)
|
||||
self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_11.setObjectName(_fromUtf8("label_11"))
|
||||
self.gridLayout_6.addWidget(self.label_11, 3, 1, 1, 1)
|
||||
self.lineEditSmallMessageDifficulty = QtGui.QLineEdit(self.tab)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.lineEditSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
||||
self.lineEditSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
||||
self.lineEditSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||
self.lineEditSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditSmallMessageDifficulty"))
|
||||
self.gridLayout_6.addWidget(self.lineEditSmallMessageDifficulty, 3, 2, 1, 1)
|
||||
self.label_12 = QtGui.QLabel(self.tab)
|
||||
self.label_12.setWordWrap(True)
|
||||
self.label_12.setObjectName(_fromUtf8("label_12"))
|
||||
self.gridLayout_6.addWidget(self.label_12, 4, 0, 1, 3)
|
||||
self.label_10 = QtGui.QLabel(self.tab)
|
||||
self.label_10.setWordWrap(True)
|
||||
self.label_10.setObjectName(_fromUtf8("label_10"))
|
||||
self.gridLayout_6.addWidget(self.label_10, 2, 0, 1, 3)
|
||||
self.tabWidgetSettings.addTab(self.tab, _fromUtf8(""))
|
||||
self.tab_2 = QtGui.QWidget()
|
||||
self.tab_2.setObjectName(_fromUtf8("tab_2"))
|
||||
self.gridLayout_7 = QtGui.QGridLayout(self.tab_2)
|
||||
spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_6.addItem(spacerItem4, 5, 0, 1, 1)
|
||||
self.tabWidgetSettings.addTab(self.tabDemandedDifficulty, _fromUtf8(""))
|
||||
self.tabMaxAcceptableDifficulty = QtGui.QWidget()
|
||||
self.tabMaxAcceptableDifficulty.setObjectName(_fromUtf8("tabMaxAcceptableDifficulty"))
|
||||
self.gridLayout_7 = QtGui.QGridLayout(self.tabMaxAcceptableDifficulty)
|
||||
self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
|
||||
self.label_15 = QtGui.QLabel(self.tab_2)
|
||||
self.label_15 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
||||
self.label_15.setWordWrap(True)
|
||||
self.label_15.setObjectName(_fromUtf8("label_15"))
|
||||
self.gridLayout_7.addWidget(self.label_15, 0, 0, 1, 3)
|
||||
spacerItem4 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_7.addItem(spacerItem4, 1, 0, 1, 1)
|
||||
self.label_13 = QtGui.QLabel(self.tab_2)
|
||||
spacerItem5 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_7.addItem(spacerItem5, 1, 0, 1, 1)
|
||||
self.label_13 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
||||
self.label_13.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_13.setObjectName(_fromUtf8("label_13"))
|
||||
self.gridLayout_7.addWidget(self.label_13, 1, 1, 1, 1)
|
||||
self.lineEditMaxAcceptableTotalDifficulty = QtGui.QLineEdit(self.tab_2)
|
||||
self.lineEditMaxAcceptableTotalDifficulty = QtGui.QLineEdit(self.tabMaxAcceptableDifficulty)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -231,13 +233,13 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||
self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty"))
|
||||
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableTotalDifficulty, 1, 2, 1, 1)
|
||||
spacerItem5 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_7.addItem(spacerItem5, 2, 0, 1, 1)
|
||||
self.label_14 = QtGui.QLabel(self.tab_2)
|
||||
spacerItem6 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_7.addItem(spacerItem6, 2, 0, 1, 1)
|
||||
self.label_14 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
||||
self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_14.setObjectName(_fromUtf8("label_14"))
|
||||
self.gridLayout_7.addWidget(self.label_14, 2, 1, 1, 1)
|
||||
self.lineEditMaxAcceptableSmallMessageDifficulty = QtGui.QLineEdit(self.tab_2)
|
||||
self.lineEditMaxAcceptableSmallMessageDifficulty = QtGui.QLineEdit(self.tabMaxAcceptableDifficulty)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -246,15 +248,15 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||
self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty"))
|
||||
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableSmallMessageDifficulty, 2, 2, 1, 1)
|
||||
spacerItem6 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_7.addItem(spacerItem6, 3, 1, 1, 1)
|
||||
self.tabWidgetSettings.addTab(self.tab_2, _fromUtf8(""))
|
||||
spacerItem7 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_7.addItem(spacerItem7, 3, 1, 1, 1)
|
||||
self.tabWidgetSettings.addTab(self.tabMaxAcceptableDifficulty, _fromUtf8(""))
|
||||
self.tabNamecoin = QtGui.QWidget()
|
||||
self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin"))
|
||||
self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin)
|
||||
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
|
||||
spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem7, 2, 0, 1, 1)
|
||||
spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem8, 2, 0, 1, 1)
|
||||
self.label_16 = QtGui.QLabel(self.tabNamecoin)
|
||||
self.label_16.setWordWrap(True)
|
||||
self.label_16.setObjectName(_fromUtf8("label_16"))
|
||||
|
@ -266,10 +268,10 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin)
|
||||
self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost"))
|
||||
self.gridLayout_8.addWidget(self.lineEditNamecoinHost, 2, 2, 1, 1)
|
||||
spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem8, 3, 0, 1, 1)
|
||||
spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem9, 4, 0, 1, 1)
|
||||
self.gridLayout_8.addItem(spacerItem9, 3, 0, 1, 1)
|
||||
spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem10, 4, 0, 1, 1)
|
||||
self.label_18 = QtGui.QLabel(self.tabNamecoin)
|
||||
self.label_18.setEnabled(True)
|
||||
self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
|
@ -278,8 +280,8 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin)
|
||||
self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort"))
|
||||
self.gridLayout_8.addWidget(self.lineEditNamecoinPort, 3, 2, 1, 1)
|
||||
spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_8.addItem(spacerItem10, 8, 1, 1, 1)
|
||||
spacerItem11 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_8.addItem(spacerItem11, 8, 1, 1, 1)
|
||||
self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin)
|
||||
self.labelNamecoinUser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.labelNamecoinUser.setObjectName(_fromUtf8("labelNamecoinUser"))
|
||||
|
@ -287,8 +289,8 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin)
|
||||
self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser"))
|
||||
self.gridLayout_8.addWidget(self.lineEditNamecoinUser, 4, 2, 1, 1)
|
||||
spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem11, 5, 0, 1, 1)
|
||||
spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_8.addItem(spacerItem12, 5, 0, 1, 1)
|
||||
self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin)
|
||||
self.labelNamecoinPassword.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.labelNamecoinPassword.setObjectName(_fromUtf8("labelNamecoinPassword"))
|
||||
|
@ -318,6 +320,43 @@ class Ui_settingsDialog(object):
|
|||
self.horizontalLayout.addWidget(self.radioButtonNamecoinNmcontrol)
|
||||
self.gridLayout_8.addLayout(self.horizontalLayout, 1, 0, 1, 3)
|
||||
self.tabWidgetSettings.addTab(self.tabNamecoin, _fromUtf8(""))
|
||||
self.tabResendsExpire = QtGui.QWidget()
|
||||
self.tabResendsExpire.setObjectName(_fromUtf8("tabResendsExpire"))
|
||||
self.gridLayout_5 = QtGui.QGridLayout(self.tabResendsExpire)
|
||||
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
|
||||
self.label_7 = QtGui.QLabel(self.tabResendsExpire)
|
||||
self.label_7.setWordWrap(True)
|
||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
||||
self.gridLayout_5.addWidget(self.label_7, 0, 0, 1, 3)
|
||||
spacerItem13 = QtGui.QSpacerItem(212, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout_5.addItem(spacerItem13, 1, 0, 1, 1)
|
||||
self.widget = QtGui.QWidget(self.tabResendsExpire)
|
||||
self.widget.setMinimumSize(QtCore.QSize(231, 75))
|
||||
self.widget.setObjectName(_fromUtf8("widget"))
|
||||
self.label_19 = QtGui.QLabel(self.widget)
|
||||
self.label_19.setGeometry(QtCore.QRect(10, 20, 101, 20))
|
||||
self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_19.setObjectName(_fromUtf8("label_19"))
|
||||
self.label_20 = QtGui.QLabel(self.widget)
|
||||
self.label_20.setGeometry(QtCore.QRect(30, 40, 80, 16))
|
||||
self.label_20.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_20.setObjectName(_fromUtf8("label_20"))
|
||||
self.lineEditDays = QtGui.QLineEdit(self.widget)
|
||||
self.lineEditDays.setGeometry(QtCore.QRect(113, 20, 51, 20))
|
||||
self.lineEditDays.setObjectName(_fromUtf8("lineEditDays"))
|
||||
self.lineEditMonths = QtGui.QLineEdit(self.widget)
|
||||
self.lineEditMonths.setGeometry(QtCore.QRect(113, 40, 51, 20))
|
||||
self.lineEditMonths.setObjectName(_fromUtf8("lineEditMonths"))
|
||||
self.label_22 = QtGui.QLabel(self.widget)
|
||||
self.label_22.setGeometry(QtCore.QRect(169, 23, 61, 16))
|
||||
self.label_22.setObjectName(_fromUtf8("label_22"))
|
||||
self.label_23 = QtGui.QLabel(self.widget)
|
||||
self.label_23.setGeometry(QtCore.QRect(170, 41, 71, 16))
|
||||
self.label_23.setObjectName(_fromUtf8("label_23"))
|
||||
self.gridLayout_5.addWidget(self.widget, 1, 2, 1, 1)
|
||||
spacerItem14 = QtGui.QSpacerItem(20, 129, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_5.addItem(spacerItem14, 2, 1, 1, 1)
|
||||
self.tabWidgetSettings.addTab(self.tabResendsExpire, _fromUtf8(""))
|
||||
self.gridLayout.addWidget(self.tabWidgetSettings, 0, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(settingsDialog)
|
||||
|
@ -375,16 +414,16 @@ class Ui_settingsDialog(object):
|
|||
self.comboBoxProxyType.setItemText(1, _translate("settingsDialog", "SOCKS4a", None))
|
||||
self.comboBoxProxyType.setItemText(2, _translate("settingsDialog", "SOCKS5", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNetworkSettings), _translate("settingsDialog", "Network Settings", None))
|
||||
self.label_8.setText(_translate("settingsDialog", "When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. ", None))
|
||||
self.label_9.setText(_translate("settingsDialog", "Total difficulty:", None))
|
||||
self.label_11.setText(_translate("settingsDialog", "Small message difficulty:", None))
|
||||
self.label_12.setText(_translate("settingsDialog", "The \'Small message difficulty\' mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn\'t really affect large messages.", None))
|
||||
self.label_10.setText(_translate("settingsDialog", "The \'Total difficulty\' affects the absolute amount of work the sender must complete. Doubling this value doubles the amount of work.", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tab), _translate("settingsDialog", "Demanded difficulty", None))
|
||||
self.label_11.setText(_translate("settingsDialog", "Small message difficulty:", None))
|
||||
self.label_8.setText(_translate("settingsDialog", "When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. ", None))
|
||||
self.label_12.setText(_translate("settingsDialog", "The \'Small message difficulty\' mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn\'t really affect large messages.", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabDemandedDifficulty), _translate("settingsDialog", "Demanded difficulty", None))
|
||||
self.label_15.setText(_translate("settingsDialog", "Here you may set the maximum amount of work you are willing to do to send a message to another person. Setting these values to 0 means that any value is acceptable.", None))
|
||||
self.label_13.setText(_translate("settingsDialog", "Maximum acceptable total difficulty:", None))
|
||||
self.label_14.setText(_translate("settingsDialog", "Maximum acceptable small message difficulty:", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tab_2), _translate("settingsDialog", "Max acceptable difficulty", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabMaxAcceptableDifficulty), _translate("settingsDialog", "Max acceptable difficulty", None))
|
||||
self.label_16.setText(_translate("settingsDialog", "<html><head/><body><p>Bitmessage can utilize a different Bitcoin-based program called Namecoin to make addresses human-friendly. For example, instead of having to tell your friend your long Bitmessage address, you can simply tell him to send a message to <span style=\" font-style:italic;\">test. </span></p><p>(Getting your own Bitmessage address into Namecoin is still rather difficult).</p><p>Bitmessage can use either namecoind directly or a running nmcontrol instance.</p></body></html>", None))
|
||||
self.label_17.setText(_translate("settingsDialog", "Host:", None))
|
||||
self.label_18.setText(_translate("settingsDialog", "Port:", None))
|
||||
|
@ -395,5 +434,11 @@ class Ui_settingsDialog(object):
|
|||
self.radioButtonNamecoinNamecoind.setText(_translate("settingsDialog", "Namecoind", None))
|
||||
self.radioButtonNamecoinNmcontrol.setText(_translate("settingsDialog", "NMControl", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNamecoin), _translate("settingsDialog", "Namecoin integration", None))
|
||||
self.label_7.setText(_translate("settingsDialog", "<html><head/><body><p>By default, if you send a message to someone and he is offline for more than two days, Bitmessage will send the message again after an additional two days. This will be continued with exponential backoff forever; messages will be resent after 5, 10, 20 days ect. until the receiver acknowledges them. Here you may change that behavior by having Bitmessage give up after a certain number of days or months.</p><p>Leave these input fields blank for the default behavior. </p></body></html>", None))
|
||||
self.label_19.setText(_translate("settingsDialog", "Give up after", None))
|
||||
self.label_20.setText(_translate("settingsDialog", "and", None))
|
||||
self.label_22.setText(_translate("settingsDialog", "days", None))
|
||||
self.label_23.setText(_translate("settingsDialog", "months.", None))
|
||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabResendsExpire), _translate("settingsDialog", "Resends Expire", None))
|
||||
|
||||
import bitmessage_icons_rc
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>585</width>
|
||||
<height>437</height>
|
||||
<width>521</width>
|
||||
<height>399</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -333,11 +333,41 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<widget class="QWidget" name="tabDemandedDifficulty">
|
||||
<attribute name="title">
|
||||
<string>Demanded difficulty</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Total difficulty:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>The 'Total difficulty' affects the absolute amount of work the sender must complete. Doubling this value doubles the amount of work.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Small message difficulty:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
|
@ -361,13 +391,29 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Total difficulty:</string>
|
||||
<string>The 'Small message difficulty' mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn't really affect large messages.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="lineEditSmallMessageDifficulty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -400,55 +446,22 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Small message difficulty:</string>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="lineEditSmallMessageDifficulty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>The 'Small message difficulty' mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn't really affect large messages.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>The 'Total difficulty' affects the absolute amount of work the sender must complete. Doubling this value doubles the amount of work.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="tabMaxAcceptableDifficulty">
|
||||
<attribute name="title">
|
||||
<string>Max acceptable difficulty</string>
|
||||
</attribute>
|
||||
|
@ -742,6 +755,137 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabResendsExpire">
|
||||
<attribute name="title">
|
||||
<string>Resends Expire</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>By default, if you send a message to someone and he is offline for more than two days, Bitmessage will send the message again after an additional two days. This will be continued with exponential backoff forever; messages will be resent after 5, 10, 20 days ect. until the receiver acknowledges them. Here you may change that behavior by having Bitmessage give up after a certain number of days or months.</p><p>Leave these input fields blank for the default behavior. </p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>212</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>231</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>101</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Give up after</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>and</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEditDays">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>113</x>
|
||||
<y>20</y>
|
||||
<width>51</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEditMonths">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>113</x>
|
||||
<y>40</y>
|
||||
<width>51</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>169</x>
|
||||
<y>23</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>days</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>41</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>months.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -10,16 +10,16 @@ from debug import logger
|
|||
|
||||
'''The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy.
|
||||
It cleans these data structures in memory:
|
||||
inventory (moves data to the on-disk sql database)
|
||||
inventorySets (clears then reloads data out of sql database)
|
||||
inventory (moves data to the on-disk sql database)
|
||||
inventorySets (clears then reloads data out of sql database)
|
||||
|
||||
It cleans these tables on the disk:
|
||||
inventory (clears data more than 2 days and 12 hours old)
|
||||
pubkeys (clears pubkeys older than 4 weeks old which we have not used personally)
|
||||
inventory (clears data more than 2 days and 12 hours old)
|
||||
pubkeys (clears pubkeys older than 4 weeks old which we have not used personally)
|
||||
|
||||
It resends messages when there has been no response:
|
||||
resends getpubkey messages in 4 days (then 8 days, then 16 days, etc...)
|
||||
resends msg messages in 4 days (then 8 days, then 16 days, etc...)
|
||||
resends getpubkey messages in 5 days (then 10 days, then 20 days, etc...)
|
||||
resends msg messages in 5 days (then 10 days, then 20 days, etc...)
|
||||
|
||||
'''
|
||||
|
||||
|
@ -31,11 +31,16 @@ class singleCleaner(threading.Thread):
|
|||
|
||||
def run(self):
|
||||
timeWeLastClearedInventoryAndPubkeysTables = 0
|
||||
try:
|
||||
shared.maximumLengthOfTimeToBotherResendingMessages = (float(shared.config.get('bitmessagesettings', 'stopresendingafterxdays')) * 24 * 60 * 60) + (float(shared.config.get('bitmessagesettings', 'stopresendingafterxmonths')) * (60 * 60 * 24 *365)/12)
|
||||
except:
|
||||
# Either the user hasn't set stopresendingafterxdays and stopresendingafterxmonths yet or the options are missing from the config file.
|
||||
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
||||
|
||||
while True:
|
||||
shared.UISignalQueue.put((
|
||||
'updateStatusBar', 'Doing housekeeping (Flushing inventory in memory to disk...)'))
|
||||
|
||||
|
||||
with shared.inventoryLock: # If you use both the inventoryLock and the sqlLock, always use the inventoryLock OUTSIDE of the sqlLock.
|
||||
with SqlBulkExecute() as sql:
|
||||
for hash, storedValue in shared.inventory.items():
|
||||
|
@ -52,7 +57,7 @@ class singleCleaner(threading.Thread):
|
|||
del shared.inventory[hash]
|
||||
shared.UISignalQueue.put(('updateStatusBar', ''))
|
||||
shared.broadcastToSendDataQueues((
|
||||
0, 'pong', 'no data')) # commands the sendData threads to send out a pong message if they haven't sent anything else in the last five minutes. The socket timeout-time is 10 minutes.
|
||||
0, 'pong', 'no data')) # commands the sendData threads to send out a pong message if they haven't sent anything else in the last five minutes. The socket timeout-time is 10 minutes.
|
||||
# If we are running as a daemon then we are going to fill up the UI
|
||||
# queue which will never be handled by a UI. We should clear it to
|
||||
# save memory.
|
||||
|
@ -65,7 +70,7 @@ class singleCleaner(threading.Thread):
|
|||
# inventory (clears pubkeys after 28 days and everything else
|
||||
# after 2 days and 12 hours)
|
||||
sqlExecute(
|
||||
'''DELETE FROM inventory WHERE (receivedtime<? AND objecttype<>'pubkey') OR (receivedtime<? AND objecttype='pubkey') ''',
|
||||
'''DELETE FROM inventory WHERE (receivedtime<? AND objecttype<>'pubkey') OR (receivedtime<? AND objecttype='pubkey') ''',
|
||||
int(time.time()) - shared.lengthOfTimeToLeaveObjectsInInventory,
|
||||
int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys)
|
||||
|
||||
|
@ -75,7 +80,8 @@ class singleCleaner(threading.Thread):
|
|||
int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys)
|
||||
|
||||
queryreturn = sqlQuery(
|
||||
'''select toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber FROM sent WHERE ((status='awaitingpubkey' OR status='msgsent') AND folder='sent') ''') # If the message's folder='trash' then we'll ignore it.
|
||||
'''select toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber FROM sent WHERE ((status='awaitingpubkey' OR status='msgsent') AND folder='sent' AND lastactiontime>?) ''',
|
||||
int(time.time()) - shared.maximumLengthOfTimeToBotherResendingMessages) # If the message's folder='trash' then we'll ignore it.
|
||||
for row in queryreturn:
|
||||
if len(row) < 5:
|
||||
with shared.printLock:
|
||||
|
@ -86,36 +92,12 @@ class singleCleaner(threading.Thread):
|
|||
break
|
||||
toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber = row
|
||||
if status == 'awaitingpubkey':
|
||||
if int(time.time()) - lastactiontime > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (pubkeyretrynumber))):
|
||||
print 'It has been a long time and we haven\'t heard a response to our getpubkey request. Sending again.'
|
||||
try:
|
||||
del shared.neededPubkeys[
|
||||
toripe] # We need to take this entry out of the shared.neededPubkeys structure because the shared.workerQueue checks to see whether the entry is already present and will not do the POW and send the message because it assumes that it has already done it recently.
|
||||
except:
|
||||
pass
|
||||
if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (pubkeyretrynumber))):
|
||||
resendPubkey(pubkeyretrynumber,toripe)
|
||||
else: # status == msgsent
|
||||
if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))):
|
||||
resendMsg(msgretrynumber,ackdata)
|
||||
|
||||
shared.UISignalQueue.put((
|
||||
'updateStatusBar', 'Doing work necessary to again attempt to request a public key...'))
|
||||
t = ()
|
||||
sqlExecute(
|
||||
'''UPDATE sent SET lastactiontime=?, pubkeyretrynumber=?, status='msgqueued' WHERE toripe=?''',
|
||||
int(time.time()),
|
||||
pubkeyretrynumber + 1,
|
||||
toripe)
|
||||
shared.workerQueue.put(('sendmessage', ''))
|
||||
else: # status == msgsent
|
||||
if int(time.time()) - lastactiontime > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))):
|
||||
print 'It has been a long time and we haven\'t heard an acknowledgement to our msg. Sending again.'
|
||||
sqlExecute(
|
||||
'''UPDATE sent SET lastactiontime=?, msgretrynumber=?, status=? WHERE ackdata=?''',
|
||||
int(time.time()),
|
||||
msgretrynumber + 1,
|
||||
'msgqueued',
|
||||
ackdata)
|
||||
shared.workerQueue.put(('sendmessage', ''))
|
||||
shared.UISignalQueue.put((
|
||||
'updateStatusBar', 'Doing work necessary to again attempt to deliver a message...'))
|
||||
|
||||
# Let's also clear and reload shared.inventorySets to keep it from
|
||||
# taking up an unnecessary amount of memory.
|
||||
for streamNumber in shared.inventorySets:
|
||||
|
@ -145,3 +127,34 @@ class singleCleaner(threading.Thread):
|
|||
shared.knownNodesLock.release()
|
||||
shared.needToWriteKnownNodesToDisk = False
|
||||
time.sleep(300)
|
||||
|
||||
|
||||
def resendPubkey(pubkeyretrynumber,toripe):
|
||||
print 'It has been a long time and we haven\'t heard a response to our getpubkey request. Sending again.'
|
||||
try:
|
||||
del shared.neededPubkeys[
|
||||
toripe] # We need to take this entry out of the shared.neededPubkeys structure because the shared.workerQueue checks to see whether the entry is already present and will not do the POW and send the message because it assumes that it has already done it recently.
|
||||
except:
|
||||
pass
|
||||
|
||||
shared.UISignalQueue.put((
|
||||
'updateStatusBar', 'Doing work necessary to again attempt to request a public key...'))
|
||||
t = ()
|
||||
sqlExecute(
|
||||
'''UPDATE sent SET lastactiontime=?, pubkeyretrynumber=?, status='msgqueued' WHERE toripe=?''',
|
||||
int(time.time()),
|
||||
pubkeyretrynumber + 1,
|
||||
toripe)
|
||||
shared.workerQueue.put(('sendmessage', ''))
|
||||
|
||||
def resendMsg(msgretrynumber,ackdata):
|
||||
print 'It has been a long time and we haven\'t heard an acknowledgement to our msg. Sending again.'
|
||||
sqlExecute(
|
||||
'''UPDATE sent SET lastactiontime=?, msgretrynumber=?, status=? WHERE ackdata=?''',
|
||||
int(time.time()),
|
||||
msgretrynumber + 1,
|
||||
'msgqueued',
|
||||
ackdata)
|
||||
shared.workerQueue.put(('sendmessage', ''))
|
||||
shared.UISignalQueue.put((
|
||||
'updateStatusBar', 'Doing work necessary to again attempt to deliver a message...'))
|
||||
|
|
|
@ -279,6 +279,17 @@ class sqlThread(threading.Thread):
|
|||
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
||||
shared.config.write(configfile)
|
||||
|
||||
#Adjusting time period to stop sending messages
|
||||
if shared.config.getint('bitmessagesettings', 'settingsversion') == 7:
|
||||
shared.config.set(
|
||||
'bitmessagesettings', 'stopresendingafterxdays', '')
|
||||
shared.config.set(
|
||||
'bitmessagesettings', 'stopresendingafterxmonths', '')
|
||||
#shared.config.set(
|
||||
shared.config.set('bitmessagesettings', 'settingsversion', '8')
|
||||
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
||||
shared.config.write(configfile)
|
||||
|
||||
# Are you hoping to add a new option to the keys.dat file of existing
|
||||
# Bitmessage users? Add it right above this line!
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ def knownNodes():
|
|||
shared.knownNodes[stream][peer] = time
|
||||
except:
|
||||
shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
|
||||
if shared.config.getint('bitmessagesettings', 'settingsversion') > 7:
|
||||
if shared.config.getint('bitmessagesettings', 'settingsversion') > 8:
|
||||
print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
|
||||
raise SystemExit
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ def loadConfig():
|
|||
# This appears to be the first time running the program; there is
|
||||
# no config file (or it cannot be accessed). Create config file.
|
||||
shared.config.add_section('bitmessagesettings')
|
||||
shared.config.set('bitmessagesettings', 'settingsversion', '7')
|
||||
shared.config.set('bitmessagesettings', 'settingsversion', '8')
|
||||
shared.config.set('bitmessagesettings', 'port', '8444')
|
||||
shared.config.set(
|
||||
'bitmessagesettings', 'timeformat', '%%a, %%d %%b %%Y %%I:%%M %%p')
|
||||
|
@ -88,6 +88,15 @@ def loadConfig():
|
|||
shared.config.set('bitmessagesettings', 'userlocale', 'system')
|
||||
shared.config.set('bitmessagesettings', 'useidenticons', 'True')
|
||||
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
|
||||
|
||||
#start:UI setting to stop trying to send messages after X days/months
|
||||
shared.config.set(
|
||||
'bitmessagesettings', 'stopresendingafterxdays', '')
|
||||
shared.config.set(
|
||||
'bitmessagesettings', 'stopresendingafterxmonths', '')
|
||||
#shared.config.set(
|
||||
# 'bitmessagesettings', 'timeperiod', '-1')
|
||||
#end
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
softwareVersion = '0.4.1'
|
||||
verbose = 1
|
||||
maximumAgeOfAnObjectThatIAmWillingToAccept = 216000 # Equals two days and 12 hours.
|
||||
lengthOfTimeToLeaveObjectsInInventory = 237600 # Equals two days and 18 hours. This should be longer than maximumAgeOfAnObjectThatIAmWillingToAccept so that we don't process messages twice.
|
||||
lengthOfTimeToLeaveObjectsInInventory = 237600 # Equals two days and 18 hours. This should be longer than maximumAgeOfAnObjectThatIAmWillingToAccept so that we don't process messages twice.
|
||||
lengthOfTimeToHoldOnToAllPubkeys = 2419200 # Equals 4 weeks. You could make this longer if you want but making it shorter would not be advisable because there is a very small possibility that it could keep you from obtaining a needed pubkey for a period of time.
|
||||
maximumAgeOfObjectsThatIAdvertiseToOthers = 216000 # Equals two days and 12 hours
|
||||
maximumAgeOfNodesThatIAdvertiseToOthers = 10800 # Equals three hours
|
||||
|
@ -71,6 +71,7 @@ numberOfInventoryLookupsPerformed = 0
|
|||
daemon = False
|
||||
inventorySets = {} # key = streamNumer, value = a set which holds the inventory object hashes that we are aware of. This is used whenever we receive an inv message from a peer to check to see what items are new to us. We don't delete things out of it; instead, the singleCleaner thread clears and refills it every couple hours.
|
||||
needToWriteKnownNodesToDisk = False # If True, the singleCleaner will write it to disk eventually.
|
||||
maximumLengthOfTimeToBotherResendingMessages = 0
|
||||
|
||||
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
|
||||
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
|
||||
|
|
Loading…
Reference in New Issue
Block a user