aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities/MucOptions.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index f1c3aa9e8..c6e0b6dc2 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -361,12 +361,11 @@ public class MucOptions {
private final Set<User> users = new HashSet<>();
private final List<String> features = new ArrayList<>();
private Data form = new Data();
- private Conversation conversation;
+ private final Conversation conversation;
private boolean isOnline = false;
private Error error = Error.NONE;
public OnRenameListener onRenameListener = null;
private User self;
- private String subject = null;
private String password = null;
public MucOptions(Conversation conversation) {
@@ -660,15 +659,37 @@ public class MucOptions {
return self;
}
- public void setSubject(String content) {
- this.subject = content;
+ public boolean setSubject(String subject) {
+ return this.conversation.setAttribute("subject", subject);
}
public String getSubject() {
- return this.subject;
+ return this.conversation.getAttribute("subject");
}
+ public List<User> getFallbackUsersFromCryptoTargets() {
+ List<User> users = new ArrayList<>();
+ for (Jid jid : conversation.getAcceptedCryptoTargets()) {
+ User user = new User(this, null);
+ user.setRealJid(jid);
+ users.add(user);
+ }
+ return users;
+ }
+
+ public List<User> getUsersRelevantForNameAndAvatar() {
+ final List<User> users;
+ if (isOnline) {
+ users = getUsers(5);
+ } else {
+ users = getFallbackUsersFromCryptoTargets();
+ }
+ return users;
+ }
+
+
public int NumberOfUsers() {
+ List<User> users = getUsersRelevantForNameAndAvatar();
if (users.size() >= 1) {
return users.size();
} else {
@@ -679,9 +700,10 @@ public class MucOptions {
public String createNameFromParticipants() {
+ List<User> users = getUsersRelevantForNameAndAvatar();
if (users.size() >= 1) {
StringBuilder builder = new StringBuilder();
- for (User user : getUsers(5)) {
+ for (User user : users) {
if (builder.length() != 0) {
builder.append(", ");
}