mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 00:52:49 +02:00
Revert "Send read reciept and typing indicator EDUs to appservices with receive_ephemeral"
This reverts commit 3675c941f8
.
This commit is contained in:
parent
9040ad054e
commit
f54a62dda0
8 changed files with 46 additions and 135 deletions
|
@ -25,10 +25,7 @@ pub use self::{
|
|||
sender::{EDU_LIMIT, PDU_LIMIT},
|
||||
};
|
||||
use crate::{
|
||||
account_data,
|
||||
appservice::NamespaceRegex,
|
||||
client, globals, presence, pusher, resolver,
|
||||
rooms::{self, timeline::RawPduId},
|
||||
account_data, client, globals, presence, pusher, resolver, rooms, rooms::timeline::RawPduId,
|
||||
server_keys, users, Dep,
|
||||
};
|
||||
|
||||
|
@ -41,7 +38,6 @@ pub struct Service {
|
|||
}
|
||||
|
||||
struct Services {
|
||||
alias: Dep<rooms::alias::Service>,
|
||||
client: Dep<client::Service>,
|
||||
globals: Dep<globals::Service>,
|
||||
resolver: Dep<resolver::Service>,
|
||||
|
@ -80,7 +76,6 @@ impl crate::Service for Service {
|
|||
Ok(Arc::new(Self {
|
||||
server: args.server.clone(),
|
||||
services: Services {
|
||||
alias: args.depend::<rooms::alias::Service>("rooms::alias"),
|
||||
client: args.depend::<client::Service>("client"),
|
||||
globals: args.depend::<globals::Service>("globals"),
|
||||
resolver: args.depend::<resolver::Service>("resolver"),
|
||||
|
@ -189,47 +184,6 @@ impl Service {
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self, serialized), level = "debug")]
|
||||
pub fn send_edu_appservice(&self, appservice_id: String, serialized: Vec<u8>) -> Result {
|
||||
let dest = Destination::Appservice(appservice_id);
|
||||
let event = SendingEvent::Edu(serialized);
|
||||
let _cork = self.db.db.cork();
|
||||
let keys = self.db.queue_requests(once((&event, &dest)));
|
||||
self.dispatch(Msg {
|
||||
dest,
|
||||
event,
|
||||
queue_id: keys.into_iter().next().expect("request queue key"),
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self, room_id, serialized), level = "debug")]
|
||||
pub async fn send_edu_appservice_room(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
serialized: Vec<u8>,
|
||||
) -> Result<()> {
|
||||
for appservice in self.services.appservice.read().await.values() {
|
||||
let matching_aliases = |aliases: NamespaceRegex| {
|
||||
self.services
|
||||
.alias
|
||||
.local_aliases_for_room(room_id)
|
||||
.ready_any(move |room_alias| aliases.is_match(room_alias.as_str()))
|
||||
};
|
||||
|
||||
if appservice.rooms.is_match(room_id.as_str())
|
||||
|| matching_aliases(appservice.aliases.clone()).await
|
||||
|| self
|
||||
.services
|
||||
.state_cache
|
||||
.appservice_in_room(room_id, appservice)
|
||||
.await
|
||||
{
|
||||
self.send_edu_appservice(appservice.registration.id.clone(), serialized.clone())?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self, room_id, serialized), level = "debug")]
|
||||
pub async fn send_edu_room(&self, room_id: &RoomId, serialized: Vec<u8>) -> Result<()> {
|
||||
let servers = self
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use core::str;
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
fmt::Debug,
|
||||
|
@ -22,7 +21,7 @@ use futures::{
|
|||
};
|
||||
use ruma::{
|
||||
api::{
|
||||
appservice::event::push_events::v1::EphemeralData,
|
||||
appservice::event::push_events::v1::Edu as RumaEdu,
|
||||
federation::transactions::{
|
||||
edu::{
|
||||
DeviceListUpdateContent, Edu, PresenceContent, PresenceUpdate, ReceiptContent,
|
||||
|
@ -588,7 +587,7 @@ impl Service {
|
|||
.filter(|event| matches!(event, SendingEvent::Pdu(_)))
|
||||
.count(),
|
||||
);
|
||||
let mut edu_jsons: Vec<EphemeralData> = Vec::with_capacity(
|
||||
let mut edu_jsons: Vec<RumaEdu> = Vec::with_capacity(
|
||||
events
|
||||
.iter()
|
||||
.filter(|event| matches!(event, SendingEvent::Edu(_)))
|
||||
|
@ -601,12 +600,16 @@ impl Service {
|
|||
pdu_jsons.push(pdu.to_room_event());
|
||||
}
|
||||
},
|
||||
| SendingEvent::Edu(edu) =>
|
||||
if appservice.receive_ephemeral {
|
||||
| SendingEvent::Edu(edu) => {
|
||||
if appservice
|
||||
.receive_ephemeral
|
||||
.is_some_and(|receive_edus| receive_edus)
|
||||
{
|
||||
if let Ok(edu) = serde_json::from_slice(edu) {
|
||||
edu_jsons.push(edu);
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
| SendingEvent::Flush => {}, // flush only; no new content
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue