Adjust message queries for handshake sync
This causes problems with group messages as the received date is null sometimes even though the status is RECEIVED. The ReceivedMessageProcessor on the client filters out the synced messages at the moment.
This commit is contained in:
@ -17,9 +17,10 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class Contact implements Serializable {
|
||||
|
||||
private final long id;
|
||||
private final transient Set<? extends Contact> contacts;
|
||||
private String name;
|
||||
protected final long id;
|
||||
protected final transient Set<? extends Contact> contacts;
|
||||
|
||||
protected String name;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
@ -55,19 +56,13 @@ public abstract class Contact implements Serializable {
|
||||
*/
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() { return String.format("Contact[id=%d,name=%s, contacts=%s]", id, name, contacts); }
|
||||
|
||||
/**
|
||||
* Provides a hash code based on the ID of this contact.
|
||||
*
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(id); }
|
||||
public final int hashCode() { return Objects.hash(id); }
|
||||
|
||||
/**
|
||||
* Tests equality to another object. If that object is a contact as well,
|
||||
@ -77,7 +72,7 @@ public abstract class Contact implements Serializable {
|
||||
* @return {code true} if both objects are contacts and have identical IDs
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public final boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Contact)) return false;
|
||||
return id == ((Contact) obj).id;
|
||||
|
@ -36,6 +36,9 @@ public final class Group extends Contact {
|
||||
*/
|
||||
public Group(long id, String name, Set<User> members) { super(id, name, members); }
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("Group[id=%d,name=%s,%d member(s)]", id, name, contacts.size()); }
|
||||
|
||||
private void readObject(ObjectInputStream inputStream) throws Exception {
|
||||
inputStream.defaultReadObject();
|
||||
var contacts = Contact.class.getDeclaredField("contacts");
|
||||
@ -51,5 +54,5 @@ public final class Group extends Contact {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Set<User> getContacts() { return (Set<User>) super.getContacts(); }
|
||||
public Set<User> getContacts() { return (Set<User>) contacts; }
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ public final class User extends Contact {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("User[id=%d,name=%s,status=%s,contacts=%s]", getID(), getName(), status, getContacts()); }
|
||||
public String toString() {
|
||||
return String.format("User[id=%d,name=%s,status=%s", id, name, status) + (contacts.isEmpty() ? "]" : "," + contacts.size() + " contact(s)]");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current status of this user
|
||||
|
Reference in New Issue
Block a user