aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities/Bookmark.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-15 14:32:19 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-15 14:32:19 +0200
commit2ebd92b7a7b97c7ecca43eb1e3c7d408508aadb2 (patch)
tree1da6fc297af9d9fa655a0dbce407fa5ec1f878d4 /src/eu/siacs/conversations/entities/Bookmark.java
parent6031af86062757f86701e08962aa86121877fbf4 (diff)
pushing bookmarks back to server
Diffstat (limited to 'src/eu/siacs/conversations/entities/Bookmark.java')
-rw-r--r--src/eu/siacs/conversations/entities/Bookmark.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/entities/Bookmark.java b/src/eu/siacs/conversations/entities/Bookmark.java
index 6c1d7258..c4e151cb 100644
--- a/src/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/eu/siacs/conversations/entities/Bookmark.java
@@ -16,13 +16,13 @@ public class Bookmark implements ListItem {
private boolean autojoin;
private Conversation mJoinedConversation;
- public Bookmark(Account account) {
+ public Bookmark(Account account, String jid) {
this.account = account;
+ this.jid = jid;
}
public static Bookmark parse(Element element, Account account) {
- Bookmark bookmark = new Bookmark(account);
- bookmark.setJid(element.getAttribute("jid"));
+ Bookmark bookmark = new Bookmark(account,element.getAttribute("jid"));
bookmark.setName(element.getAttribute("name"));
String autojoin = element.getAttribute("autojoin");
if (autojoin!=null && (autojoin.equals("true")||autojoin.equals("1"))) {
@@ -45,10 +45,6 @@ public class Bookmark implements ListItem {
this.name = name;
}
- public void setJid(String jid) {
- this.jid = jid;
- }
-
public void setNick(String nick) {
this.nick = nick;
}
@@ -60,8 +56,8 @@ public class Bookmark implements ListItem {
@Override
public String getDisplayName() {
- if (this.mJoinedConversation!=null) {
- return this.mJoinedConversation.getName(true);
+ if (this.mJoinedConversation!=null && (this.mJoinedConversation.getMucOptions().getSubject() != null)) {
+ return this.mJoinedConversation.getMucOptions().getSubject();
} else if (name!=null) {
return name;
} else {
@@ -109,4 +105,21 @@ public class Bookmark implements ListItem {
public String getName() {
return name;
}
+
+ public Element toElement() {
+ Element element = new Element("conference");
+ element.setAttribute("jid", this.getJid());
+ if (this.getName() != null) {
+ element.setAttribute("name", this.getName());
+ }
+ if (this.autojoin) {
+ element.setAttribute("autojoin", "true");
+ } else {
+ element.setAttribute("autojoin", "false");
+ }
+ if (this.nick != null) {
+ element.addChild("nick").setContent(this.nick);
+ }
+ return element;
+ }
}