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()
|
||||
|
||||
# SMTP delivery thread
|
||||
if daemon and shared.config.get("bitmessagesettings", "smtpdeliver", None):
|
||||
if daemon and shared.safeConfigGet("bitmessagesettings", "smtpdeliver", '') != '':
|
||||
smtpDeliveryThread = smtpDeliver()
|
||||
smtpDeliveryThread.start()
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class smtpDeliver(threading.Thread, StoppableThread):
|
|||
pass
|
||||
elif command == 'displayNewInboxMessage':
|
||||
inventoryHash, toAddress, fromAddress, subject, body = data
|
||||
dest = shared.config.get("bitmessagesettings", "smtpdeliver", None)
|
||||
if not dest:
|
||||
dest = shared.safeConfigGet("bitmessagesettings", "smtpdeliver", '')
|
||||
if dest == '':
|
||||
continue
|
||||
try:
|
||||
u = urlparse.urlparse(dest)
|
||||
|
|
|
@ -425,6 +425,8 @@ class sqlThread(threading.Thread):
|
|||
shared.config.set('bitmessagesettings', 'onionport', '8444')
|
||||
if not shared.config.has_option('bitmessagesettings', 'onionbindip'):
|
||||
shared.config.set('bitmessagesettings', 'onionbindip', '127.0.0.1')
|
||||
if not shared.config.has_option('bitmessagesettings', 'smtpdeliver'):
|
||||
shared.config.set('bitmessagesettings', 'smtpdeliver', '')
|
||||
shared.writeKeysFile()
|
||||
|
||||
# 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:
|
||||
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):
|
||||
fullString = arithmetic.changebase(WIFstring,58,256)
|
||||
privkey = fullString[:-4]
|
||||
|
|
Reference in New Issue
Block a user