Changeset 9883
- Timestamp:
- 07/04/08 23:29:46 (5 months ago)
- Location:
- trunk/src
- Files:
-
- 2 modified
-
common/contacts.py (modified) (5 diffs)
-
roster_window.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/contacts.py
r9879 r9883 324 324 continue 325 325 if common.gajim.jid_is_transport(jid) and not \ 326 _('Transports') in groups:326 _('Transports') in groups: 327 327 # do not count transports 328 continue 329 if self.has_brother(account, jid) and not \ 330 self.is_big_brother(account, jid): 331 # count metacontacts only once 328 332 continue 329 333 contact = self.get_contact_with_highest_priority(account, jid) … … 356 360 def get_metacontacts_tag(self, account, jid): 357 361 '''Returns the tag of a jid''' 358 if not self._metacontacts_tags.has_key(account):362 if not account in self._metacontacts_tags: 359 363 return None 360 364 for tag in self._metacontacts_tags[account]: … … 400 404 401 405 def has_brother(self, account, jid): 402 for account in self._metacontacts_tags:403 tag = self.get_metacontacts_tag(account, jid)404 if tag and len(self._metacontacts_tags[account][tag]) > 1:405 return True406 return False406 tag = self.get_metacontacts_tag(account, jid) 407 if not tag: 408 return False 409 meta_jids = self.get_metacontacts_jids(tag) 410 return len(meta_jids) > 1 or len(meta_jids[account]) > 1 407 411 408 412 def is_big_brother(self, account, jid): 409 tag = self.get_metacontacts_tag(account, jid) 410 if tag: 411 family = self.get_metacontacts_family(account, jid) 413 family = self.get_metacontacts_family(account, jid) 414 if family: 412 415 bb_data = self.get_metacontacts_big_brother(family) 413 bb_jid = bb_data['jid'] 414 bb_account = bb_data['account'] 415 if bb_jid == jid and bb_account == account: 416 if bb_data['jid'] == jid and bb_data['account'] == account: 416 417 return True 417 418 return False … … 421 422 answers = {} 422 423 for account in self._metacontacts_tags: 423 if self._metacontacts_tags[account].has_key(tag):424 if tag in self._metacontacts_tags[account]: 424 425 answers[account] = [] 425 426 for data in self._metacontacts_tags[account][tag]: … … 436 437 answers = [] 437 438 for account in self._metacontacts_tags: 438 if self._metacontacts_tags[account].has_key(tag):439 if tag in self._metacontacts_tags[account]: 439 440 for data in self._metacontacts_tags[account][tag]: 440 441 data['account'] = account -
trunk/src/roster_window.py
r9875 r9883 286 286 draw them and account. 287 287 ''' 288 c1 = time.clock()289 288 self.starting = True 290 289 jids = gajim.contacts.get_jid_list(account) 291 290 292 291 self.tree.freeze_child_notify() 293 c5 = time.clock()294 292 for jid in jids: 295 293 self.add_contact(jid, account) 296 c6 = time.clock()297 294 self.tree.thaw_child_notify() 298 295 … … 302 299 self._idle_draw_jids_of_account(jids, account) 303 300 304 c9 = time.clock()305 301 # Draw all known groups 306 302 for group in gajim.groups[account].keys(): … … 308 304 self.draw_account(account) 309 305 self.starting = False 310 c10 = time.clock()311 312 if jids:313 c4 = time.clock()314 315 print ""316 print "--- Add account contacts of %s ---------" % account317 print "Total Time", c4-c1318 print "Add contact without draw", c6-c5319 print "Draw groups and account", c10-c9320 print "--- contacts added -----------------------------"321 print ""322 306 323 307 … … 480 464 481 465 assert len(self._get_contact_iter(_jid, _account, _contact, self.model) 482 ) == 0, "%s already in roster. \n Family: " % (_jid, nearby_family)466 ) == 0, "%s already in roster. \n Family: %s" % (_jid, nearby_family) 483 467 self._add_entity(_contact, _account, big_brother_contact = \ 484 468 big_brother_contact, big_brother_account=big_brother_account) … … 1153 1137 account -- the corresponding account 1154 1138 ''' 1155 def _draw_all_contacts(jids, account , t):1139 def _draw_all_contacts(jids, account): 1156 1140 for jid in jids: 1157 1141 self.draw_contact(jid, account) 1158 1142 self.draw_avatar(jid, account) 1159 1143 yield True 1160 print "--- Idle draw of %s -----------" % account1161 print "Draw contact and avatar", time.clock() - t1162 print "-------------------------------"1163 1144 yield False 1164 1145 1165 t = time.clock() 1166 task = _draw_all_contacts(jids, account, t) 1146 task = _draw_all_contacts(jids, account) 1167 1147 gobject.idle_add(task.next) 1168 1148
