示例#1
0
文件: pidgin.py 项目: duy/keysync
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        kf = os.path.join(savedir, PidginProperties.keyfile)
        # Pidgin requires the XMPP resource in the account name field of the
        # OTR private keys file, so fetch it from the existing account info
        if os.path.exists(os.path.join(savedir,
                                       PidginProperties.accountsfile)):
            accountsdir = savedir
        elif os.path.exists(
                os.path.join(PidginProperties.path,
                             PidginProperties.accountsfile)):
            accountsdir = PidginProperties.path
        resources = PidginProperties._get_resources(accountsdir)

        pidginkeydict = dict()
        for name, key in keydict.iteritems():
            # pidgin requires the XMPP Resource in the account name for otr.private_keys
            if key['protocol'] == 'prpl-jabber' and 'x' in key.keys():
                if name in resources.keys():
                    key['name'] = key['name'] + '/' + resources[name]
                else:
                    key['name'] = key['name'] + '/' + 'REPLACEME'
            pidginkeydict[name] = key
        OtrPrivateKeys.write(pidginkeydict, kf)

        accounts = []
        # look for all private keys and use them for the accounts list
        for name, key in keydict.iteritems():
            if 'x' in key:
                accounts.append(name)
        fpf = os.path.join(savedir, PidginProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#2
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        kf = os.path.join(savedir, PidginProperties.keyfile)
        # Pidgin requires the XMPP resource in the account name field of the
        # OTR private keys file, so fetch it from the existing account info
        if os.path.exists(os.path.join(savedir, PidginProperties.accountsfile)):
            accountsdir = savedir
        elif os.path.exists(os.path.join(PidginProperties.path,
                                         PidginProperties.accountsfile)):
            accountsdir = PidginProperties.path
        resources = PidginProperties._get_resources(accountsdir)

        pidginkeydict = dict()
        for name, key in keydict.iteritems():
            # pidgin requires the XMPP Resource in the account name for otr.private_keys
            if key['protocol'] == 'prpl-jabber' and 'x' in key.keys():
                if name in resources.keys():
                    key['name'] = key['name'] + '/' + resources[name]
                else:
                    key['name'] = key['name'] + '/' + 'REPLACEME'
            pidginkeydict[name] = key
        OtrPrivateKeys.write(pidginkeydict, kf)

        accounts = []
        # look for all private keys and use them for the accounts list
        for name, key in keydict.iteritems():
            if 'x' in key:
                accounts.append(name)
        fpf = os.path.join(savedir, PidginProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#3
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        kf = os.path.join(savedir, IrssiProperties.keyfile)
        OtrPrivateKeys.write(keydict, kf)

        accounts = []
        # look for all private keys and use them for the accounts list
        for name, key in keydict.iteritems():
            if 'x' in key:
                accounts.append(name)
        fpf = os.path.join(savedir, IrssiProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#4
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        kf = os.path.join(savedir, IrssiProperties.keyfile)
        OtrPrivateKeys.write(keydict, kf)

        accounts = []
        # look for all private keys and use them for the accounts list
        for name, key in keydict.iteritems():
            if 'x' in key:
                accounts.append(name)
        fpf = os.path.join(savedir, IrssiProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#5
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = AdiumProperties.path

        kf = os.path.join(settingsdir, AdiumProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        accounts = AdiumProperties._get_accounts_from_plist(settingsdir)
        newkeydict = dict()
        for adiumIndex, key in keydict.iteritems():
            for account in accounts:
                if account['ObjectID'] == key['name']:
                    name = account['UID']
                    key['name'] = name
                    newkeydict[name] = key
        keydict = newkeydict

        fpf = os.path.join(settingsdir, AdiumProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        return keydict
示例#6
0
文件: adium.py 项目: duy/keysync
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = AdiumProperties.path

        kf = os.path.join(settingsdir, AdiumProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        accounts = AdiumProperties._get_accounts_from_plist(settingsdir)
        newkeydict = dict()
        for adiumIndex, key in keydict.iteritems():
            for account in accounts:
                if account['ObjectID'] == key['name']:
                    name = account['UID']
                    key['name'] = name
                    newkeydict[name] = key
        keydict = newkeydict

        fpf = os.path.join(settingsdir, AdiumProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        return keydict
示例#7
0
    def write(keydict, savedir='./'):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        # need when converting account names back to Adium's account index number
        accountsplist = AdiumProperties._get_accounts_from_plist(savedir)

        kf = os.path.join(savedir, AdiumProperties.keyfile)
        adiumkeydict = dict()
        for name, key in keydict.iteritems():
            name = key['name']
            for account in accountsplist:
                if account['UID'] == name:
                    key['name'] = account['ObjectID']
                    adiumkeydict[name] = key
        OtrPrivateKeys.write(keydict, kf)

        accounts = []
        for account in accountsplist:
            accounts.append(account['ObjectID'])
        fpf = os.path.join(savedir, AdiumProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#8
0
文件: adium.py 项目: duy/keysync
    def write(keydict, savedir='./'):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        # need when converting account names back to Adium's account index number
        accountsplist = AdiumProperties._get_accounts_from_plist(savedir)

        kf = os.path.join(savedir, AdiumProperties.keyfile)
        adiumkeydict = dict()
        for name, key in keydict.iteritems():
            name = key['name']
            for account in accountsplist:
                if account['UID'] == name:
                    key['name'] = account['ObjectID']
                    adiumkeydict[name] = key
        OtrPrivateKeys.write(keydict, kf)

        accounts = []
        for account in accountsplist:
            accounts.append(account['ObjectID'])
        fpf = os.path.join(savedir, AdiumProperties.fingerprintfile)
        OtrFingerprints.write(keydict, fpf, accounts)
示例#9
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = IrssiProperties.path

        kf = os.path.join(settingsdir, IrssiProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        fpf = os.path.join(settingsdir, IrssiProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        return keydict
示例#10
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = IrssiProperties.path

        kf = os.path.join(settingsdir, IrssiProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        fpf = os.path.join(settingsdir, IrssiProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        return keydict
示例#11
0
文件: pidgin.py 项目: duy/keysync
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = PidginProperties.path

        kf = os.path.join(settingsdir, PidginProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        fpf = os.path.join(settingsdir, PidginProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        resources = PidginProperties._get_resources(settingsdir)
        for name, key in keydict.iteritems():
            if key['protocol'] == 'prpl-jabber' \
                    and 'x' in key.keys() \
                    and name in resources.keys():
                key['resource'] = resources[name]

        return keydict
示例#12
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = PidginProperties.path

        kf = os.path.join(settingsdir, PidginProperties.keyfile)
        if os.path.exists(kf):
            keydict = OtrPrivateKeys.parse(kf)
        else:
            keydict = dict()

        fpf = os.path.join(settingsdir, PidginProperties.fingerprintfile)
        if os.path.exists(fpf):
            util.merge_keydicts(keydict, OtrFingerprints.parse(fpf))

        resources = PidginProperties._get_resources(settingsdir)
        for name, key in keydict.iteritems():
            if key['protocol'] == 'prpl-jabber' \
                    and 'x' in key.keys() \
                    and name in resources.keys():
                key['resource'] = resources[name]

        return keydict