aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java b/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
index 9e67bf2d..07a77eae 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
@@ -2,12 +2,11 @@ package de.thedevstack.conversationsplus.entities;
import android.graphics.Color;
-import android.graphics.Color;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import de.thedevstack.conversationsplus.Config;
import de.thedevstack.conversationsplus.utils.UIHelper;
import de.thedevstack.conversationsplus.xml.Element;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
@@ -54,14 +53,26 @@ public class Bookmark extends Element implements ListItem {
if (this.mJoinedConversation != null
&& (this.mJoinedConversation.getMucOptions().getSubject() != null)) {
return this.mJoinedConversation.getMucOptions().getSubject();
- } else if (getName() != null) {
- return getName();
+ } else if (getBookmarkName() != null) {
+ return getBookmarkName();
} else {
return this.getJid().getLocalpart();
}
}
@Override
+ public String getDisplayJid() {
+ Jid jid = getJid();
+ if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) {
+ return jid.getLocalpart();
+ } else if (jid != null) {
+ return jid.toString();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
public Jid getJid() {
return this.getAttributeAsJid("jid");
}
@@ -143,12 +154,18 @@ public class Bookmark extends Element implements ListItem {
this.mJoinedConversation = conversation;
}
- public String getName() {
+ public String getBookmarkName() {
return this.getAttribute("name");
}
- public void setName(String name) {
- this.name = name;
+ public boolean setBookmarkName(String name) {
+ String before = getBookmarkName();
+ if (name != null && !name.equals(before)) {
+ this.setAttribute("name", name);
+ return true;
+ } else {
+ return false;
+ }
}
public void unregisterConversation() {