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()) {
|
for (final String group : getGroups()) {
|
||||||
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
||||||
}
|
}
|
||||||
Presence.Status status = getMostAvailableStatus();
|
Presence.Status status = getShownStatus();
|
||||||
if (status != Presence.Status.OFFLINE) {
|
if (status != Presence.Status.OFFLINE) {
|
||||||
tags.add(UIHelper.getTagForStatus(context, status));
|
tags.add(UIHelper.getTagForStatus(context, status));
|
||||||
}
|
}
|
||||||
|
@ -237,13 +237,8 @@ public class Contact implements ListItem, Blockable {
|
||||||
this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST);
|
this.resetOption(Options.PENDING_SUBSCRIPTION_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Presence.Status getMostAvailableStatus() {
|
public Presence.Status getShownStatus() {
|
||||||
Presence p = this.presences.getMostAvailablePresence();
|
return this.presences.getShownStatus();
|
||||||
if (p == null) {
|
|
||||||
return Presence.Status.OFFLINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return p.getStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setPhotoUri(String uri) {
|
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) {
|
synchronized (this.presences) {
|
||||||
if (presences.size() < 1) { return null; }
|
for(Presence p : presences.values()) {
|
||||||
return Collections.min(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() {
|
public int size() {
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
if (activity.useSendButtonToIndicateStatus() && c != null
|
if (activity.useSendButtonToIndicateStatus() && c != null
|
||||||
&& c.getAccount().getStatus() == Account.State.ONLINE) {
|
&& c.getAccount().getStatus() == Account.State.ONLINE) {
|
||||||
if (c.getMode() == Conversation.MODE_SINGLE) {
|
if (c.getMode() == Conversation.MODE_SINGLE) {
|
||||||
status = c.getContact().getMostAvailableStatus();
|
status = c.getContact().getShownStatus();
|
||||||
} else {
|
} else {
|
||||||
status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE;
|
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.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.RunnableFuture;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
@ -893,8 +892,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
for (Account account : xmppConnectionService.getAccounts()) {
|
for (Account account : xmppConnectionService.getAccounts()) {
|
||||||
if (account.getStatus() != Account.State.DISABLED) {
|
if (account.getStatus() != Account.State.DISABLED) {
|
||||||
for (Contact contact : account.getRoster().getContacts()) {
|
for (Contact contact : account.getRoster().getContacts()) {
|
||||||
Presence p = contact.getPresences().getMostAvailablePresence();
|
Presence.Status s = contact.getShownStatus();
|
||||||
Presence.Status s = p == null ? Presence.Status.OFFLINE : p.getStatus();
|
|
||||||
if (contact.showInRoster() && contact.match(this, needle)
|
if (contact.showInRoster() && contact.match(this, needle)
|
||||||
&& (!this.mHideOfflineContacts
|
&& (!this.mHideOfflineContacts
|
||||||
|| (needle != null && !needle.trim().isEmpty())
|
|| (needle != null && !needle.trim().isEmpty())
|
||||||
|
|
Loading…
Reference in a new issue