diff --git a/src/config.rs b/src/config.rs index 44f281cba..ce7259c30 100644 --- a/src/config.rs +++ b/src/config.rs @@ -159,6 +159,17 @@ impl Context { } } + /// Gets configured "delete_device_after" value. + /// + /// `None` means never delete the message, `Some(x)` means delete + /// after `x` seconds. + pub fn get_config_delete_device_after(&self) -> Option { + match self.get_config_int(Config::DeleteDeviceAfter) { + 0 => None, + x => Some(x as i64), + } + } + /// Set the given config key. /// If `None` is passed as a value the value is cleared and set to the default if there is one. pub fn set_config(&self, key: Config, value: Option<&str>) -> crate::sql::Result<()> {