fix some compiler issues

This commit is contained in:
Hocuri
2022-05-05 12:13:05 +02:00
committed by Septias
parent b20f03775a
commit c6369ce691
3 changed files with 16 additions and 4 deletions

View File

@@ -330,17 +330,23 @@ impl Context {
Config::DebugLogging => {
if value == Some("0") || value == Some("") || value == None {
if let Some(webxdc_message_id) =
self.sql.get_raw_config_int(Config::DebugLogging).await?
self.sql.get_raw_config_u32(Config::DebugLogging).await?
{
// TODO possible recursion?
message::delete_msgs(self, &[MsgId::new(webxdc_message_id)]).await?;
//use futures::FutureExt; // for boxed()
//message::delete_msgs(self, &[MsgId::new(webxdc_message_id)])
// .boxed() // Need boxed() because of recursion
// .await;
}
} else {
let data: &[u8] = include_bytes!("../test-data/webxdc/minimal.xdc");
let file = BlobObject::create(self, "webxdc_debug_logging.xdc", data).await?;
let mut instance = Message::new(Viewtype::Webxdc);
instance.set_file(file.to_abs_path().to_str(), None);
instance.set_file(
file.to_abs_path().to_str().context("Non-UTF-8 blob file")?,
None,
);
let instance_msg_id =
chat::add_device_msg(self, None, Some(&mut instance)).await?;
}

View File

@@ -329,7 +329,7 @@ impl Event {
tree.insert("id".to_string(), Value::Number(self.as_id().into()));
let (data1, data2) = match self.typ {
let (data1, data2) = match &self.typ {
EventType::Info(data1)
| EventType::Warning(data1)
| EventType::Error(data1)

View File

@@ -593,6 +593,12 @@ impl Sql {
}
pub async fn get_raw_config_bool(&self, key: &str) -> Result<bool> {
self.get_raw_config(key)
.await
.map(|s| s.and_then(|s| s.parse().ok()))
}
pub async fn get_raw_config_bool(&self, key: impl AsRef<str>) -> Result<bool> {
// Not the most obvious way to encode bool as string, but it is matter
// of backward compatibility.
let res = self.get_raw_config_int(key).await?;