Added option to hide contacts without presence
This commit is contained in:
parent
99ad1dc6b7
commit
39bd99c8ca
2 changed files with 16 additions and 1 deletions
|
@ -96,6 +96,7 @@
|
|||
<bool name="allow_only_one_sip_address">false</bool>
|
||||
<bool name="display_contact_organization">true</bool>
|
||||
<bool name="hide_numbers_and_addresses_without_presence">false</bool>
|
||||
<bool name="hide_sip_contacts_without_presence">false</bool>
|
||||
<bool name="hide_non_linphone_contacts">false</bool>
|
||||
|
||||
<!-- Side Menu -->
|
||||
|
|
|
@ -56,6 +56,8 @@ import org.linphone.core.Friend;
|
|||
import org.linphone.core.FriendList;
|
||||
import org.linphone.core.FriendListListener;
|
||||
import org.linphone.core.MagicSearch;
|
||||
import org.linphone.core.PresenceBasicStatus;
|
||||
import org.linphone.core.PresenceModel;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
|
@ -516,7 +518,19 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
if (indexOf < 0) {
|
||||
contacts.add(contact);
|
||||
if (contact.hasAddress()) {
|
||||
sipContacts.add(contact);
|
||||
if (mActivity.getResources().getBoolean(R.bool.hide_sip_contacts_without_presence)) {
|
||||
if (contact.getFriend() != null) {
|
||||
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
||||
PresenceModel pm = contact.getFriend().getPresenceModelForUriOrTel(noa.getValue());
|
||||
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
||||
sipContacts.add(contact);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sipContacts.add(contact);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.w("Contact " + contact.getFullName() + " (" + contact.getAndroidId() +
|
||||
|
|
Loading…
Reference in a new issue