# Copyright 2004-2005 James Bunton <james@delx.cjb.net>
# Licensed for distribution under the GPL version 2, check COPYING for details
+from tlib import xmlw
-import sys
-import os
+import sys, os
-import utils
import config
sys.exit(1)
-def reloadConfig():
- # Find out where the config file is
- configFile = config.configFile
- if len(sys.argv) == 2:
- configFile = sys.argv[1]
-
+def importFile(configFile):
# Check the file exists
if not os.path.isfile(configFile):
print "Configuration file not found. You need to create a config.xml file in the PyMSNt directory."
# Get ourself a DOM
try:
- root = utils.parseFile(configFile)
+ root = xmlw.parseFile(configFile)
except Exception, e:
invalidError("Error parsing configuration file: " + str(e))
print "Tag %s in your configuration file is not a defined tag. Ignoring!" % (tag)
- # Apply some things immediately
- from tlib.msn import msnw
- msnw.GETALLAVATARS = config.getAllAvatars
+def importOptions(options):
+ for o in options:
+ if hasattr(config, o):
+ setattr(config, o, options[0])
+ else:
+ print "Option %s is not a defined option. Ignoring!" % (o)
+def reloadConfig(file=None, options=None):
+ if file:
+ importFile(file)
+ if options:
+ importOptions(options)