forked from mirror/monocles_chat_clean
Fix for concurrent modification
(cherry picked from commit 101bd8570363e546db9bf97ed1d543f4cc2f26cb)
This commit is contained in:
parent
fe81e690c9
commit
b821e9b06e
2 changed files with 17 additions and 13 deletions
|
@ -696,22 +696,26 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshCapsFor(Contact contact) {
|
public void refreshCapsFor(Contact contact) {
|
||||||
for (final var k : new HashSet<>(gateways.keySet())) {
|
synchronized (gateways) {
|
||||||
gateways.remove(k, contact);
|
for (final var k : new HashSet<>(gateways.keySet())) {
|
||||||
}
|
gateways.remove(k, contact);
|
||||||
for (final var p : contact.getPresences().getPresences()) {
|
}
|
||||||
final var disco = p.getServiceDiscoveryResult();
|
for (final var p : contact.getPresences().getPresences()) {
|
||||||
if (disco == null) continue;
|
final var disco = p.getServiceDiscoveryResult();
|
||||||
for (final var identity : disco.getIdentities()) {
|
if (disco == null) continue;
|
||||||
if ("gateway".equals(identity.getCategory())) {
|
for (final var identity : disco.getIdentities()) {
|
||||||
gateways.put(identity.getType(), contact);
|
if ("gateway".equals(identity.getCategory())) {
|
||||||
|
gateways.put(identity.getType(), contact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Contact> getGateways(final String type) {
|
public Collection<Contact> getGateways(final String type) {
|
||||||
return gateways.get(type);
|
synchronized (gateways) {
|
||||||
|
return ImmutableList.copyOf(gateways.get(type));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Bookmark> getBookmarks() {
|
public Collection<Bookmark> getBookmarks() {
|
||||||
|
|
|
@ -114,8 +114,8 @@ public class QuickConversationsService extends AbstractQuickConversationsService
|
||||||
|
|
||||||
protected Set<String> gateways(final Account account) {
|
protected Set<String> gateways(final Account account) {
|
||||||
return Stream.concat(
|
return Stream.concat(
|
||||||
ImmutableList.copyOf(account.getGateways("pstn")).stream(),
|
account.getGateways("pstn").stream(),
|
||||||
ImmutableList.copyOf(account.getGateways("sms")).stream()
|
account.getGateways("sms").stream()
|
||||||
).map(a -> a.getJid().asBareJid().toString()).collect(Collectors.toSet());
|
).map(a -> a.getJid().asBareJid().toString()).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue