mirror of
https://codeberg.org/Mercury-IM/Mercury-IM
synced 2024-06-15 16:14:52 +02:00
34 lines
769 B
Java
34 lines
769 B
Java
package org.mercury_im.messenger.entity.contact;
|
|
|
|
import org.mercury_im.messenger.entity.Account;
|
|
|
|
import java.util.UUID;
|
|
|
|
import lombok.Data;
|
|
|
|
/**
|
|
* Defines a user on the network (eg. a contact, chat partner, group chat member etc).
|
|
* Basically anyone that may send you a message is a Peer.
|
|
*/
|
|
@Data
|
|
public class Peer {
|
|
UUID id;
|
|
Account account;
|
|
String address;
|
|
String name;
|
|
SubscriptionDirection subscriptionDirection;
|
|
boolean subscriptionPending;
|
|
boolean subscriptionApproved;
|
|
|
|
public Peer() {
|
|
this.id = UUID.randomUUID();
|
|
}
|
|
|
|
public String getDisplayName() {
|
|
if (name != null && !name.trim().isEmpty()) {
|
|
return name;
|
|
}
|
|
return address.substring(0, address.indexOf('@'));
|
|
}
|
|
}
|