Skip to content

Commit 52584f7

Browse files
committed
message-log: Add comments for documenting the code
1 parent eb533cc commit 52584f7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

message_log/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@ async fn log_messages(
1818
username: &str,
1919
password: &str,
2020
) -> anyhow::Result<()> {
21+
// Construct and log in the client.
2122
let client = ruma_client::Client::builder()
2223
.homeserver_url(homeserver_url)
2324
.build::<HttpClient>()
2425
.await?;
2526

2627
client.log_in(username, password, None, None).await?;
2728

29+
// Perform an initial sync to ignore messages before the bot was launched.
2830
let filter = FilterDefinition::ignore_all().into();
2931
let initial_sync_response = client
3032
.send_request(assign!(sync_events::v3::Request::new(), {
3133
filter: Some(filter),
3234
}))
3335
.await?;
3436

37+
// Launch a sync loop to listen to new messages.
3538
let mut sync_stream = Box::pin(client.sync(
3639
None,
3740
initial_sync_response.next_batch,

0 commit comments

Comments
 (0)