aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities/Bookmark.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/entities/Bookmark.java')
-rw-r--r--src/eu/siacs/conversations/entities/Bookmark.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Bookmark.java b/src/eu/siacs/conversations/entities/Bookmark.java
index 596cbe01..14f010e7 100644
--- a/src/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/eu/siacs/conversations/entities/Bookmark.java
@@ -13,7 +13,9 @@ public class Bookmark implements ListItem {
private String jid;
private String nick;
private String name;
+ private String password;
private boolean autojoin;
+ private boolean providePassword;
private Conversation mJoinedConversation;
public Bookmark(Account account, String jid) {
@@ -35,6 +37,11 @@ public class Bookmark implements ListItem {
if (nick != null) {
bookmark.setNick(nick.getContent());
}
+ Element password = element.findChild("password");
+ if (password != null) {
+ bookmark.setPassword(password.getContent());
+ bookmark.setProvidePassword(true);
+ }
return bookmark;
}
@@ -50,6 +57,14 @@ public class Bookmark implements ListItem {
this.nick = nick;
}
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ private void setProvidePassword(boolean providePassword) {
+ this.providePassword = providePassword;
+ }
+
@Override
public int compareTo(ListItem another) {
return this.getDisplayName().compareToIgnoreCase(
@@ -81,6 +96,14 @@ public class Bookmark implements ListItem {
return autojoin;
}
+ public String getPassword() {
+ return this.password;
+ }
+
+ public boolean isProvidePassword() {
+ return this.providePassword;
+ }
+
public boolean match(String needle) {
return needle == null
|| getJid().contains(needle.toLowerCase(Locale.US))
@@ -125,6 +148,9 @@ public class Bookmark implements ListItem {
if (this.nick != null) {
element.addChild("nick").setContent(this.nick);
}
+ if (this.password != null && isProvidePassword()) {
+ element.addChild("password").setContent(this.password);
+ }
return element;
}