slightly refactor appservice registration command
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
e9fee04eef
commit
6ccfc9ed98
2 changed files with 18 additions and 12 deletions
|
@ -61,18 +61,18 @@ impl crate::Service for Service {
|
|||
|
||||
impl Service {
|
||||
/// Registers an appservice and returns the ID to the caller
|
||||
pub async fn register_appservice(&self, yaml: Registration) -> Result<String> {
|
||||
pub async fn register_appservice(&self, registration: &Registration, appservice_config_body: &str) -> Result {
|
||||
//TODO: Check for collisions between exclusive appservice namespaces
|
||||
self.registration_info
|
||||
.write()
|
||||
.await
|
||||
.insert(yaml.id.clone(), yaml.clone().try_into()?);
|
||||
.insert(registration.id.clone(), registration.clone().try_into()?);
|
||||
|
||||
let id = yaml.id.as_str();
|
||||
let yaml = serde_yaml::to_string(&yaml)?;
|
||||
self.db.id_appserviceregistrations.insert(id, yaml);
|
||||
self.db
|
||||
.id_appserviceregistrations
|
||||
.insert(®istration.id, appservice_config_body);
|
||||
|
||||
Ok(id.to_owned())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove an appservice registration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue