Reformat files

This commit is contained in:
AsamK 2024-10-26 13:10:33 +02:00
parent 5a4f4ba6db
commit 0a287b0b3e
5 changed files with 27 additions and 36 deletions

View file

@ -73,16 +73,16 @@ public class AccountDatabase extends Database {
uuid BLOB UNIQUE, uuid BLOB UNIQUE,
profile_key BLOB, profile_key BLOB,
profile_key_credential BLOB, profile_key_credential BLOB,
given_name TEXT, given_name TEXT,
family_name TEXT, family_name TEXT,
color TEXT, color TEXT,
expiration_time INTEGER NOT NULL DEFAULT 0, expiration_time INTEGER NOT NULL DEFAULT 0,
blocked INTEGER NOT NULL DEFAULT FALSE, blocked INTEGER NOT NULL DEFAULT FALSE,
archived INTEGER NOT NULL DEFAULT FALSE, archived INTEGER NOT NULL DEFAULT FALSE,
profile_sharing INTEGER NOT NULL DEFAULT FALSE, profile_sharing INTEGER NOT NULL DEFAULT FALSE,
profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0, profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0,
profile_given_name TEXT, profile_given_name TEXT,
profile_family_name TEXT, profile_family_name TEXT,
@ -244,7 +244,7 @@ public class AccountDatabase extends Database {
WHERE uuid IS NOT NULL; WHERE uuid IS NOT NULL;
DROP TABLE identity; DROP TABLE identity;
ALTER TABLE identity2 RENAME TO identity; ALTER TABLE identity2 RENAME TO identity;
DROP INDEX msl_recipient_index; DROP INDEX msl_recipient_index;
ALTER TABLE message_send_log ADD COLUMN uuid BLOB; ALTER TABLE message_send_log ADD COLUMN uuid BLOB;
UPDATE message_send_log UPDATE message_send_log
@ -254,7 +254,7 @@ public class AccountDatabase extends Database {
DELETE FROM message_send_log WHERE uuid IS NULL; DELETE FROM message_send_log WHERE uuid IS NULL;
ALTER TABLE message_send_log DROP COLUMN recipient_id; ALTER TABLE message_send_log DROP COLUMN recipient_id;
CREATE INDEX msl_recipient_index ON message_send_log (uuid, device_id, content_id); CREATE INDEX msl_recipient_index ON message_send_log (uuid, device_id, content_id);
CREATE TABLE sender_key2 ( CREATE TABLE sender_key2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
uuid BLOB NOT NULL, uuid BLOB NOT NULL,
@ -270,7 +270,7 @@ public class AccountDatabase extends Database {
WHERE uuid IS NOT NULL; WHERE uuid IS NOT NULL;
DROP TABLE sender_key; DROP TABLE sender_key;
ALTER TABLE sender_key2 RENAME TO sender_key; ALTER TABLE sender_key2 RENAME TO sender_key;
CREATE TABLE sender_key_shared2 ( CREATE TABLE sender_key_shared2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
uuid BLOB NOT NULL, uuid BLOB NOT NULL,
@ -285,7 +285,7 @@ public class AccountDatabase extends Database {
WHERE uuid IS NOT NULL; WHERE uuid IS NOT NULL;
DROP TABLE sender_key_shared; DROP TABLE sender_key_shared;
ALTER TABLE sender_key_shared2 RENAME TO sender_key_shared; ALTER TABLE sender_key_shared2 RENAME TO sender_key_shared;
CREATE TABLE session2 ( CREATE TABLE session2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
account_id_type INTEGER NOT NULL, account_id_type INTEGER NOT NULL,
@ -378,7 +378,7 @@ public class AccountDatabase extends Database {
WHERE address IS NOT NULL; WHERE address IS NOT NULL;
DROP TABLE identity; DROP TABLE identity;
ALTER TABLE identity2 RENAME TO identity; ALTER TABLE identity2 RENAME TO identity;
CREATE TABLE message_send_log2 ( CREATE TABLE message_send_log2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
content_id INTEGER NOT NULL REFERENCES message_send_log_content (_id) ON DELETE CASCADE, content_id INTEGER NOT NULL REFERENCES message_send_log_content (_id) ON DELETE CASCADE,
@ -395,7 +395,7 @@ public class AccountDatabase extends Database {
ALTER TABLE message_send_log2 RENAME TO message_send_log; ALTER TABLE message_send_log2 RENAME TO message_send_log;
CREATE INDEX msl_recipient_index ON message_send_log (address, device_id, content_id); CREATE INDEX msl_recipient_index ON message_send_log (address, device_id, content_id);
CREATE INDEX msl_content_index ON message_send_log (content_id); CREATE INDEX msl_content_index ON message_send_log (content_id);
CREATE TABLE sender_key2 ( CREATE TABLE sender_key2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
address TEXT NOT NULL, address TEXT NOT NULL,
@ -411,7 +411,7 @@ public class AccountDatabase extends Database {
WHERE address IS NOT NULL; WHERE address IS NOT NULL;
DROP TABLE sender_key; DROP TABLE sender_key;
ALTER TABLE sender_key2 RENAME TO sender_key; ALTER TABLE sender_key2 RENAME TO sender_key;
CREATE TABLE sender_key_shared2 ( CREATE TABLE sender_key_shared2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
address TEXT NOT NULL, address TEXT NOT NULL,
@ -426,7 +426,7 @@ public class AccountDatabase extends Database {
WHERE address IS NOT NULL; WHERE address IS NOT NULL;
DROP TABLE sender_key_shared; DROP TABLE sender_key_shared;
ALTER TABLE sender_key_shared2 RENAME TO sender_key_shared; ALTER TABLE sender_key_shared2 RENAME TO sender_key_shared;
CREATE TABLE session2 ( CREATE TABLE session2 (
_id INTEGER PRIMARY KEY, _id INTEGER PRIMARY KEY,
account_id_type INTEGER NOT NULL, account_id_type INTEGER NOT NULL,
@ -441,7 +441,7 @@ public class AccountDatabase extends Database {
WHERE address IS NOT NULL; WHERE address IS NOT NULL;
DROP TABLE session; DROP TABLE session;
ALTER TABLE session2 RENAME TO session; ALTER TABLE session2 RENAME TO session;
DROP TABLE tmp_mapping_table; DROP TABLE tmp_mapping_table;
"""); """);
} }
@ -531,12 +531,12 @@ public class AccountDatabase extends Database {
unregistered_timestamp INTEGER, unregistered_timestamp INTEGER,
profile_key BLOB, profile_key BLOB,
profile_key_credential BLOB, profile_key_credential BLOB,
given_name TEXT, given_name TEXT,
family_name TEXT, family_name TEXT,
nick_name TEXT, nick_name TEXT,
color TEXT, color TEXT,
expiration_time INTEGER NOT NULL DEFAULT 0, expiration_time INTEGER NOT NULL DEFAULT 0,
mute_until INTEGER NOT NULL DEFAULT 0, mute_until INTEGER NOT NULL DEFAULT 0,
blocked INTEGER NOT NULL DEFAULT FALSE, blocked INTEGER NOT NULL DEFAULT FALSE,
@ -544,7 +544,7 @@ public class AccountDatabase extends Database {
profile_sharing INTEGER NOT NULL DEFAULT FALSE, profile_sharing INTEGER NOT NULL DEFAULT FALSE,
hide_story INTEGER NOT NULL DEFAULT FALSE, hide_story INTEGER NOT NULL DEFAULT FALSE,
hidden INTEGER NOT NULL DEFAULT FALSE, hidden INTEGER NOT NULL DEFAULT FALSE,
profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0, profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0,
profile_given_name TEXT, profile_given_name TEXT,
profile_family_name TEXT, profile_family_name TEXT,
@ -560,7 +560,7 @@ public class AccountDatabase extends Database {
FROM recipient r; FROM recipient r;
DROP TABLE recipient; DROP TABLE recipient;
ALTER TABLE recipient2 RENAME TO recipient; ALTER TABLE recipient2 RENAME TO recipient;
DROP TABLE tmp_mapping_table; DROP TABLE tmp_mapping_table;
"""); """);
} }
@ -592,7 +592,7 @@ public class AccountDatabase extends Database {
} }
} }
if (oldVersion < 26) { if (oldVersion < 26) {
logger.debug("Updating database: Create discoverabel and profile_phone_number_sharing columns"); logger.debug("Updating database: Create discoverable and profile_phone_number_sharing columns");
try (final var statement = connection.createStatement()) { try (final var statement = connection.createStatement()) {
statement.executeUpdate(""" statement.executeUpdate("""
ALTER TABLE recipient ADD discoverable INTEGER; ALTER TABLE recipient ADD discoverable INTEGER;

View file

@ -69,7 +69,7 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
profile_key BLOB, profile_key BLOB,
profile_key_credential BLOB, profile_key_credential BLOB,
needs_pni_signature INTEGER NOT NULL DEFAULT FALSE, needs_pni_signature INTEGER NOT NULL DEFAULT FALSE,
given_name TEXT, given_name TEXT,
family_name TEXT, family_name TEXT,
nick_name TEXT, nick_name TEXT,
@ -77,7 +77,7 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
nick_name_family_name TEXT, nick_name_family_name TEXT,
note TEXT, note TEXT,
color TEXT, color TEXT,
expiration_time INTEGER NOT NULL DEFAULT 0, expiration_time INTEGER NOT NULL DEFAULT 0,
expiration_time_version INTEGER DEFAULT 1 NOT NULL, expiration_time_version INTEGER DEFAULT 1 NOT NULL,
mute_until INTEGER NOT NULL DEFAULT 0, mute_until INTEGER NOT NULL DEFAULT 0,
@ -86,7 +86,7 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
profile_sharing INTEGER NOT NULL DEFAULT FALSE, profile_sharing INTEGER NOT NULL DEFAULT FALSE,
hide_story INTEGER NOT NULL DEFAULT FALSE, hide_story INTEGER NOT NULL DEFAULT FALSE,
hidden INTEGER NOT NULL DEFAULT FALSE, hidden INTEGER NOT NULL DEFAULT FALSE,
profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0, profile_last_update_timestamp INTEGER NOT NULL DEFAULT 0,
profile_given_name TEXT, profile_given_name TEXT,
profile_family_name TEXT, profile_family_name TEXT,

View file

@ -6,6 +6,7 @@ import org.asamk.signal.manager.api.MessageEnvelope;
record JsonEditMessage(long targetSentTimestamp, JsonDataMessage dataMessage) { record JsonEditMessage(long targetSentTimestamp, JsonDataMessage dataMessage) {
static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) { static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) {
return new JsonEditMessage(editMessage.targetSentTimestamp(), JsonDataMessage.from(editMessage.dataMessage(), m)); return new JsonEditMessage(editMessage.targetSentTimestamp(),
JsonDataMessage.from(editMessage.dataMessage(), m));
} }
} }

View file

@ -65,16 +65,10 @@ public record JsonMessageEnvelope(
final var receiptMessage = envelope.receipt().map(JsonReceiptMessage::from).orElse(null); final var receiptMessage = envelope.receipt().map(JsonReceiptMessage::from).orElse(null);
final var typingMessage = envelope.typing().map(JsonTypingMessage::from).orElse(null); final var typingMessage = envelope.typing().map(JsonTypingMessage::from).orElse(null);
final var dataMessage = envelope.data() final var dataMessage = envelope.data().map(data -> JsonDataMessage.from(data, m)).orElse(null);
.map(data -> JsonDataMessage.from(data, m)) final var editMessage = envelope.edit().map(data -> JsonEditMessage.from(data, m)).orElse(null);
.orElse(null);
final var editMessage = envelope.edit()
.map(data -> JsonEditMessage.from(data, m))
.orElse(null);
final var storyMessage = envelope.story().map(JsonStoryMessage::from).orElse(null); final var storyMessage = envelope.story().map(JsonStoryMessage::from).orElse(null);
final var syncMessage = envelope.sync() final var syncMessage = envelope.sync().map(data -> JsonSyncMessage.from(data, m)).orElse(null);
.map(data -> JsonSyncMessage.from(data, m))
.orElse(null);
final var callMessage = envelope.call().map(JsonCallMessage::from).orElse(null); final var callMessage = envelope.call().map(JsonCallMessage::from).orElse(null);
return new JsonMessageEnvelope(source, return new JsonMessageEnvelope(source,

View file

@ -23,11 +23,7 @@ record JsonSyncDataMessage(
.orElse(null), .orElse(null),
transcriptMessage.destination().flatMap(RecipientAddress::number).orElse(null), transcriptMessage.destination().flatMap(RecipientAddress::number).orElse(null),
transcriptMessage.destination().flatMap(address -> address.uuid().map(UUID::toString)).orElse(null), transcriptMessage.destination().flatMap(address -> address.uuid().map(UUID::toString)).orElse(null),
transcriptMessage.editMessage() transcriptMessage.editMessage().map(data -> JsonEditMessage.from(data, m)).orElse(null),
.map(data -> JsonEditMessage.from(data, m)) transcriptMessage.message().map(data -> JsonDataMessage.from(data, m)).orElse(null));
.orElse(null),
transcriptMessage.message()
.map(data -> JsonDataMessage.from(data, m))
.orElse(null));
} }
} }