# Copyright (C) 2005 Konstantin Korikov
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import libxml2
def convert_config(xml_node):
dest_version = "0.3.0"
xres = xml_node.xpathEval("default-account")
if len(xres):
acc = xres[0]
if acc.prop("use-passwordfd") == None:
acc.setProp("use-passwordfd",
acc.prop("remotename") and "0" or "1")
if len(acc.xpathEval("redial-if-list")) == 0:
acc.newChild(None, "redial-if-list", None)
v = acc.prop("modem-device")
if v != None:
acc.unsetProp("modem-device")
acc.setProp("device", v)
v = acc.prop("modem-flow")
if v != None:
acc.unsetProp("modem-flow")
if v == "": v = "no-change"
acc.setProp("flow-control", v)
if acc.prop("modem") == None:
acc.setProp("modem", "1")
xml_node.setProp("version", dest_version)
|