mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 09:42:17 -05:00
use dnd as overriding status
This commit is contained in:
parent
91c3732c63
commit
30110431ba
@ -148,7 +148,7 @@ public class Contact implements ListItem, Blockable {
|
||||
for (final String group : getGroups()) {
|
||||
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
||||
}
|
||||
Presence.Status status = getMostAvailableStatus();
|
||||
Presence.Status status = getShownStatus();
|
||||
if (status != Presence.Status.OFFLINE) {
|
||||
tags.add(UIHelper.getTagForStatus(context, status));
|
||||
}
|
||||
@ -237,13 +237,8 @@ public class Contact implements ListItem, Blockable {
|
||||
this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST);
|
||||
}
|
||||
|
||||
public Presence.Status getMostAvailableStatus() {
|
||||
Presence p = this.presences.getMostAvailablePresence();
|
||||
if (p == null) {
|
||||
return Presence.Status.OFFLINE;
|
||||
}
|
||||
|
||||
return p.getStatus();
|
||||
public Presence.Status getShownStatus() {
|
||||
return this.presences.getShownStatus();
|
||||
}
|
||||
|
||||
public boolean setPhotoUri(String uri) {
|
||||
|
@ -34,11 +34,18 @@ public class Presences {
|
||||
}
|
||||
}
|
||||
|
||||
public Presence getMostAvailablePresence() {
|
||||
public Presence.Status getShownStatus() {
|
||||
Presence.Status status = Presence.Status.OFFLINE;
|
||||
synchronized (this.presences) {
|
||||
if (presences.size() < 1) { return null; }
|
||||
return Collections.min(presences.values());
|
||||
for(Presence p : presences.values()) {
|
||||
if (p.getStatus() == Presence.Status.DND) {
|
||||
return p.getStatus();
|
||||
} else if (p.getStatus().compareTo(status) < 0){
|
||||
status = p.getStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
@ -1083,7 +1083,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
if (activity.useSendButtonToIndicateStatus() && c != null
|
||||
&& c.getAccount().getStatus() == Account.State.ONLINE) {
|
||||
if (c.getMode() == Conversation.MODE_SINGLE) {
|
||||
status = c.getContact().getMostAvailableStatus();
|
||||
status = c.getContact().getShownStatus();
|
||||
} else {
|
||||
status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE;
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.RunnableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
@ -893,8 +892,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||
for (Account account : xmppConnectionService.getAccounts()) {
|
||||
if (account.getStatus() != Account.State.DISABLED) {
|
||||
for (Contact contact : account.getRoster().getContacts()) {
|
||||
Presence p = contact.getPresences().getMostAvailablePresence();
|
||||
Presence.Status s = p == null ? Presence.Status.OFFLINE : p.getStatus();
|
||||
Presence.Status s = contact.getShownStatus();
|
||||
if (contact.showInRoster() && contact.match(this, needle)
|
||||
&& (!this.mHideOfflineContacts
|
||||
|| (needle != null && !needle.trim().isEmpty())
|
||||
|
Loading…
Reference in New Issue
Block a user