mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
fix some compiler issues
This commit is contained in:
@@ -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?;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user