Return the ID of the appservice that was created by register_appservice

This commit is contained in:
Torsten Flammiger 2022-01-31 11:52:33 +01:00
parent 78502aa6b1
commit 28d3b348d2
2 changed files with 6 additions and 7 deletions

View file

@ -12,7 +12,9 @@ pub struct Appservice {
}
impl Appservice {
pub fn register_appservice(&self, yaml: serde_yaml::Value) -> Result<Option<String>> {
/// Registers an appservice and returns the ID to the caller
///
pub fn register_appservice(&self, yaml: serde_yaml::Value) -> Result<String> {
// TODO: Rumaify
let id = yaml.get("id").unwrap().as_str().unwrap();
self.id_appserviceregistrations.insert(
@ -22,9 +24,9 @@ impl Appservice {
self.cached_registrations
.write()
.unwrap()
.insert(id.to_owned(), yaml);
.insert(id.to_owned(), yaml.to_owned());
Ok(Some(id.to_owned()))
Ok(id.to_owned())
}
/// Remove an appservice registration