Changeset 9892
- Timestamp:
- 07/06/08 23:35:19 (7 weeks ago)
- Location:
- trunk/src
- Files:
-
- 2 modified
-
common/contacts.py (modified) (9 diffs)
-
roster_window.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/contacts.py
r9891 r9892 172 172 self._contacts[account] = {} 173 173 self._gc_contacts[account] = {} 174 if not self._metacontacts_tags.has_key(account):174 if account not in self._metacontacts_tags: 175 175 self._metacontacts_tags[account] = {} 176 176 … … 188 188 chatstate=None, last_status_time=None, composing_xep=None, 189 189 mood={}, tune={}, activity={}): 190 return Contact(jid=jid, name=name, groups=groups, show=show, 190 191 # We don't want duplicated group values 192 groups_unique = [] 193 for group in groups: 194 if group not in groups_unique: 195 groups_unique.append(group) 196 197 return Contact(jid=jid, name=name, groups=groups_unique, show=show, 191 198 status=status, sub=sub, ask=ask, resource=resource, priority=priority, 192 199 keyID=keyID, caps_node=caps_node, caps_hash_method=caps_hash_method, … … 206 213 def add_contact(self, account, contact): 207 214 # No such account before ? 208 if not self._contacts.has_key(account):215 if account not in self._contacts: 209 216 self._contacts[account] = {contact.jid : [contact]} 210 217 return 211 218 # No such jid before ? 212 if not self._contacts[account].has_key(contact.jid):219 if contact.jid not in self._contacts[account]: 213 220 self._contacts[account][contact.jid] = [contact] 214 221 return … … 227 234 228 235 def remove_contact(self, account, contact): 229 if not self._contacts.has_key(account):230 return 231 if not self._contacts[account].has_key(contact.jid):236 if account not in self._contacts: 237 return 238 if contact.jid not in self._contacts[account]: 232 239 return 233 240 if contact in self._contacts[account][contact.jid]: … … 241 248 def remove_jid(self, account, jid, remove_meta=True): 242 249 '''Removes all contacts for a given jid''' 243 if not self._contacts.has_key(account):244 return 245 if not self._contacts[account].has_key(jid):250 if account not in self._contacts: 251 return 252 if jid not in self._contacts[account]: 246 253 return 247 254 del self._contacts[account][jid] … … 387 394 self.remove_metacontact(account, jid) 388 395 old_tag = self.get_metacontacts_tag(account, jid) 389 if not self._metacontacts_tags[account].has_key(tag):396 if tag not in self._metacontacts_tags[account]: 390 397 self._metacontacts_tags[account][tag] = [{'jid': jid, 'tag': tag}] 391 398 else: … … 558 565 def add_gc_contact(self, account, gc_contact): 559 566 # No such account before ? 560 if not self._gc_contacts.has_key(account):567 if account not in self._gc_contacts: 561 568 self._contacts[account] = {gc_contact.room_jid : {gc_contact.name: \ 562 569 gc_contact}} 563 570 return 564 571 # No such room_jid before ? 565 if not self._gc_contacts[account].has_key(gc_contact.room_jid):572 if gc_contact.room_jid not in self._gc_contacts[account]: 566 573 self._gc_contacts[account][gc_contact.room_jid] = {gc_contact.name: \ 567 574 gc_contact} … … 571 578 572 579 def remove_gc_contact(self, account, gc_contact): 573 if not self._gc_contacts.has_key(account):574 return 575 if not self._gc_contacts[account].has_key(gc_contact.room_jid):576 return 577 if not self._gc_contacts[account][gc_contact.room_jid].has_key(578 gc_contact.name):580 if account not in self._gc_contacts: 581 return 582 if gc_contact.room_jid not in self._gc_contacts[account]: 583 return 584 if gc_contact.name not in self._gc_contacts[account][ 585 gc_contact.room_jid]: 579 586 return 580 587 del self._gc_contacts[account][gc_contact.room_jid][gc_contact.name] … … 584 591 585 592 def remove_room(self, account, room_jid): 586 if not self._gc_contacts.has_key(account):587 return 588 if not self._gc_contacts[account].has_key(room_jid):593 if account not in self._gc_contacts: 594 return 595 if room_jid not in self._gc_contacts[account]: 589 596 return 590 597 del self._gc_contacts[account][room_jid] 591 598 592 599 def get_gc_list(self, account): 593 if not self._gc_contacts.has_key(account):600 if account not in self._gc_contacts: 594 601 return [] 595 602 return self._gc_contacts[account].keys() -
trunk/src/roster_window.py
r9889 r9892 1469 1469 resource = '/'.join(jids[1:]) 1470 1470 # get name 1471 name = array[jid]['name'] 1472 if not name: 1473 name = '' 1471 name = array[jid]['name'] or '' 1474 1472 show = 'offline' # show is offline by default 1475 1473 status = '' # no status message by default
