ContactGroup.getContactItemByJID not contains the offline items?

public ContactItem getContactItemByJID(String bareJID) {

for (ContactItem item : new ArrayList(contactItems)) {

if (item.getJID().equals(bareJID)) {

return item;

}

}

return null;

}

public ContactItem getContactItemByJID(String bareJID) {
        for (ContactItem item : new ArrayList<ContactItem>(contactItems)) {
            if (item.getJID().equals(bareJID)) {
                return item;
            }
        }
        return null;
}

should we check the offlineContacts,too?

I’m not exactly sure what you are asking?

You can chose to display offline contacts with the group they are associated with or within their own “offline” group.

Yes. You are right. It don’t contain offline items. You should manually check offline list.

You could use getOfflineContacts() method to get list of offline contacts and manualy search your jid there.

something like this:

for (ContactItem offlineItem : group.getOfflineContacts() ) {
     if ( offlineItem != null && offlineItem.getJID().equalsIgnoreCase(jid) ) {
     //do something
     }
}

for( ContactGroup group : SparkManager.getWorkspace().getContactList().getContactGroups() ) {

for (ContactItem offlineItem : group.getOfflineContacts() ) {

if ( offlineItem != null && offlineItem.getJID().equalsIgnoreCase(jid) ) {

offlineItem.setSideIcon( SparkRes.getImageIcon( SparkRes.BLOCK_CONTACT_16x16 ) );

}

}

}

I think we should add ability to search into offline contacts

So,I have another quetion about this.With the move/copy menu in the contact list,it just check the online contact items when it decide if or not add to the target group.So if the target group contains the item in the offline contact list,it will still add it again.Then the list show duplicate items.

I created issue SPARK-1194. I’ll try to fix it in few days.