(Group g)
| 433 | } |
| 434 | |
| 435 | public void cleanupGroup(Group g) { |
| 436 | /* |
| 437 | * Group g=(Group)getFocusedObject(); |
| 438 | */ |
| 439 | if (g == null) { |
| 440 | return; |
| 441 | } |
| 442 | if (!g.collapsed && !Config.getInstance().autoClean) { |
| 443 | return; |
| 444 | } |
| 445 | Jid groupSelfContact = null; |
| 446 | //#ifndef WMUC |
| 447 | if (g instanceof ConferenceGroup) { |
| 448 | ConferenceGroup cg = (ConferenceGroup) g; |
| 449 | groupSelfContact = cg.selfContact.jid; |
| 450 | if (!cg.inRoom) { |
| 451 | int index = 0; |
| 452 | boolean removeGroup = true; |
| 453 | synchronized (hContacts) { |
| 454 | int j = hContacts.size(); |
| 455 | while (index < j) { |
| 456 | Contact contact = (Contact) hContacts.elementAt(index); |
| 457 | if (contact.group.name.equals(g.name)) { |
| 458 | if (contact.getNewMsgsCount() == 0) { |
| 459 | contact.msgs.removeAllElements(); |
| 460 | hContacts.removeElementAt(index); |
| 461 | j--; |
| 462 | } else { |
| 463 | removeGroup = false; |
| 464 | index++; |
| 465 | } |
| 466 | } else { |
| 467 | index++; |
| 468 | } |
| 469 | } |
| 470 | if (removeGroup) { |
| 471 | groups.removeGroup(g); |
| 472 | } else { |
| 473 | return; |
| 474 | } |
| 475 | } |
| 476 | }// else return; |
| 477 | } |
| 478 | //#endif |
| 479 | int index = 0; |
| 480 | |
| 481 | synchronized (hContacts) { |
| 482 | int j = hContacts.size(); |
| 483 | while (index < j) { |
| 484 | Contact contact = (Contact) hContacts.elementAt(index); |
| 485 | if (contact.group.name.equals(g.name)) { |
| 486 | if (contact.origin > Contact.ORIGIN_ROSTERRES |
| 487 | && contact.status >= Presence.PRESENCE_OFFLINE |
| 488 | && !contact.haveChatMessages() |
| 489 | && !contact.jid.equals(groupSelfContact, true) |
| 490 | && contact.origin != Contact.ORIGIN_GROUPCHAT) { |
| 491 | |
| 492 | contact.msgs.removeAllElements(); |
no test coverage detected