jsonrpc: add more functions, mostly message related (#3590)

* add more functions, see changelog for details

* add pr number to changelog

* clarify doc comment

* clarify usage of BasicChat
and adjust properties acordingly

r10s is right it should only contain what we need of the expensive calls

* fix doc typos

* run cargo fmt

* jsonrpc: add connectivity functions

* fix typo

* fix typo

* Add get_contact_encryption_info and get_connectivity_html

Fix get_connectivity_html and get_encrinfo futures not being Send. See https://github.com/rust-lang/rust/issues/101650 for more information.

Co-authored-by: jikstra <jikstra@disroot.org>

* Update CHANGELOG

* Update typescript files

* remove todo from changelog

Co-authored-by: jikstra <jikstra@disroot.org>
This commit is contained in:
Simon Laux
2022-09-11 19:48:42 +02:00
committed by GitHub
parent e619d9690d
commit d3f2db2326
9 changed files with 709 additions and 52 deletions

View File

@@ -390,7 +390,8 @@ impl Context {
// =============================================================================================
let watched_folders = get_watched_folder_configs(self).await?;
ret += &format!("<h3>{}</h3><ul>", stock_str::incoming_messages(self).await);
let incoming_messages = stock_str::incoming_messages(self).await;
ret += &format!("<h3>{}</h3><ul>", incoming_messages);
for (folder, state) in &folders_states {
let mut folder_added = false;
@@ -432,10 +433,8 @@ impl Context {
// Your last message was sent successfully
// =============================================================================================
ret += &format!(
"<h3>{}</h3><ul><li>",
stock_str::outgoing_messages(self).await
);
let outgoing_messages = stock_str::outgoing_messages(self).await;
ret += &format!("<h3>{}</h3><ul><li>", outgoing_messages);
let detailed = smtp.get_detailed().await;
ret += &*detailed.to_icon();
ret += " ";
@@ -450,10 +449,8 @@ impl Context {
// =============================================================================================
let domain = tools::EmailAddress::new(&self.get_primary_self_addr().await?)?.domain;
ret += &format!(
"<h3>{}</h3><ul>",
stock_str::storage_on_domain(self, domain).await
);
let storage_on_domain = stock_str::storage_on_domain(self, domain).await;
ret += &format!("<h3>{}</h3><ul>", storage_on_domain);
let quota = self.quota.read().await;
if let Some(quota) = &*quota {
match &quota.recent {
@@ -473,30 +470,23 @@ impl Context {
info!(self, "connectivity: root name hidden: \"{}\"", root_name);
}
let messages = stock_str::messages(self).await;
let part_of_total_used = stock_str::part_of_total_used(
self,
resource.usage.to_string(),
resource.limit.to_string(),
)
.await;
ret += &match &resource.name {
Atom(resource_name) => {
format!(
"<b>{}:</b> {}",
&*escaper::encode_minimal(resource_name),
stock_str::part_of_total_used(
self,
resource.usage.to_string(),
resource.limit.to_string()
)
.await,
part_of_total_used
)
}
Message => {
format!(
"<b>{}:</b> {}",
stock_str::messages(self).await,
stock_str::part_of_total_used(
self,
resource.usage.to_string(),
resource.limit.to_string()
)
.await,
)
format!("<b>{}:</b> {}", part_of_total_used, messages)
}
Storage => {
// do not use a special title needed for "Storage":
@@ -538,7 +528,8 @@ impl Context {
self.schedule_quota_update().await?;
}
} else {
ret += &format!("<li>{}</li>", stock_str::not_connected(self).await);
let not_connected = stock_str::not_connected(self).await;
ret += &format!("<li>{}</li>", not_connected);
self.schedule_quota_update().await?;
}
ret += "</ul>";