# This is an example of a daemon client for PyBitmessage 0.4.2, by .dok (Version 0.3.0)
importConfigParser
importxmlrpclib
importdatetime
importhashlib
@ -17,6 +16,8 @@ import time
importsys
importos
fromconfigparserimportBMConfigParser
api=''
keysName='keys.dat'
keysPath='keys.dat'
@ -46,7 +47,7 @@ def restartBmNotify(): #Prompts the user to restart Bitmessage.
defsafeConfigGetBoolean(section,field):
globalkeysPath
config=ConfigParser.SafeConfigParser()
config=BMConfigParser()
config.read(keysPath)
try:
@ -73,7 +74,7 @@ def lookupAppdataFolder(): #gets the appropriate folders for the .dat files depe
defconfigInit():
globalkeysName
config=ConfigParser.SafeConfigParser()
config=BMConfigParser()
config.add_section('bitmessagesettings')
config.set('bitmessagesettings','port','8444')#Sets the bitmessage port to stop the warning about the api not properly being setup. This is in the event that the keys.dat is in a different directory or is created locally to connect to a machine remotely.
@ -88,7 +89,7 @@ def configInit():
defapiInit(apiEnabled):
globalkeysPath
globalusrPrompt
config=ConfigParser.SafeConfigParser()
config=BMConfigParser()
config.read(keysPath)
@ -173,7 +174,7 @@ def apiData():
globalkeysPath
globalusrPrompt
config=ConfigParser.SafeConfigParser()
config=BMConfigParser()
config.read(keysPath)#First try to load the config file (the keys.dat file) from the program directory
try:
@ -183,7 +184,7 @@ def apiData():
#Could not load the keys.dat file in the program directory. Perhaps it is in the appdata directory.
appDataFolder=lookupAppdataFolder()
keysPath=appDataFolder+keysPath
config=ConfigParser.SafeConfigParser()
config=BMConfigParser()
config.read(keysPath)
try:
@ -252,7 +253,7 @@ def apiTest(): #Tests the API connection to bitmessage. Returns true if it is co
defbmSettings():#Allows the viewing and modification of keys.dat settings.