diff --git a/examples/cli/README.md b/examples/cli/README.md index a9c53e002..2d8ac59d6 100644 --- a/examples/cli/README.md +++ b/examples/cli/README.md @@ -54,6 +54,14 @@ Use the CLI to send a [double ratchet message](https://github.com/xmtp/libxmtp/b ```bash ./xli.sh --db user2.db3 list-group-messages $GROUP_ID ``` + +9. Request a Message History Sync + + ```bash + ./xli.sh --db user1.db3 request-history-sync + ``` + + If you want to run the CLI against localhost, go to the root directory and run `dev/up` to start a local server. Then run the CLI commands using the `--local` flag. diff --git a/examples/cli/cli-client.rs b/examples/cli/cli-client.rs index b0b76ea0b..d8f7fa139 100755 --- a/examples/cli/cli-client.rs +++ b/examples/cli/cli-client.rs @@ -108,7 +108,7 @@ enum Commands { #[clap(short, long, value_parser, num_args = 1.., value_delimiter = ' ')] account_addresses: Vec, }, - HistorySyncRequest {}, + RequestHistorySync {}, ReplyToHistorySyncRequest {}, /// Information about the account that owns the DB Info {}, @@ -335,12 +335,13 @@ async fn main() { let serializable: SerializableGroup = group.into(); info!("Group {}", group_id, { command_output: true, group_id: group_id, group_info: make_value(&serializable) }) } - Commands::HistorySyncRequest {} => { + Commands::RequestHistorySync {} => { let client = create_client(&cli, IdentityStrategy::CachedOnly) .await .unwrap(); // client.allow_history_sync().await.unwrap(); client.sync_welcomes().await.unwrap(); + client.allow_history_sync().await.unwrap(); client.send_history_request().await.unwrap(); info!("Sent history sync request", { command_output: true }); } @@ -369,6 +370,7 @@ async fn create_client(cli: &Cli, account: IdentityStrategy) -> Result Result EncryptionKey { fn get_encrypted_store(db: &Option) -> Result { let store = match db { Some(path) => { + info!("Using persistent storage: {}", path.display()); let s = path.as_path().to_string_lossy().to_string(); info!("Using persistent storage: {} ", s); EncryptedMessageStore::new_unencrypted(StorageOption::Persistent(s))