mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add handling for new nickname and note fields
This commit is contained in:
parent
e5ebb732cb
commit
e0cd5b987e
8 changed files with 56 additions and 1 deletions
|
@ -6,6 +6,9 @@ public record Contact(
|
||||||
String givenName,
|
String givenName,
|
||||||
String familyName,
|
String familyName,
|
||||||
String nickName,
|
String nickName,
|
||||||
|
String nickNameGivenName,
|
||||||
|
String nickNameFamilyName,
|
||||||
|
String note,
|
||||||
String color,
|
String color,
|
||||||
int messageExpirationTime,
|
int messageExpirationTime,
|
||||||
long muteUntil,
|
long muteUntil,
|
||||||
|
@ -21,6 +24,9 @@ public record Contact(
|
||||||
this(builder.givenName,
|
this(builder.givenName,
|
||||||
builder.familyName,
|
builder.familyName,
|
||||||
builder.nickName,
|
builder.nickName,
|
||||||
|
builder.nickNameGivenName,
|
||||||
|
builder.nickNameFamilyName,
|
||||||
|
builder.note,
|
||||||
builder.color,
|
builder.color,
|
||||||
builder.messageExpirationTime,
|
builder.messageExpirationTime,
|
||||||
builder.muteUntil,
|
builder.muteUntil,
|
||||||
|
@ -73,6 +79,9 @@ public record Contact(
|
||||||
private String givenName;
|
private String givenName;
|
||||||
private String familyName;
|
private String familyName;
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
private String nickNameGivenName;
|
||||||
|
private String nickNameFamilyName;
|
||||||
|
private String note;
|
||||||
private String color;
|
private String color;
|
||||||
private int messageExpirationTime;
|
private int messageExpirationTime;
|
||||||
private long muteUntil;
|
private long muteUntil;
|
||||||
|
@ -105,6 +114,21 @@ public record Contact(
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder withNickNameGivenName(final String val) {
|
||||||
|
nickNameGivenName = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder withNickNameFamilyName(final String val) {
|
||||||
|
nickNameFamilyName = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder withNote(final String val) {
|
||||||
|
note = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder withColor(final String val) {
|
public Builder withColor(final String val) {
|
||||||
color = val;
|
color = val;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.UUID;
|
||||||
public class AccountDatabase extends Database {
|
public class AccountDatabase extends Database {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AccountDatabase.class);
|
private static final Logger logger = LoggerFactory.getLogger(AccountDatabase.class);
|
||||||
private static final long DATABASE_VERSION = 24;
|
private static final long DATABASE_VERSION = 25;
|
||||||
|
|
||||||
private AccountDatabase(final HikariDataSource dataSource) {
|
private AccountDatabase(final HikariDataSource dataSource) {
|
||||||
super(logger, DATABASE_VERSION, dataSource);
|
super(logger, DATABASE_VERSION, dataSource);
|
||||||
|
@ -581,6 +581,16 @@ public class AccountDatabase extends Database {
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 25) {
|
||||||
|
logger.debug("Updating database: Create nick_name and note columns");
|
||||||
|
try (final var statement = connection.createStatement()) {
|
||||||
|
statement.executeUpdate("""
|
||||||
|
ALTER TABLE recipient ADD nick_name_given_name TEXT;
|
||||||
|
ALTER TABLE recipient ADD nick_name_family_name TEXT;
|
||||||
|
ALTER TABLE recipient ADD note TEXT;
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createUuidMappingTable(
|
private static void createUuidMappingTable(
|
||||||
|
|
|
@ -857,6 +857,9 @@ public class SignalAccount implements Closeable {
|
||||||
final var recipientId = getRecipientStore().resolveRecipientTrusted(contact.getAddress());
|
final var recipientId = getRecipientStore().resolveRecipientTrusted(contact.getAddress());
|
||||||
getContactStore().storeContact(recipientId,
|
getContactStore().storeContact(recipientId,
|
||||||
new Contact(contact.name,
|
new Contact(contact.name,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
contact.color,
|
contact.color,
|
||||||
|
|
|
@ -39,6 +39,9 @@ public class LegacyRecipientStore2 {
|
||||||
Contact contact = null;
|
Contact contact = null;
|
||||||
if (r.contact != null) {
|
if (r.contact != null) {
|
||||||
contact = new Contact(r.contact.name,
|
contact = new Contact(r.contact.name,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
r.contact.color,
|
r.contact.color,
|
||||||
|
|
|
@ -71,6 +71,9 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
||||||
given_name TEXT,
|
given_name TEXT,
|
||||||
family_name TEXT,
|
family_name TEXT,
|
||||||
nick_name TEXT,
|
nick_name TEXT,
|
||||||
|
nick_name_given_name TEXT,
|
||||||
|
nick_name_family_name TEXT,
|
||||||
|
note TEXT,
|
||||||
color TEXT,
|
color TEXT,
|
||||||
|
|
||||||
expiration_time INTEGER NOT NULL DEFAULT 0,
|
expiration_time INTEGER NOT NULL DEFAULT 0,
|
||||||
|
@ -1436,6 +1439,9 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
||||||
return new Contact(resultSet.getString("given_name"),
|
return new Contact(resultSet.getString("given_name"),
|
||||||
resultSet.getString("family_name"),
|
resultSet.getString("family_name"),
|
||||||
resultSet.getString("nick_name"),
|
resultSet.getString("nick_name"),
|
||||||
|
resultSet.getString("nick_name_given_name"),
|
||||||
|
resultSet.getString("nick_name_family_name"),
|
||||||
|
resultSet.getString("note"),
|
||||||
resultSet.getString("color"),
|
resultSet.getString("color"),
|
||||||
resultSet.getInt("expiration_time"),
|
resultSet.getInt("expiration_time"),
|
||||||
resultSet.getLong("mute_until"),
|
resultSet.getLong("mute_until"),
|
||||||
|
|
|
@ -271,6 +271,9 @@ public class ContactRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
||||||
.withGivenName(contactRecord.getSystemGivenName().orElse(null))
|
.withGivenName(contactRecord.getSystemGivenName().orElse(null))
|
||||||
.withFamilyName(contactRecord.getSystemFamilyName().orElse(null))
|
.withFamilyName(contactRecord.getSystemFamilyName().orElse(null))
|
||||||
.withNickName(contactRecord.getSystemNickname().orElse(null))
|
.withNickName(contactRecord.getSystemNickname().orElse(null))
|
||||||
|
.withNickNameGivenName(contactRecord.getNicknameGivenName().orElse(null))
|
||||||
|
.withNickNameFamilyName(contactRecord.getNicknameFamilyName().orElse(null))
|
||||||
|
.withNote(contactRecord.getNote().orElse(null))
|
||||||
.withUnregisteredTimestamp(contactRecord.getUnregisteredTimestamp() == 0
|
.withUnregisteredTimestamp(contactRecord.getUnregisteredTimestamp() == 0
|
||||||
? null
|
? null
|
||||||
: contactRecord.getUnregisteredTimestamp());
|
: contactRecord.getUnregisteredTimestamp());
|
||||||
|
|
|
@ -97,6 +97,9 @@ public final class StorageSyncModels {
|
||||||
builder.setSystemGivenName(recipient.getContact().givenName())
|
builder.setSystemGivenName(recipient.getContact().givenName())
|
||||||
.setSystemFamilyName(recipient.getContact().familyName())
|
.setSystemFamilyName(recipient.getContact().familyName())
|
||||||
.setSystemNickname(recipient.getContact().nickName())
|
.setSystemNickname(recipient.getContact().nickName())
|
||||||
|
.setNicknameGivenName(recipient.getContact().nickNameGivenName())
|
||||||
|
.setNicknameFamilyName(recipient.getContact().nickNameFamilyName())
|
||||||
|
.setNote(recipient.getContact().note())
|
||||||
.setBlocked(recipient.getContact().isBlocked())
|
.setBlocked(recipient.getContact().isBlocked())
|
||||||
.setProfileSharingEnabled(recipient.getContact().isProfileSharingEnabled())
|
.setProfileSharingEnabled(recipient.getContact().isProfileSharingEnabled())
|
||||||
.setMuteUntil(recipient.getContact().muteUntil())
|
.setMuteUntil(recipient.getContact().muteUntil())
|
||||||
|
|
|
@ -692,6 +692,9 @@ public class DbusManagerImpl implements Manager {
|
||||||
return Recipient.newBuilder()
|
return Recipient.newBuilder()
|
||||||
.withAddress(new RecipientAddress(null, n))
|
.withAddress(new RecipientAddress(null, n))
|
||||||
.withContact(new Contact(contactName,
|
.withContact(new Contact(contactName,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue