aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-07-04 19:30:19 +0200
committerChristian Schneppe <christian@pix-art.de>2016-07-09 09:47:55 +0200
commit9115a30bb60d863361ea6828aaf756319de697ee (patch)
tree27e77fac678709abfc1e76c45754462d14ae27e3 /src/main/java/eu/siacs
parent54c00816400af8aa47fe5d3ca641d46b118dd356 (diff)
simplified muc users ordering
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index eb2963af7..bccf3d009 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -300,17 +300,18 @@ public class MucOptions {
} else if (getAffiliation().outranks(another.getAffiliation())) {
return -1;
} else {
- 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());
- }
+ return getComparableName().compareToIgnoreCase(another.getComparableName());
+ }
+ }
+
+
+ private String getComparableName() {
+ Contact contact = getContact();
+ if (contact != null) {
+ return contact.getDisplayName();
+ } else {
+ String name = getName();
+ return name == null ? "" : name;
}
}