aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-14 14:41:32 +0200
committerChristian Schneppe <christian@pix-art.de>2016-06-14 21:29:06 +0200
commitb951a2894a9ab4cbed9aa93359502481f9275d9e (patch)
treea5c2f15f46844606c2e4295c3af7aa62c29134ec /src/main/java/eu
parent6e660cb8974a3b8f938f0936deb4c3e6e2a53a27 (diff)
sort muc users by affiliation, name. fixes #1913
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index 159dced15..cafcf14fd 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -295,16 +295,22 @@ public class MucOptions {
@Override
public int compareTo(User another) {
- Contact ourContact = getContact();
- Contact anotherContact = another.getContact();
- if (ourContact != null && anotherContact != null) {
- return ourContact.compareTo(anotherContact);
- } else if (ourContact == null && anotherContact != null) {
- return getName().compareToIgnoreCase(anotherContact.getDisplayName());
- } else if (ourContact != null) {
- return ourContact.getDisplayName().compareToIgnoreCase(another.getName());
+ if (another.getAffiliation().outranks(getAffiliation())) {
+ return 1;
+ } else if (getAffiliation().outranks(another.getAffiliation())) {
+ return -1;
} else {
- return getName().compareToIgnoreCase(another.getName());
+ Contact ourContact = getContact();
+ Contact anotherContact = another.getContact();
+ if (ourContact != null && anotherContact != null) {
+ return ourContact.compareTo(anotherContact);
+ } else if (ourContact == null && anotherContact != null) {
+ return getName().compareToIgnoreCase(anotherContact.getDisplayName());
+ } else if (ourContact != null) {
+ return ourContact.getDisplayName().compareToIgnoreCase(another.getName());
+ } else {
+ return getName().compareToIgnoreCase(another.getName());
+ }
}
}