mCurrentServerInfo.addAddress(name, port);
mCurrentServerInfo.setServerPassword(password);
}
catch (CoreException e)
{
throw new XmlErrorException(e);
}
}
else if (qName.equals("bot"))
{
String name = atts.getValue("name");
String nick = atts.getValue("nick");
String alt_nick = atts.getValue("altnick");
String real_name = atts.getValue("realname");
String server_name = atts.getValue("servername");
if (BotFactory.contains(name))
{
throw new XmlErrorException("A bot with name '"+name+"' has already been set up.");
}
mCurrentBot = BotFactory.get(name);
mBots.add(mCurrentBot);
mCurrentBot.initialize(nick, alt_nick, real_name, new Server(server_name, (ServerInfo)mServerInfos.get(server_name), mCurrentBot));
}
else if (qName.equals("channel"))
{
String name = atts.getValue("name");
String password = atts.getValue("password");
try
{
mCurrentBot.join(name, password);
}
catch (CoreException e)
{
throw new XmlErrorException(e);
}
}
else if (qName.equals("module"))
{
String classname = atts.getValue("classname");
Class module_class = null;
Module module_instance = null;
try
{
module_class = Class.forName(classname);
module_instance = (Module)module_class.newInstance();
}
catch (ClassNotFoundException e)
{
throw new XmlErrorException(e);
}
catch (InstantiationException e)
{
throw new XmlErrorException(e);
}
catch (IllegalAccessException e)
{
throw new XmlErrorException(e);
}
mCurrentModule = module_instance;
}
else if (qName.equals("property"))
{
String name = atts.getValue("name");
if (null == mCurrentModule)
{
throw new XmlErrorException("No module specified to set the property '"+name+"' for.");
}
mCharacterDataStack = new StringBuffer();
mCurrentProperty = name;
}
else
{
throw new XmlErrorException("Unsupport element name '"+qName+"'.");
}
}