#877 closed defect (fixed)

Script to import pidgin accounts to bitlbee fails if password not defined in accounts.xml

Reported by: nospamformike@… Owned by:
Priority: minor Milestone:
Component: BitlBee Version: devel
Keywords: Cc:
IRC client+version: Client-independent Operating System: Linux
OS version/distro:


Not sure if this is the right place to report this issue.

The script offered here:

was crashing on attempting to read my accounts.xml file. It warned that irc wasn't supported but still was attempting to read in the configuration. I tracked the issue down to an irc account without a password defined.

I did the following quick and dirty fix, which will ignore unsupported protocols. Probably a better solution would be to gracefully deal with missing information but I don't know any python beyond what I could guess from your script. All I can say is it works for my accounts file.

def parse_purple(f):

protomap = {

'msn-pecan': 'msn', 'aim': 'oscar', 'icq': 'oscar',

} supported = ('msn', 'jabber', 'oscar', 'yahoo', 'twitter') accs = list()

if os.path.isdir(f):

f = f + '/accounts.xml'

xt = xml.dom.minidom.parse(f) for acc in xt.getElementsByTagName('account')[1:]:

protocol = acc.getElementsByTagName('protocol')[0].firstChild.wholeText if protocol.startswith('prpl-'):

protocol = protocol[5:]

if name.endswith('/'):

name = name[:-1]

if protocol in protomap:

protocol = protomap[protocol]

if protocol not in supported:

print 'Warning: protocol probably not supported by BitlBee: ' + protocol

if protocol in supported:

name = acc.getElementsByTagName('name')[0].firstChild.wholeText password = acc.getElementsByTagName('password')[0].firstChild.wholeText accs.append((protocol, name, password))

return accs

Attachments (1)

convert_purple.diff (431 bytes) - added by nospamformike@… at 2011-12-23T21:01:59Z.
diff for the changes I made

Download all attachments as: .zip

Change History (7)

comment:1 Changed at 2011-12-23T20:48:29Z by nospamformike@…

Meh. It lost all the new lines. Hopefully should be clear what I changed.

comment:2 Changed at 2011-12-23T20:49:28Z by Wilmer van der Gaast <wilmer@…>

The e-mail versions are always clearer (still in cleartext). :-)

Could you just give a diff relative to the original version?

Changed at 2011-12-23T21:01:59Z by nospamformike@…

Attachment: convert_purple.diff added

diff for the changes I made

comment:3 Changed at 2011-12-24T11:06:58Z by wilmer

Hrm, that change may not be very good for conversions to bitlbee-libpurple - but in fact that was already the case in the original script.

However, BitlBee currently deals very poorly with account files with unsupported protocols, so the script would maybe even need two modes. :-(

I'll probably do that and then indeed use this filtering. Cool to see someone's actually using this script BTW!

comment:4 Changed at 2011-12-25T02:52:11Z by nospamformike@…

If you want it to interpret unsupported protocols, probably a better way would be to test whether acc.getElementsByTagName('password') exists and if not, deal appropriately (and maybe the same for 'name'? I don't know if you can define an account in pidgin without a name). Producing a message saying "couldn't interpret account blah" would mean you get the commands for most of the accounts and a list of which accounts need to be dealt with manually. I imagine it wouldn't take too much effort to do this but I don't know python well enough to try it and produce a diff for you.

The script was very helpful to me. Until I found the script, I was reading the xml file to see what my login details were so it saved me alot of time - i had about 12 to add.

Have a good Christmas!

comment:5 Changed at 2012-02-11T17:10:18Z by wilmer

I think I'll go for the easy option and just set the password field to something empty. In case of OAuth, for example, that's okay.

comment:6 Changed at 2012-02-11T17:20:31Z by wilmer

Resolution: fixed
Status: newclosed

Modify Ticket

as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.