aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-02-21 22:19:10 +0100
committeriNPUTmice <daniel@gultsch.de>2015-02-21 22:19:10 +0100
commit3db5a48529949b2219b036495f412ea383707524 (patch)
treee7b4995276dcc641df354b6d88de9f52d3d85e57 /src
parent7ee5e959597cfded524c7179b663138aca781ad8 (diff)
clear muc tiles cache only when necessary
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java15
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java8
2 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index 27821c65..2fd4db74 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -150,6 +150,21 @@ public class MucOptions {
}
}
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ } else if (!(other instanceof User)) {
+ return false;
+ } else {
+ User o = (User) other;
+ return name != null && name.equals(o.name)
+ && jid != null && jid.equals(o.jid)
+ && affiliation == o.affiliation
+ && role == o.role;
+ }
+ }
+
public Affiliation getAffiliation() {
return this.affiliation;
}
diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
index accb56ea..a7752842 100644
--- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
@@ -1,5 +1,7 @@
package eu.siacs.conversations.parser;
+import java.util.ArrayList;
+
import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -27,8 +29,12 @@ public class PresenceParser extends AbstractParser implements
final MucOptions mucOptions = conversation.getMucOptions();
boolean before = mucOptions.online();
int count = mucOptions.getUsers().size();
+ final ArrayList<MucOptions.User> tileUserBefore = new ArrayList<>(mucOptions.getUsers().subList(0,Math.min(mucOptions.getUsers().size(),4)));
mucOptions.processPacket(packet, mPgpEngine);
- mXmppConnectionService.getAvatarService().clear(conversation);
+ final ArrayList<MucOptions.User> tileUserAfter = new ArrayList<>(mucOptions.getUsers().subList(0,Math.min(mucOptions.getUsers().size(),4)));
+ if (!tileUserAfter.equals(tileUserBefore)) {
+ mXmppConnectionService.getAvatarService().clear(conversation);
+ }
if (before != mucOptions.online() || (mucOptions.online() && count != mucOptions.getUsers().size())) {
mXmppConnectionService.updateConversationUi();
} else if (mucOptions.online()) {