handle GetRemotePdu response as backfilled PDU
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
6c9f47a968
commit
f1507a4522
1 changed files with 4 additions and 23 deletions
|
@ -2020,40 +2020,21 @@ impl Service {
|
||||||
warn!("Could not fetch all signatures for PDUs from {server}: {e:?}");
|
warn!("Could not fetch all signatures for PDUs from {server}: {e:?}");
|
||||||
});
|
});
|
||||||
|
|
||||||
info!("Attempting to handle event ID {event_id} as incoming PDU");
|
info!("Attempting to handle event ID {event_id} as backfilled PDU");
|
||||||
for (event_id, value, room_id) in parsed_pdu {
|
services().rooms.timeline.backfill_pdu(&server, response.pdu, &pub_key_map).await?;
|
||||||
let mutex = Arc::clone(
|
|
||||||
services()
|
|
||||||
.globals
|
|
||||||
.roomid_mutex_federation
|
|
||||||
.write()
|
|
||||||
.await
|
|
||||||
.entry(room_id.clone())
|
|
||||||
.or_default(),
|
|
||||||
);
|
|
||||||
let mutex_lock = mutex.lock().await;
|
|
||||||
|
|
||||||
services()
|
|
||||||
.rooms
|
|
||||||
.event_handler
|
|
||||||
.handle_incoming_pdu(&server, &event_id, &room_id, value, false, &pub_key_map)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
drop(mutex_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
let json_text = serde_json::to_string_pretty(&json).expect("canonical json is valid json");
|
let json_text = serde_json::to_string_pretty(&json).expect("canonical json is valid json");
|
||||||
|
|
||||||
return Ok(RoomMessageEventContent::text_html(
|
return Ok(RoomMessageEventContent::text_html(
|
||||||
format!(
|
format!(
|
||||||
"{}\n```json\n{}\n```",
|
"{}\n```json\n{}\n```",
|
||||||
"Got PDU from specified server and handled as incoming PDU successfully. Event \
|
"Got PDU from specified server and handled as backfilled PDU successfully. Event \
|
||||||
body:",
|
body:",
|
||||||
json_text
|
json_text
|
||||||
),
|
),
|
||||||
format!(
|
format!(
|
||||||
"<p>{}</p>\n<pre><code class=\"language-json\">{}\n</code></pre>\n",
|
"<p>{}</p>\n<pre><code class=\"language-json\">{}\n</code></pre>\n",
|
||||||
"Got PDU from specified server and handled as incoming PDU successfully. Event \
|
"Got PDU from specified server and handled as backfilled PDU successfully. Event \
|
||||||
body:",
|
body:",
|
||||||
HtmlEscape(&json_text)
|
HtmlEscape(&json_text)
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue