101 lines
2.0 KiB
Java
101 lines
2.0 KiB
Java
package org.mercury_im.messenger.entity.contact;
|
|
|
|
import org.mercury_im.messenger.entity.Account;
|
|
|
|
import java.util.UUID;
|
|
|
|
public class IPeer implements Peer {
|
|
|
|
protected UUID id;
|
|
protected Account account;
|
|
protected String address;
|
|
protected String name;
|
|
protected SubscriptionDirection subscriptionDirection;
|
|
protected boolean pending;
|
|
protected boolean approved;
|
|
|
|
public IPeer() {
|
|
this(UUID.randomUUID());
|
|
}
|
|
|
|
public IPeer(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
@Override
|
|
public UUID getId() {
|
|
return id;
|
|
}
|
|
|
|
@Override
|
|
public void setId(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
@Override
|
|
public Account getAccount() {
|
|
return account;
|
|
}
|
|
|
|
@Override
|
|
public void setAccount(Account account) {
|
|
this.account = account;
|
|
}
|
|
|
|
@Override
|
|
public String getAddress() {
|
|
return address;
|
|
}
|
|
|
|
@Override
|
|
public void setAddress(String address) {
|
|
this.address = address;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
@Override
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
@Override
|
|
public SubscriptionDirection getSubscriptionDirection() {
|
|
return subscriptionDirection;
|
|
}
|
|
|
|
@Override
|
|
public void setSubscriptionDirection(SubscriptionDirection mode) {
|
|
this.subscriptionDirection = mode;
|
|
}
|
|
|
|
@Override
|
|
public boolean isSubscriptionPending() {
|
|
return pending;
|
|
}
|
|
|
|
@Override
|
|
public void setSubscriptionPending(boolean pending) {
|
|
this.pending = pending;
|
|
}
|
|
|
|
@Override
|
|
public boolean isSubscriptionApproved() {
|
|
return approved;
|
|
}
|
|
|
|
@Override
|
|
public void setSubscriptionApproved(boolean approved) {
|
|
this.approved = approved;
|
|
}
|
|
|
|
@Override
|
|
public boolean isContact() {
|
|
return subscriptionDirection != SubscriptionDirection.none
|
|
&& subscriptionDirection != SubscriptionDirection.from;
|
|
}
|
|
}
|