aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java30
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Blockable.java11
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Bookmark.java1
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Contact.java52
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java72
-rw-r--r--src/main/java/eu/siacs/conversations/entities/ListItem.java8
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java24
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java66
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Roster.java10
9 files changed, 171 insertions, 103 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index d9001017..d42974c6 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -11,8 +11,10 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.security.interfaces.DSAPublicKey;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -56,7 +58,7 @@ public class Account extends AbstractEntity {
SECURITY_ERROR(true),
INCOMPATIBLE_SERVER(true);
- private boolean isError;
+ private final boolean isError;
public boolean isError() {
return this.isError;
@@ -120,6 +122,7 @@ public class Account extends AbstractEntity {
private String otrFingerprint;
private final Roster roster = new Roster(this);
private List<Bookmark> bookmarks = new CopyOnWriteArrayList<>();
+ private final Collection<Jid> blocklist = new CopyOnWriteArraySet<>();
public Account() {
this.uuid = "0";
@@ -279,7 +282,7 @@ public class Account extends AbstractEntity {
return values;
}
- public void initOtrEngine(XmppConnectionService context) {
+ public void initOtrEngine(final XmppConnectionService context) {
this.otrEngine = new OtrEngine(context, this);
}
@@ -291,7 +294,7 @@ public class Account extends AbstractEntity {
return this.xmppConnection;
}
- public void setXmppConnection(XmppConnection connection) {
+ public void setXmppConnection(final XmppConnection connection) {
this.xmppConnection = connection;
}
@@ -323,7 +326,7 @@ public class Account extends AbstractEntity {
}
}
- public void setRosterVersion(String version) {
+ public void setRosterVersion(final String version) {
this.rosterVersion = version;
}
@@ -351,7 +354,7 @@ public class Account extends AbstractEntity {
return this.bookmarks;
}
- public void setBookmarks(List<Bookmark> bookmarks) {
+ public void setBookmarks(final List<Bookmark> bookmarks) {
this.bookmarks = bookmarks;
}
@@ -399,4 +402,21 @@ public class Account extends AbstractEntity {
return "xmpp:" + this.getJid().toBareJid().toString();
}
}
+
+ public boolean isBlocked(final ListItem contact) {
+ final Jid jid = contact.getJid();
+ return jid != null && (blocklist.contains(jid.toBareJid()) || blocklist.contains(jid.toDomainJid()));
+ }
+
+ public boolean isBlocked(final Jid jid) {
+ return jid != null && blocklist.contains(jid.toBareJid());
+ }
+
+ public Collection<Jid> getBlocklist() {
+ return this.blocklist;
+ }
+
+ public void clearBlocklist() {
+ getBlocklist().clear();
+ }
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Blockable.java b/src/main/java/eu/siacs/conversations/entities/Blockable.java
new file mode 100644
index 00000000..dbcd55c4
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/entities/Blockable.java
@@ -0,0 +1,11 @@
+package eu.siacs.conversations.entities;
+
+import eu.siacs.conversations.xmpp.jid.Jid;
+
+public interface Blockable {
+ public boolean isBlocked();
+ public boolean isDomainBlocked();
+ public Jid getBlockedJid();
+ public Jid getJid();
+ public Account getAccount();
+}
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
index 20905648..f81f1a87 100644
--- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
@@ -6,7 +6,6 @@ import java.util.Locale;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element;
-import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
public class Bookmark extends Element implements ListItem {
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java
index 0820504f..af26981e 100644
--- a/src/main/java/eu/siacs/conversations/entities/Contact.java
+++ b/src/main/java/eu/siacs/conversations/entities/Contact.java
@@ -16,7 +16,7 @@ import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
-public class Contact implements ListItem {
+public class Contact implements ListItem, Blockable {
public static final String TABLENAME = "contacts";
public static final String SYSTEMNAME = "systemname";
@@ -47,8 +47,8 @@ public class Contact implements ListItem {
protected Account account;
public Contact(final String account, final String systemName, final String serverName,
- final Jid jid, final int subscription, final String photoUri,
- final String systemAccount, final String keys, final String avatar, final Lastseen lastseen, final String groups) {
+ final Jid jid, final int subscription, final String photoUri,
+ final String systemAccount, final String keys, final String avatar, final Lastseen lastseen, final String groups) {
this.accountUuid = account;
this.systemName = systemName;
this.serverName = serverName;
@@ -122,11 +122,10 @@ public class Contact implements ListItem {
@Override
public List<Tag> getTags() {
- ArrayList<Tag> tags = new ArrayList<Tag>();
- for (String group : getGroups()) {
+ final ArrayList<Tag> tags = new ArrayList<>();
+ for (final String group : getGroups()) {
tags.add(new Tag(group, UIHelper.getColorForName(group)));
}
- int status = getMostAvailableStatus();
switch (getMostAvailableStatus()) {
case Presences.CHAT:
case Presences.ONLINE:
@@ -142,6 +141,9 @@ public class Contact implements ListItem {
tags.add(new Tag("dnd", 0xffe51c23));
break;
}
+ if (isBlocked()) {
+ tags.add(new Tag("blocked", 0xff2e2f3b));
+ }
return tags;
}
@@ -176,7 +178,7 @@ public class Contact implements ListItem {
}
public ContentValues getContentValues() {
- ContentValues values = new ContentValues();
+ final ContentValues values = new ContentValues();
values.put(ACCOUNT, accountUuid);
values.put(SYSTEMNAME, systemName);
values.put(SERVERNAME, serverName);
@@ -213,11 +215,11 @@ public class Contact implements ListItem {
this.presences = pres;
}
- public void updatePresence(String resource, int status) {
+ public void updatePresence(final String resource, final int status) {
this.presences.updatePresence(resource, status);
}
- public void removePresence(String resource) {
+ public void removePresence(final String resource) {
this.presences.removePresence(resource);
}
@@ -337,8 +339,8 @@ public class Contact implements ListItem {
public boolean showInRoster() {
return (this.getOption(Contact.Options.IN_ROSTER) && (!this
- .getOption(Contact.Options.DIRTY_DELETE)))
- || (this.getOption(Contact.Options.DIRTY_PUSH));
+ .getOption(Contact.Options.DIRTY_DELETE)))
+ || (this.getOption(Contact.Options.DIRTY_PUSH));
}
public void parseSubscriptionFromElement(Element item) {
@@ -428,7 +430,7 @@ public class Contact implements ListItem {
if (this.keys.has("otr_fingerprints")) {
JSONArray newPrints = new JSONArray();
JSONArray oldPrints = this.keys
- .getJSONArray("otr_fingerprints");
+ .getJSONArray("otr_fingerprints");
for (int i = 0; i < oldPrints.length(); ++i) {
if (!oldPrints.getString(i).equals(fingerprint)) {
newPrints.put(oldPrints.getString(i));
@@ -457,22 +459,40 @@ public class Contact implements ListItem {
}
}
+ @Override
+ public boolean isBlocked() {
+ return getAccount().isBlocked(this);
+ }
+
+ @Override
+ public boolean isDomainBlocked() {
+ return getAccount().isBlocked(this.getJid().toDomainJid());
+ }
+
+ @Override
+ public Jid getBlockedJid() {
+ if (isDomainBlocked()) {
+ return getJid().toDomainJid();
+ } else {
+ return getJid();
+ }
+ }
+
public static class Lastseen {
public long time;
public String presence;
public Lastseen() {
- time = 0;
- presence = null;
+ this(null, 0);
}
public Lastseen(final String presence, final long time) {
- this.time = time;
this.presence = presence;
+ this.time = time;
}
}
- public class Options {
+ public final class Options {
public static final int TO = 0;
public static final int FROM = 1;
public static final int ASKING = 2;
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index e8482a96..22ddd307 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -3,7 +3,6 @@ package eu.siacs.conversations.entities;
import android.content.ContentValues;
import android.database.Cursor;
import android.os.SystemClock;
-import android.util.Log;
import net.java.otr4j.OtrException;
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
@@ -25,7 +24,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
-public class Conversation extends AbstractEntity {
+public class Conversation extends AbstractEntity implements Blockable {
public static final String TABLENAME = "conversations";
public static final int STATUS_AVAILABLE = 0;
@@ -105,7 +104,7 @@ public class Conversation extends AbstractEntity {
if ((message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE)
&& message.getEncryption() != Message.ENCRYPTION_PGP) {
onMessageFound.onMessageFound(message);
- }
+ }
}
}
}
@@ -117,7 +116,7 @@ public class Conversation extends AbstractEntity {
&& message.getEncryption() != Message.ENCRYPTION_PGP
&& message.getUuid().equals(uuid)) {
return message;
- }
+ }
}
}
return null;
@@ -145,7 +144,7 @@ public class Conversation extends AbstractEntity {
if ((message.getStatus() == Message.STATUS_UNSEND || message.getStatus() == Message.STATUS_WAITING)
&& (message.getEncryption() == Message.ENCRYPTION_OTR)) {
onMessageFound.onMessageFound(message);
- }
+ }
}
}
}
@@ -156,7 +155,7 @@ public class Conversation extends AbstractEntity {
if (message.getType() != Message.TYPE_IMAGE
&& message.getStatus() == Message.STATUS_UNSEND) {
onMessageFound.onMessageFound(message);
- }
+ }
}
}
}
@@ -166,21 +165,37 @@ public class Conversation extends AbstractEntity {
for (Message message : this.messages) {
if (uuid.equals(message.getUuid())
|| (message.getStatus() >= Message.STATUS_SEND && uuid
- .equals(message.getRemoteMsgId()))) {
+ .equals(message.getRemoteMsgId()))) {
return message;
- }
+ }
}
}
return null;
}
- public void populateWithMessages(List<Message> messages) {
+ public void populateWithMessages(final List<Message> messages) {
synchronized (this.messages) {
messages.clear();
messages.addAll(this.messages);
}
}
+ @Override
+ public boolean isBlocked() {
+ return getContact().isBlocked();
+ }
+
+ @Override
+ public boolean isDomainBlocked() {
+ return getContact().isDomainBlocked();
+ }
+
+ @Override
+ public Jid getBlockedJid() {
+ return getContact().getBlockedJid();
+ }
+
+
public interface OnMessageFound {
public void onMessageFound(final Message message);
}
@@ -212,8 +227,8 @@ public class Conversation extends AbstractEntity {
}
public boolean isRead() {
- return (this.messages == null) || (this.messages.size() == 0) || this.messages.get(this.messages.size() - 1).isRead();
- }
+ return (this.messages == null) || (this.messages.size() == 0) || this.messages.get(this.messages.size() - 1).isRead();
+ }
public void markRead() {
if (this.messages == null) {
@@ -239,7 +254,7 @@ public class Conversation extends AbstractEntity {
} else {
return this.messages.get(i);
}
- }
+ }
}
return null;
}
@@ -267,7 +282,7 @@ public class Conversation extends AbstractEntity {
if (generatedName != null) {
return generatedName;
} else {
- return getContactJid().getLocalpart();
+ return getJid().getLocalpart();
}
}
} else {
@@ -287,11 +302,12 @@ public class Conversation extends AbstractEntity {
return this.account.getRoster().getContact(this.contactJid);
}
- public void setAccount(Account account) {
+ public void setAccount(final Account account) {
this.account = account;
}
- public Jid getContactJid() {
+ @Override
+ public Jid getJid() {
return this.contactJid;
}
@@ -318,14 +334,14 @@ public class Conversation extends AbstractEntity {
}
public static Conversation fromCursor(Cursor cursor) {
- Jid jid;
- try {
- jid = Jid.fromString(cursor.getString(cursor.getColumnIndex(CONTACTJID)));
- } catch (final InvalidJidException e) {
- // Borked DB..
- jid = null;
- }
- return new Conversation(cursor.getString(cursor.getColumnIndex(UUID)),
+ Jid jid;
+ try {
+ jid = Jid.fromString(cursor.getString(cursor.getColumnIndex(CONTACTJID)));
+ } catch (final InvalidJidException e) {
+ // Borked DB..
+ jid = null;
+ }
+ return new Conversation(cursor.getString(cursor.getColumnIndex(UUID)),
cursor.getString(cursor.getColumnIndex(NAME)),
cursor.getString(cursor.getColumnIndex(CONTACT)),
cursor.getString(cursor.getColumnIndex(ACCOUNT)),
@@ -352,9 +368,9 @@ public class Conversation extends AbstractEntity {
if (this.otrSession != null) {
return this.otrSession;
} else {
- final SessionID sessionId = new SessionID(this.getContactJid().toBareJid().toString(),
- presence,
- "xmpp");
+ final SessionID sessionId = new SessionID(this.getJid().toBareJid().toString(),
+ presence,
+ "xmpp");
this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine());
try {
if (sendStart) {
@@ -393,7 +409,7 @@ public class Conversation extends AbstractEntity {
} catch (OtrException e) {
this.resetOtrSession();
}
- }
+ }
}
public boolean endOtrIfNeeded() {
@@ -427,7 +443,7 @@ public class Conversation extends AbstractEntity {
return "";
}
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession()
- .getRemotePublicKey();
+ .getRemotePublicKey();
StringBuilder builder = new StringBuilder(
new OtrCryptoEngineImpl().getFingerprint(remotePubKey));
builder.insert(8, " ");
diff --git a/src/main/java/eu/siacs/conversations/entities/ListItem.java b/src/main/java/eu/siacs/conversations/entities/ListItem.java
index db9fbc37..efc1c2b9 100644
--- a/src/main/java/eu/siacs/conversations/entities/ListItem.java
+++ b/src/main/java/eu/siacs/conversations/entities/ListItem.java
@@ -12,10 +12,10 @@ public interface ListItem extends Comparable<ListItem> {
public List<Tag> getTags();
public final class Tag {
- private String name;
- private int color;
+ private final String name;
+ private final int color;
- public Tag(String name, int color) {
+ public Tag(final String name, final int color) {
this.name = name;
this.color = color;
}
@@ -28,4 +28,6 @@ public interface ListItem extends Comparable<ListItem> {
return this.name;
}
}
+
+ public boolean match(final String needle);
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 5b937138..38e88fa4 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -77,7 +77,7 @@ public class Message extends AbstractEntity {
public Message(Conversation conversation, String body, int encryption, int status) {
this(java.util.UUID.randomUUID().toString(),
conversation.getUuid(),
- conversation.getContactJid() == null ? null : conversation.getContactJid().toBareJid(),
+ conversation.getJid() == null ? null : conversation.getJid().toBareJid(),
null,
body,
System.currentTimeMillis(),
@@ -91,9 +91,9 @@ public class Message extends AbstractEntity {
}
private Message(final String uuid, final String conversationUUid, final Jid counterpart,
- final Jid trueCounterpart, final String body, final long timeSent,
- final int encryption, final int status, final int type, final String remoteMsgId,
- final String relativeFilePath, final String serverMsgId) {
+ final Jid trueCounterpart, final String body, final long timeSent,
+ final int encryption, final int status, final int type, final String remoteMsgId,
+ final String relativeFilePath, final String serverMsgId) {
this.uuid = uuid;
this.conversationUuid = conversationUUid;
this.counterpart = counterpart;
@@ -206,7 +206,7 @@ public class Message extends AbstractEntity {
return null;
} else {
return this.conversation.getAccount().getRoster()
- .getContactFromRoster(this.trueCounterpart);
+ .getContactFromRoster(this.trueCounterpart);
}
}
}
@@ -312,10 +312,10 @@ public class Message extends AbstractEntity {
return this.serverMsgId.equals(message.getServerMsgId());
} else {
return this.body != null
- && this.counterpart != null
- && ((this.remoteMsgId != null && this.remoteMsgId.equals(message.getRemoteMsgId()))
- || this.uuid.equals(message.getRemoteMsgId())) && this.body.equals(message.getBody())
- && this.counterpart.equals(message.getCounterpart());
+ && this.counterpart != null
+ && ((this.remoteMsgId != null && this.remoteMsgId.equals(message.getRemoteMsgId()))
+ || this.uuid.equals(message.getRemoteMsgId())) && this.body.equals(message.getBody())
+ && this.counterpart.equals(message.getCounterpart());
}
}
@@ -388,7 +388,7 @@ public class Message extends AbstractEntity {
if (!url.getProtocol().equalsIgnoreCase("http")
&& !url.getProtocol().equalsIgnoreCase("https")) {
return false;
- }
+ }
if (url.getPath() == null) {
return false;
}
@@ -402,14 +402,14 @@ public class Message extends AbstractEntity {
String[] extensionParts = filename.split("\\.");
if (extensionParts.length == 2
&& Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(
- extensionParts[extensionParts.length - 1])) {
+ extensionParts[extensionParts.length - 1])) {
return true;
} else if (extensionParts.length == 3
&& Arrays
.asList(Downloadable.VALID_CRYPTO_EXTENSIONS)
.contains(extensionParts[extensionParts.length - 1])
&& Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(
- extensionParts[extensionParts.length - 2])) {
+ extensionParts[extensionParts.length - 2])) {
return true;
} else {
return false;
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index c8706fc9..97a63532 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -80,20 +80,20 @@ public class MucOptions {
public void setRole(String role) {
role = role.toLowerCase();
- switch (role) {
- case "moderator":
- this.role = ROLE_MODERATOR;
- break;
- case "participant":
- this.role = ROLE_PARTICIPANT;
- break;
- case "visitor":
- this.role = ROLE_VISITOR;
- break;
- default:
- this.role = ROLE_NONE;
- break;
- }
+ switch (role) {
+ case "moderator":
+ this.role = ROLE_MODERATOR;
+ break;
+ case "participant":
+ this.role = ROLE_PARTICIPANT;
+ break;
+ case "visitor":
+ this.role = ROLE_VISITOR;
+ break;
+ default:
+ this.role = ROLE_NONE;
+ break;
+ }
}
public int getAffiliation() {
@@ -164,7 +164,7 @@ public class MucOptions {
}
public void processPacket(PresencePacket packet, PgpEngine pgp) {
- final Jid from = packet.getFrom();
+ final Jid from = packet.getFrom();
if (!from.isBareJid()) {
final String name = from.getResourcepart();
final String type = packet.getAttribute("type");
@@ -179,7 +179,7 @@ public class MucOptions {
user.setAffiliation(item.getAttribute("affiliation"));
user.setRole(item.getAttribute("role"));
user.setJid(item.getAttributeAsJid("jid"));
- if (codes.contains(STATUS_CODE_SELF_PRESENCE) || packet.getFrom().equals(this.conversation.getContactJid())) {
+ if (codes.contains(STATUS_CODE_SELF_PRESENCE) || packet.getFrom().equals(this.conversation.getJid())) {
this.isOnline = true;
this.error = ERROR_NO_ERROR;
self = user;
@@ -204,14 +204,14 @@ public class MucOptions {
msg = "";
}
user.setPgpKeyId(pgp.fetchKeyId(account, msg,
- signed.getContent()));
+ signed.getContent()));
}
}
}
}
} else if (type.equals("unavailable")) {
if (codes.contains(STATUS_CODE_SELF_PRESENCE) ||
- packet.getFrom().equals(this.conversation.getContactJid())) {
+ packet.getFrom().equals(this.conversation.getJid())) {
if (codes.contains(STATUS_CODE_CHANGED_NICK)) {
this.mNickChangingInProgress = true;
} else if (codes.contains(STATUS_CODE_KICKED)) {
@@ -282,8 +282,8 @@ public class MucOptions {
&& conversation.getBookmark().getNick() != null
&& !conversation.getBookmark().getNick().isEmpty()) {
return conversation.getBookmark().getNick();
- } else if (!conversation.getContactJid().isBareJid()) {
- return conversation.getContactJid().getResourcepart();
+ } else if (!conversation.getJid().isBareJid()) {
+ return conversation.getJid().getResourcepart();
} else {
return account.getUsername();
}
@@ -334,14 +334,14 @@ public class MucOptions {
public String createNameFromParticipants() {
if (users.size() >= 2) {
List<String> names = new ArrayList<String>();
- for (User user : users) {
- Contact contact = user.getContact();
- if (contact != null && !contact.getDisplayName().isEmpty()) {
- names.add(contact.getDisplayName().split("\\s+")[0]);
- } else {
- names.add(user.getName());
- }
+ for (User user : users) {
+ Contact contact = user.getContact();
+ if (contact != null && !contact.getDisplayName().isEmpty()) {
+ names.add(contact.getDisplayName().split("\\s+")[0]);
+ } else {
+ names.add(user.getName());
}
+ }
StringBuilder builder = new StringBuilder();
for (int i = 0; i < names.size(); ++i) {
builder.append(names.get(i));
@@ -388,12 +388,12 @@ public class MucOptions {
}
public Jid createJoinJid(String nick) {
- try {
- return Jid.fromString(this.conversation.getContactJid().toBareJid().toString() + "/"+nick);
- } catch (final InvalidJidException e) {
- return null;
- }
- }
+ try {
+ return Jid.fromString(this.conversation.getJid().toBareJid().toString() + "/"+nick);
+ } catch (final InvalidJidException e) {
+ return null;
+ }
+ }
public Jid getTrueCounterpart(String counterpart) {
for (User user : this.getUsers()) {
diff --git a/src/main/java/eu/siacs/conversations/entities/Roster.java b/src/main/java/eu/siacs/conversations/entities/Roster.java
index 12a89cec..1a81a419 100644
--- a/src/main/java/eu/siacs/conversations/entities/Roster.java
+++ b/src/main/java/eu/siacs/conversations/entities/Roster.java
@@ -7,7 +7,7 @@ import java.util.concurrent.ConcurrentHashMap;
import eu.siacs.conversations.xmpp.jid.Jid;
public class Roster {
- Account account;
+ final Account account;
final ConcurrentHashMap<String, Contact> contacts = new ConcurrentHashMap<>();
private String version = null;
@@ -19,7 +19,7 @@ public class Roster {
if (jid == null) {
return null;
}
- Contact contact = contacts.get(jid.toBareJid().toString());
+ final Contact contact = contacts.get(jid.toBareJid().toString());
if (contact != null && contact.showInRoster()) {
return contact;
} else {
@@ -32,7 +32,7 @@ public class Roster {
if (contacts.containsKey(bareJid.toString())) {
return contacts.get(bareJid.toString());
} else {
- Contact contact = new Contact(bareJid);
+ final Contact contact = new Contact(bareJid);
contact.setAccount(account);
contacts.put(bareJid.toString(), contact);
return contact;
@@ -46,13 +46,13 @@ public class Roster {
}
public void markAllAsNotInRoster() {
- for (Contact contact : getContacts()) {
+ for (final Contact contact : getContacts()) {
contact.resetOption(Contact.Options.IN_ROSTER);
}
}
public void clearSystemAccounts() {
- for (Contact contact : getContacts()) {
+ for (final Contact contact : getContacts()) {
contact.setPhotoUri(null);
contact.setSystemName(null);
contact.setSystemAccount(null);