aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities/Roster.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities/Roster.java')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Roster.java148
1 files changed, 74 insertions, 74 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Roster.java b/src/main/java/de/pixart/messenger/entities/Roster.java
index e267142bc..bdb7265f3 100644
--- a/src/main/java/de/pixart/messenger/entities/Roster.java
+++ b/src/main/java/de/pixart/messenger/entities/Roster.java
@@ -8,89 +8,89 @@ import java.util.List;
import de.pixart.messenger.xmpp.jid.Jid;
public class Roster {
- final Account account;
- final HashMap<Jid, Contact> contacts = new HashMap<>();
- private String version = null;
+ final Account account;
+ final HashMap<Jid, Contact> contacts = new HashMap<>();
+ private String version = null;
- public Roster(Account account) {
- this.account = account;
- }
+ public Roster(Account account) {
+ this.account = account;
+ }
- public Contact getContactFromRoster(Jid jid) {
- if (jid == null) {
- return null;
- }
- synchronized (this.contacts) {
- Contact contact = contacts.get(jid.toBareJid());
- if (contact != null && contact.showInRoster()) {
- return contact;
- } else {
- return null;
- }
- }
- }
+ public Contact getContactFromRoster(Jid jid) {
+ if (jid == null) {
+ return null;
+ }
+ synchronized (this.contacts) {
+ Contact contact = contacts.get(jid.toBareJid());
+ if (contact != null && contact.showInRoster()) {
+ return contact;
+ } else {
+ return null;
+ }
+ }
+ }
- public Contact getContact(final Jid jid) {
- synchronized (this.contacts) {
- if (!contacts.containsKey(jid.toBareJid())) {
- Contact contact = new Contact(jid.toBareJid());
- contact.setAccount(account);
- contacts.put(contact.getJid().toBareJid(), contact);
- return contact;
- }
- return contacts.get(jid.toBareJid());
- }
- }
+ public Contact getContact(final Jid jid) {
+ synchronized (this.contacts) {
+ if (!contacts.containsKey(jid.toBareJid())) {
+ Contact contact = new Contact(jid.toBareJid());
+ contact.setAccount(account);
+ contacts.put(contact.getJid().toBareJid(), contact);
+ return contact;
+ }
+ return contacts.get(jid.toBareJid());
+ }
+ }
- public void clearPresences() {
- for (Contact contact : getContacts()) {
- contact.clearPresences();
- }
- }
+ public void clearPresences() {
+ for (Contact contact : getContacts()) {
+ contact.clearPresences();
+ }
+ }
- public void markAllAsNotInRoster() {
- for (Contact contact : getContacts()) {
- contact.resetOption(Contact.Options.IN_ROSTER);
- }
- }
+ public void markAllAsNotInRoster() {
+ for (Contact contact : getContacts()) {
+ contact.resetOption(Contact.Options.IN_ROSTER);
+ }
+ }
- public List<Contact> getWithSystemAccounts() {
- List<Contact> with = getContacts();
- for(Iterator<Contact> iterator = with.iterator(); iterator.hasNext();) {
- Contact contact = iterator.next();
- if (contact.getSystemAccount() == null) {
- iterator.remove();
- }
- }
- return with;
- }
+ public List<Contact> getWithSystemAccounts() {
+ List<Contact> with = getContacts();
+ for (Iterator<Contact> iterator = with.iterator(); iterator.hasNext(); ) {
+ Contact contact = iterator.next();
+ if (contact.getSystemAccount() == null) {
+ iterator.remove();
+ }
+ }
+ return with;
+ }
- public List<Contact> getContacts() {
- synchronized (this.contacts) {
- return new ArrayList<>(this.contacts.values());
- }
- }
+ public List<Contact> getContacts() {
+ synchronized (this.contacts) {
+ return new ArrayList<>(this.contacts.values());
+ }
+ }
- public void initContact(final Contact contact) {
- if (contact == null) {
- return;
- }
- contact.setAccount(account);
- contact.setOption(Contact.Options.IN_ROSTER);
- synchronized (this.contacts) {
- contacts.put(contact.getJid().toBareJid(), contact);
- }
- }
+ public void initContact(final Contact contact) {
+ if (contact == null) {
+ return;
+ }
+ contact.setAccount(account);
+ contact.setOption(Contact.Options.IN_ROSTER);
+ synchronized (this.contacts) {
+ contacts.put(contact.getJid().toBareJid(), contact);
+ }
+ }
- public void setVersion(String version) {
- this.version = version;
- }
+ public void setVersion(String version) {
+ this.version = version;
+ }
- public String getVersion() {
- return this.version;
- }
+ public String getVersion() {
+ return this.version;
+ }
- public Account getAccount() {
- return this.account;
- }
+ public Account getAccount() {
+ return this.account;
+ }
}