Changeset 57

Show
Ignore:
Timestamp:
03/11/02 08:30:37 (7 years ago)
Author:
sholloway
Message:

*** empty log message ***

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBPrivate/Prototypes/ChatClient/AccountManagerMediator.py

    r55 r57  
    4848        Model.ClearClients() 
    4949        for account in self.dictAccount.itervalues(): 
    50             if int(account['login']): 
     50            if int(account.get('login', 0)): 
    5151                Model.LoginToClient(account['name'], account['server'], account['username'], account['password'], account['resource']) 
    5252 
     
    122122            IsChecked = str(self.AccountList.IsChecked(idx)) 
    123123            account = self.dictAccount[self.AccountList.GetString(idx)] 
    124             if account['login'] != IsChecked: 
     124            if account.get('login', 0) != IsChecked: 
    125125                self._bModified = 1 
    126126                account['login'] = IsChecked 
     
    128128        if self._bModified: 
    129129            # Save account list 
    130             dictAccount = self.dictAccount.values()[:] 
     130            dictAccount = self.dictAccount.values() 
    131131 
    132132            fileAccountList = open('accountlist.xml', 'w') 
     
    137137                if key: self._rotor = newrotor(key) 
    138138            if getattr(self, '_rotor', None): 
     139                print >> fileAccountList, '''<AccountList encrypted='1' verification=%s >''' % quoteattr(self._rotor.encrypt('verification').encode('hex')) 
    139140                for each in dictAccount: 
    140                     each['password'] = self._rotor.encrypt(each['password']).encode('hex') 
    141                 print >> fileAccountList, '''<AccountList encrypted='1' verification=%s >''' % quoteattr(self._rotor.encrypt('verification').encode('hex')) 
    142             else: print >> fileAccountList, '''<AccountList encrypted='0'>''' 
    143  
    144             # Write out accounts 
    145             for each in dictAccount: 
    146                 print >> fileAccountList, '''    <Account %s />''' % ' '.join(['%s=%s' % (x[0], quoteattr(x[1])) for x in each.iteritems()]) 
     141                    strAttributes = '' 
     142                    for x in each.iteritems(): 
     143                        if x[0] == 'password': 
     144                            strAttributes += '%s=%s ' % (x[0], quoteattr(self._rotor.encrypt(x[1]).encode('hex'))) 
     145                        else: 
     146                            strAttributes += '%s=%s ' % (x[0], quoteattr(x[1])) 
     147                    print >> fileAccountList, '''    <Account %s/>''' % strAttributes 
     148            else:  
     149                print >> fileAccountList, '''<AccountList encrypted='0'>''' 
     150                # Write out accounts 
     151                for each in dictAccount: 
     152                    print >> fileAccountList, '''    <Account %s />''' % ' '.join(['%s=%s' % (x[0], quoteattr(x[1])) for x in each.iteritems()]) 
    147153 
    148154            print >> fileAccountList, '''</AccountList>'''