1mod support;
3
4#[tokio::main]
5async fn main() -> anyhow::Result<()> {
6 if std::env::args().skip(1).any(|arg| arg == "--help") {
7 println!("sync_once: approve a test-account QR login and summarize one initial sync page.");
8 return Ok(());
9 }
10 let client = tokio::task::spawn_blocking(support::login).await??;
11 let identity = client.account_identity()?;
12 let batch = client.sync(&[]).await?;
13 let mut messages = 0;
14 for command in &batch.commands {
15 if command.id == 5 {
16 let _message = wechat_protocol::wire::decode_add_message(
17 &command.payload,
18 &identity.own_username,
19 )?;
20 messages += 1;
21 }
22 }
23 println!(
24 "commands={} add_messages={} other_commands={} continuation={}",
25 batch.commands.len(),
26 messages,
27 batch.commands.len() - messages,
28 batch.continuation
29 );
30 println!("Preview only. No history or sync cursor was saved.");
34 client.shutdown().await?;
35 Ok(())
36}