diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-02-11 17:18:46 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-02-11 17:18:46 +0000 |
commit | 4f37a98fe518297822ac47c09e6c034dbcd49540 (patch) | |
tree | ad71268de3a0e757b1b520c078c325516d1376a6 /utils | |
parent | eb54f56f35b611d03913cde2244e7eab431dc271 (diff) |
convert_purple fix: Don't barf on protocols without passwords. Bug #877.
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/convert_purple.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/convert_purple.py b/utils/convert_purple.py index 85433119..240a5c64 100755 --- a/utils/convert_purple.py +++ b/utils/convert_purple.py @@ -34,7 +34,10 @@ def parse_purple(f): for acc in xt.getElementsByTagName('account')[1:]: protocol = acc.getElementsByTagName('protocol')[0].firstChild.wholeText name = acc.getElementsByTagName('name')[0].firstChild.wholeText - password = acc.getElementsByTagName('password')[0].firstChild.wholeText + try: + password = acc.getElementsByTagName('password')[0].firstChild.wholeText + except IndexError: + password = '' if protocol.startswith('prpl-'): protocol = protocol[5:] if name.endswith('/'): @@ -52,7 +55,7 @@ def print_commands(accs): print 'commands into your &bitlbee channel:' print for acc in accs: - print 'account add %s %s %s' % acc + print 'account add %s %s "%s"' % acc def bitlbee_x(*args): bb = subprocess.Popen([BITLBEE, '-x'] + list(args), stdout=subprocess.PIPE) @@ -84,7 +87,7 @@ def print_xml(accs): root.appendChild(accx) print - print 'Write the following XML data to a file called %s.xml (rename it if' + print 'Write the following XML data to a file called %s.xml (rename it if' % user.lower() print 'you want to use a different nickname). It should be in the directory where' print 'your BitlBee account files are stored (most likely /var/lib/bitlbee).' print |