ssb: sequence: Sequential 32-bit integer starting at 1.

This commit is contained in:
2025-06-11 20:12:23 -04:00
parent 2a6789063e
commit a1f1eb34d5
13 changed files with 89 additions and 84 deletions

View File

@ -501,7 +501,7 @@ static int _tf_command_publish(const char* file, int argc, char* argv[])
if (tf_ssb_db_identity_get_private_key(ssb, user, identity, private_key, sizeof(private_key)))
{
JSContext* context = tf_ssb_get_context(ssb);
int64_t sequence = 0;
int32_t sequence = 0;
char previous[k_id_base64_len] = { 0 };
tf_ssb_db_get_latest_message_by_author(ssb, identity, &sequence, previous, sizeof(previous));
JSValue content_value = JS_ParseJSON(context, content, strlen(content), NULL);
@ -653,7 +653,7 @@ static int _tf_command_private(const char* file, int argc, char* argv[])
char* encrypted = tf_ssb_private_message_encrypt(private_key, recipient_list, recipient_count, message_str, strlen(message_str));
if (encrypted)
{
int64_t sequence = 0;
int32_t sequence = 0;
char previous[k_id_base64_len] = { 0 };
tf_ssb_db_get_latest_message_by_author(ssb, identity, &sequence, previous, sizeof(previous));
@ -1084,9 +1084,9 @@ static int _tf_command_get_sequence(const char* file, int argc, char* argv[])
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, db_path, NULL);
tf_ssb_set_quiet(ssb, true);
int64_t sequence = -1;
int32_t sequence = -1;
int result = tf_ssb_db_get_latest_message_by_author(ssb, identity, &sequence, NULL, 0) ? EXIT_SUCCESS : EXIT_FAILURE;
tf_printf("%" PRId64 "\n", sequence);
tf_printf("%d\n", sequence);
tf_ssb_destroy(ssb);
tf_free((void*)default_db_path);
return result;
@ -1304,7 +1304,7 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
const char* identity = NULL;
const char* default_db_path = _get_db_path();
const char* db_path = default_db_path;
int64_t sequence = 0;
int32_t sequence = 0;
bool show_usage = false;
while (!show_usage)
@ -1333,7 +1333,7 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
identity = optarg;
break;
case 's':
sequence = atoll(optarg);
sequence = atoi(optarg);
break;
case 'd':
db_path = optarg;