#Right now, PyBitmessage only support connecting to stream 1. It doesn't yet contain logic to expand into further streams.
softwareVersion='0.2.5'
softwareVersion='0.2.6'
verbose=2
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.
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
storeConfigFilesInSameDirectoryAsProgram=False
storeConfigFilesInSameDirectoryAsProgramByDefault=False#The user may de-select Portable Mode in the settings if they want the config files to stay in the application data folder.
useVeryEasyProofOfWorkForTesting=False#If you set this to True while on the normal network, you won't be able to send or sometimes receive messages.
importsys
@ -51,6 +51,7 @@ import threading #used for the locks, not for the threads
importcStringIO
fromtimeimportstrftime,localtime
importos
importshutil#used for moving the messages.dat file
#This thread exists because SQLITE3 is so un-threadsafe that we must submit queries to it and it puts results back in a different queue. They won't let us just use locks.
classsqlThread(QThread):
@ -3087,6 +3103,8 @@ class settingsDialog(QtGui.QDialog):
@ -3585,13 +3603,17 @@ class MyForm(QtGui.QMainWindow):
defclick_actionManageKeys(self):
if'darwin'insys.platformor'linux'insys.platform:
reply=QtGui.QMessageBox.information(self,'keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file.',QMessageBox.Ok)
ifappdata=='':
reply=QtGui.QMessageBox.information(self,'keys.dat?','You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file.',QMessageBox.Ok)
else:
QtGui.QMessageBox.information(self,'keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file.',QMessageBox.Ok)
elifsys.platform=='win32'orsys.platform=='win64':
reply=QtGui.QMessageBox.question(self,'Open keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)',QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
ifappdata=='':
reply=QtGui.QMessageBox.question(self,'Open keys.dat?','You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)',QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
else:
reply=QtGui.QMessageBox.question(self,'Open keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)',QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
@ -4228,6 +4251,37 @@ class MyForm(QtGui.QMainWindow):
#startup for linux
pass
ifappdata!=''andself.settingsDialogInstance.ui.checkBoxPortableMode.isChecked():#If we are NOT using portable mode now but the user selected that we should...
config.set('bitmessagesettings','movemessagstoprog','true')#Tells bitmessage to move the messages.dat file to the program directory the next time the program starts.
#Write the keys.dat file to disk in the new location
withopen('keys.dat','wb')asconfigfile:
config.write(configfile)
#Write the knownnodes.dat file to disk in the new location
output=open('knownnodes.dat','wb')
pickle.dump(knownNodes,output)
output.close()
os.remove(appdata+'keys.dat')
os.remove(appdata+'knownnodes.dat')
appdata=''
QMessageBox.about(self,"Restart","Bitmessage has moved most of your config files to the program directory but you must restart Bitmessage to move the last file (the file which holds messages).")
ifappdata==''andnotself.settingsDialogInstance.ui.checkBoxPortableMode.isChecked():#If we ARE using portable mode now but the user selected that we shouldn't...
appdata=lookupAppdataFolder()
ifnotos.path.exists(appdata):
os.makedirs(appdata)
config.set('bitmessagesettings','movemessagstoappdata','true')#Tells bitmessage to move the messages.dat file to the appdata directory the next time the program starts.
#Write the keys.dat file to disk in the new location
withopen(appdata+'keys.dat','wb')asconfigfile:
config.write(configfile)
#Write the knownnodes.dat file to disk in the new location
output=open(appdata+'knownnodes.dat','wb')
pickle.dump(knownNodes,output)
output.close()
os.remove('keys.dat')
os.remove('knownnodes.dat')
QMessageBox.about(self,"Restart","Bitmessage has moved most of your config files to the application data directory but you must restart Bitmessage to move the last file (the file which holds messages).")
config.set('bitmessagesettings','minimizetotray','false')#This isn't implimented yet and when True on Ubuntu causes Bitmessage to disappear while running when minimized.
config.set('bitmessagesettings','minimizetotray','false')#This isn't implimented yet and when True on Ubuntu causes Bitmessage to disappear while running when minimized.
config.set('bitmessagesettings','settingsversion','3')#If the settings version is equal to 2 then the sqlThread will modify the pubkeys table and change the settings version to 3.
@ -4791,6 +4843,29 @@ if __name__ == "__main__":
withopen(appdata+'keys.dat','wb')asconfigfile:
config.write(configfile)
#Let us now see if we should move the messages.dat file. There is an option in the settings to switch 'Portable Mode' on or off. Most of the files are moved instantly, but the messages.dat file cannot be moved while it is open. Now that it is not open we can move it now!
@ -145,6 +151,8 @@ class Ui_settingsDialog(object):
self.checkBoxStartInTray.setText(QtGui.QApplication.translate("settingsDialog","Start Bitmessage in the tray (don\'t show main window)",None,QtGui.QApplication.UnicodeUTF8))
self.checkBoxMinimizeToTray.setText(QtGui.QApplication.translate("settingsDialog","Minimize to tray",None,QtGui.QApplication.UnicodeUTF8))
self.checkBoxShowTrayNotifications.setText(QtGui.QApplication.translate("settingsDialog","Show notification when message received and minimzed to tray",None,QtGui.QApplication.UnicodeUTF8))
self.checkBoxPortableMode.setText(QtGui.QApplication.translate("settingsDialog","Run in Portable Mode",None,QtGui.QApplication.UnicodeUTF8))
self.label_7.setText(QtGui.QApplication.translate("settingsDialog","In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.",None,QtGui.QApplication.UnicodeUTF8))
<string>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</string>