Startup fixes
- correctly test for "smtpdeliver" variable without crashing - new method for safely getting values from config even if the option may be missing
This commit is contained in:
parent
d3e8771aed
commit
685ff6cecd
|
@ -187,7 +187,7 @@ class Main:
|
||||||
sqlLookup.start()
|
sqlLookup.start()
|
||||||
|
|
||||||
# SMTP delivery thread
|
# SMTP delivery thread
|
||||||
if daemon and shared.config.get("bitmessagesettings", "smtpdeliver", None):
|
if daemon and shared.safeConfigGet("bitmessagesettings", "smtpdeliver", '') != '':
|
||||||
smtpDeliveryThread = smtpDeliver()
|
smtpDeliveryThread = smtpDeliver()
|
||||||
smtpDeliveryThread.start()
|
smtpDeliveryThread.start()
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ class smtpDeliver(threading.Thread, StoppableThread):
|
||||||
pass
|
pass
|
||||||
elif command == 'displayNewInboxMessage':
|
elif command == 'displayNewInboxMessage':
|
||||||
inventoryHash, toAddress, fromAddress, subject, body = data
|
inventoryHash, toAddress, fromAddress, subject, body = data
|
||||||
dest = shared.config.get("bitmessagesettings", "smtpdeliver", None)
|
dest = shared.safeConfigGet("bitmessagesettings", "smtpdeliver", '')
|
||||||
if not dest:
|
if dest == '':
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
u = urlparse.urlparse(dest)
|
u = urlparse.urlparse(dest)
|
||||||
|
|
|
@ -425,6 +425,8 @@ class sqlThread(threading.Thread):
|
||||||
shared.config.set('bitmessagesettings', 'onionport', '8444')
|
shared.config.set('bitmessagesettings', 'onionport', '8444')
|
||||||
if not shared.config.has_option('bitmessagesettings', 'onionbindip'):
|
if not shared.config.has_option('bitmessagesettings', 'onionbindip'):
|
||||||
shared.config.set('bitmessagesettings', 'onionbindip', '127.0.0.1')
|
shared.config.set('bitmessagesettings', 'onionbindip', '127.0.0.1')
|
||||||
|
if not shared.config.has_option('bitmessagesettings', 'smtpdeliver'):
|
||||||
|
shared.config.set('bitmessagesettings', 'smtpdeliver', '')
|
||||||
shared.writeKeysFile()
|
shared.writeKeysFile()
|
||||||
|
|
||||||
# Are you hoping to add a new option to the keys.dat file of existing
|
# Are you hoping to add a new option to the keys.dat file of existing
|
||||||
|
|
|
@ -401,6 +401,12 @@ def safeConfigGetBoolean(section,field):
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def safeConfigGet(section, option, default = None):
|
||||||
|
if config.has_option (section, option):
|
||||||
|
return config.get(section, option)
|
||||||
|
else:
|
||||||
|
return default
|
||||||
|
|
||||||
def decodeWalletImportFormat(WIFstring):
|
def decodeWalletImportFormat(WIFstring):
|
||||||
fullString = arithmetic.changebase(WIFstring,58,256)
|
fullString = arithmetic.changebase(WIFstring,58,256)
|
||||||
privkey = fullString[:-4]
|
privkey = fullString[:-4]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user