Changeset 57
- Timestamp:
- 03/11/02 08:30:37 (7 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBPrivate/Prototypes/ChatClient/AccountManagerMediator.py
r55 r57 48 48 Model.ClearClients() 49 49 for account in self.dictAccount.itervalues(): 50 if int(account ['login']):50 if int(account.get('login', 0)): 51 51 Model.LoginToClient(account['name'], account['server'], account['username'], account['password'], account['resource']) 52 52 … … 122 122 IsChecked = str(self.AccountList.IsChecked(idx)) 123 123 account = self.dictAccount[self.AccountList.GetString(idx)] 124 if account ['login']!= IsChecked:124 if account.get('login', 0) != IsChecked: 125 125 self._bModified = 1 126 126 account['login'] = IsChecked … … 128 128 if self._bModified: 129 129 # Save account list 130 dictAccount = self.dictAccount.values() [:]130 dictAccount = self.dictAccount.values() 131 131 132 132 fileAccountList = open('accountlist.xml', 'w') … … 137 137 if key: self._rotor = newrotor(key) 138 138 if getattr(self, '_rotor', None): 139 print >> fileAccountList, '''<AccountList encrypted='1' verification=%s >''' % quoteattr(self._rotor.encrypt('verification').encode('hex')) 139 140 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()]) 147 153 148 154 print >> fileAccountList, '''</AccountList>'''
