2019-11-18 23:51:27 +01:00
|
|
|
package org.mercury_im.messenger.entity.chat;
|
2019-11-08 00:47:17 +01:00
|
|
|
|
2020-07-30 19:52:58 +02:00
|
|
|
import org.jxmpp.jid.EntityJid;
|
|
|
|
import org.jxmpp.jid.impl.JidCreate;
|
2019-11-18 23:51:27 +01:00
|
|
|
import org.mercury_im.messenger.entity.Account;
|
2019-11-03 06:33:52 +01:00
|
|
|
|
2019-12-21 16:30:14 +01:00
|
|
|
import java.util.UUID;
|
|
|
|
|
2020-05-16 15:53:54 +02:00
|
|
|
import lombok.Data;
|
|
|
|
|
2019-12-06 20:48:27 +01:00
|
|
|
/**
|
|
|
|
* Generic interface defining shared properties of chats.
|
|
|
|
*
|
|
|
|
* Child interfaces of {@link Chat} are {@link DirectChat} and {@link GroupChat}.
|
|
|
|
*/
|
2020-05-16 15:53:54 +02:00
|
|
|
@Data
|
|
|
|
public abstract class Chat {
|
|
|
|
UUID id;
|
|
|
|
Account account;
|
2020-07-30 19:52:58 +02:00
|
|
|
ChatPreferences chatPreferences = new ChatPreferences();
|
2020-05-31 22:32:33 +02:00
|
|
|
|
|
|
|
public Chat() {
|
|
|
|
this.id = UUID.randomUUID();
|
|
|
|
}
|
2020-07-18 21:38:13 +02:00
|
|
|
|
|
|
|
public abstract String getAddress();
|
2020-07-30 19:52:58 +02:00
|
|
|
|
|
|
|
public EntityJid getJid() {
|
|
|
|
return JidCreate.entityFromOrThrowUnchecked(getAddress());
|
|
|
|
}
|
2019-11-03 06:33:52 +01:00
|
|
|
}
|