mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-31 11:30:39 +00:00
Refactor receive api
This commit is contained in:
parent
b615a4b04d
commit
9075cc1a30
36 changed files with 1510 additions and 970 deletions
|
@ -1,18 +1,18 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.shared.SharedContact;
|
||||
|
||||
public record JsonContactName(
|
||||
String display, String given, String family, String prefix, String suffix, String middle
|
||||
) {
|
||||
|
||||
static JsonContactName from(SharedContact.Name name) {
|
||||
return new JsonContactName(Util.getStringIfNotBlank(name.getDisplay()),
|
||||
Util.getStringIfNotBlank(name.getGiven()),
|
||||
Util.getStringIfNotBlank(name.getFamily()),
|
||||
Util.getStringIfNotBlank(name.getPrefix()),
|
||||
Util.getStringIfNotBlank(name.getSuffix()),
|
||||
Util.getStringIfNotBlank(name.getMiddle()));
|
||||
static JsonContactName from(MessageEnvelope.Data.SharedContact.Name name) {
|
||||
return new JsonContactName(Util.getStringIfNotBlank(name.display()),
|
||||
Util.getStringIfNotBlank(name.given()),
|
||||
Util.getStringIfNotBlank(name.family()),
|
||||
Util.getStringIfNotBlank(name.prefix()),
|
||||
Util.getStringIfNotBlank(name.suffix()),
|
||||
Util.getStringIfNotBlank(name.middle()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue