mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Bunch of feedback: renames, simple functions, no cow
This commit is contained in:
@@ -32,7 +32,7 @@ use deltachat::context::Context;
|
|||||||
use deltachat::ephemeral::Timer as EphemeralTimer;
|
use deltachat::ephemeral::Timer as EphemeralTimer;
|
||||||
use deltachat::key::DcKey;
|
use deltachat::key::DcKey;
|
||||||
use deltachat::message::MsgId;
|
use deltachat::message::MsgId;
|
||||||
use deltachat::stock::StockMessage;
|
use deltachat::stock_str::StockMessage;
|
||||||
use deltachat::*;
|
use deltachat::*;
|
||||||
|
|
||||||
mod dc_array;
|
mod dc_array;
|
||||||
|
|||||||
83
src/chat.rs
83
src/chat.rs
@@ -1,6 +1,5 @@
|
|||||||
//! # Chat module
|
//! # Chat module
|
||||||
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
||||||
@@ -39,11 +38,7 @@ use crate::mimeparser::SystemMessage;
|
|||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
||||||
use crate::sql;
|
use crate::sql;
|
||||||
use crate::stock::{
|
use crate::stock_str;
|
||||||
ArchivedChats, DeadDrop, DeviceMessages, E2eAvailable, E2ePreferred, EncrNone, MsgAddMember,
|
|
||||||
MsgDelMember, MsgGroupLeft, MsgGrpImgChanged, MsgGrpImgDeleted, MsgGrpName, NewGroupDraft,
|
|
||||||
SavedMessages, SelfDeletedMsgBody, VideochatInviteMsgBody,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// An chat item, such as a message or a marker.
|
/// An chat item, such as a message or a marker.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
@@ -401,7 +396,7 @@ impl ChatId {
|
|||||||
|
|
||||||
if chat.is_self_talk() {
|
if chat.is_self_talk() {
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some(SelfDeletedMsgBody::stock_str(context).await.into());
|
msg.text = Some(stock_str::self_deleted_msg_body(context).await);
|
||||||
add_device_msg(&context, None, Some(&mut msg)).await?;
|
add_device_msg(&context, None, Some(&mut msg)).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,10 +662,10 @@ impl ChatId {
|
|||||||
})
|
})
|
||||||
.map(|peerstate| peerstate.prefer_encrypt)
|
.map(|peerstate| peerstate.prefer_encrypt)
|
||||||
{
|
{
|
||||||
Some(EncryptPreference::Mutual) => E2ePreferred::stock_str(context).await,
|
Some(EncryptPreference::Mutual) => stock_str::e2e_preferred(context).await,
|
||||||
Some(EncryptPreference::NoPreference) => E2eAvailable::stock_str(context).await,
|
Some(EncryptPreference::NoPreference) => stock_str::e2e_available(context).await,
|
||||||
Some(EncryptPreference::Reset) => EncrNone::stock_str(context).await,
|
Some(EncryptPreference::Reset) => stock_str::encr_none(context).await,
|
||||||
None => EncrNone::stock_str(context).await,
|
None => stock_str::encr_none(context).await,
|
||||||
};
|
};
|
||||||
if !ret.is_empty() {
|
if !ret.is_empty() {
|
||||||
ret.push('\n')
|
ret.push('\n')
|
||||||
@@ -793,9 +788,9 @@ impl Chat {
|
|||||||
}
|
}
|
||||||
Ok(mut chat) => {
|
Ok(mut chat) => {
|
||||||
if chat.id.is_deaddrop() {
|
if chat.id.is_deaddrop() {
|
||||||
chat.name = DeadDrop::stock_str(context).await.into();
|
chat.name = stock_str::dead_drop(context).await;
|
||||||
} else if chat.id.is_archived_link() {
|
} else if chat.id.is_archived_link() {
|
||||||
let tempname = ArchivedChats::stock_str(context).await;
|
let tempname = stock_str::archived_chats(context).await;
|
||||||
let cnt = dc_get_archived_cnt(context).await;
|
let cnt = dc_get_archived_cnt(context).await;
|
||||||
chat.name = format!("{} ({})", tempname, cnt);
|
chat.name = format!("{} ({})", tempname, cnt);
|
||||||
} else {
|
} else {
|
||||||
@@ -810,9 +805,9 @@ impl Chat {
|
|||||||
chat.name = chat_name;
|
chat.name = chat_name;
|
||||||
}
|
}
|
||||||
if chat.param.exists(Param::Selftalk) {
|
if chat.param.exists(Param::Selftalk) {
|
||||||
chat.name = SavedMessages::stock_str(context).await.into();
|
chat.name = stock_str::saved_messages(context).await;
|
||||||
} else if chat.param.exists(Param::Devicetalk) {
|
} else if chat.param.exists(Param::Devicetalk) {
|
||||||
chat.name = DeviceMessages::stock_str(context).await.into();
|
chat.name = stock_str::device_messages(context).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(chat)
|
Ok(chat)
|
||||||
@@ -1411,10 +1406,9 @@ pub(crate) async fn update_device_icon(context: &Context) -> Result<(), Error> {
|
|||||||
async fn update_special_chat_name(
|
async fn update_special_chat_name(
|
||||||
context: &Context,
|
context: &Context,
|
||||||
contact_id: u32,
|
contact_id: u32,
|
||||||
name: Cow<'static, str>,
|
name: String,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
if let Ok((chat_id, _)) = lookup_by_contact_id(context, contact_id).await {
|
if let Ok((chat_id, _)) = lookup_by_contact_id(context, contact_id).await {
|
||||||
let name: String = name.into();
|
|
||||||
// the `!= name` condition avoids unneeded writes
|
// the `!= name` condition avoids unneeded writes
|
||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
@@ -1431,13 +1425,13 @@ pub(crate) async fn update_special_chat_names(context: &Context) -> Result<(), E
|
|||||||
update_special_chat_name(
|
update_special_chat_name(
|
||||||
context,
|
context,
|
||||||
DC_CONTACT_ID_DEVICE,
|
DC_CONTACT_ID_DEVICE,
|
||||||
DeviceMessages::stock_str(context).await,
|
stock_str::device_messages(context).await,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
update_special_chat_name(
|
update_special_chat_name(
|
||||||
context,
|
context,
|
||||||
DC_CONTACT_ID_SELF,
|
DC_CONTACT_ID_SELF,
|
||||||
SavedMessages::stock_str(context).await,
|
stock_str::saved_messages(context).await,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1822,9 +1816,8 @@ pub async fn send_videochat_invitation(context: &Context, chat_id: ChatId) -> Re
|
|||||||
let mut msg = Message::new(Viewtype::VideochatInvitation);
|
let mut msg = Message::new(Viewtype::VideochatInvitation);
|
||||||
msg.param.set(Param::WebrtcRoom, &instance);
|
msg.param.set(Param::WebrtcRoom, &instance);
|
||||||
msg.text = Some(
|
msg.text = Some(
|
||||||
VideochatInviteMsgBody::stock_str(context, Message::parse_webrtc_instance(&instance).1)
|
stock_str::videochat_invite_msg_body(context, Message::parse_webrtc_instance(&instance).1)
|
||||||
.await
|
.await,
|
||||||
.to_string(),
|
|
||||||
);
|
);
|
||||||
send_msg(context, chat_id, &mut msg).await
|
send_msg(context, chat_id, &mut msg).await
|
||||||
}
|
}
|
||||||
@@ -2161,9 +2154,7 @@ pub async fn create_group_chat(
|
|||||||
let chat_name = improve_single_line_input(chat_name);
|
let chat_name = improve_single_line_input(chat_name);
|
||||||
ensure!(!chat_name.is_empty(), "Invalid chat name");
|
ensure!(!chat_name.is_empty(), "Invalid chat name");
|
||||||
|
|
||||||
let draft_txt = NewGroupDraft::stock_str(context, &chat_name)
|
let draft_txt = stock_str::new_group_draft(context, &chat_name).await;
|
||||||
.await
|
|
||||||
.to_string();
|
|
||||||
let grpid = dc_create_id();
|
let grpid = dc_create_id();
|
||||||
|
|
||||||
context.sql.execute(
|
context.sql.execute(
|
||||||
@@ -2340,11 +2331,8 @@ pub(crate) async fn add_contact_to_chat_ex(
|
|||||||
}
|
}
|
||||||
if chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 0 {
|
if chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 0 {
|
||||||
msg.viewtype = Viewtype::Text;
|
msg.viewtype = Viewtype::Text;
|
||||||
msg.text = Some(
|
msg.text =
|
||||||
MsgAddMember::stock_str(context, contact.get_addr(), DC_CONTACT_ID_SELF)
|
Some(stock_str::msg_add_member(context, contact.get_addr(), DC_CONTACT_ID_SELF).await);
|
||||||
.await
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
msg.param.set_cmd(SystemMessage::MemberAddedToGroup);
|
msg.param.set_cmd(SystemMessage::MemberAddedToGroup);
|
||||||
msg.param.set(Param::Arg, contact.get_addr());
|
msg.param.set(Param::Arg, contact.get_addr());
|
||||||
msg.param.set_int(Param::Arg2, from_handshake.into());
|
msg.param.set_int(Param::Arg2, from_handshake.into());
|
||||||
@@ -2538,20 +2526,16 @@ pub async fn remove_contact_from_chat(
|
|||||||
msg.viewtype = Viewtype::Text;
|
msg.viewtype = Viewtype::Text;
|
||||||
if contact.id == DC_CONTACT_ID_SELF {
|
if contact.id == DC_CONTACT_ID_SELF {
|
||||||
set_group_explicitly_left(context, chat.grpid).await?;
|
set_group_explicitly_left(context, chat.grpid).await?;
|
||||||
msg.text = Some(
|
msg.text =
|
||||||
MsgGroupLeft::stock_str(context, DC_CONTACT_ID_SELF)
|
Some(stock_str::msg_group_left(context, DC_CONTACT_ID_SELF).await);
|
||||||
.await
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
msg.text = Some(
|
msg.text = Some(
|
||||||
MsgDelMember::stock_str(
|
stock_str::msg_del_member(
|
||||||
context,
|
context,
|
||||||
contact.get_addr(),
|
contact.get_addr(),
|
||||||
DC_CONTACT_ID_SELF,
|
DC_CONTACT_ID_SELF,
|
||||||
)
|
)
|
||||||
.await
|
.await,
|
||||||
.to_string(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
msg.param.set_cmd(SystemMessage::MemberRemovedFromGroup);
|
msg.param.set_cmd(SystemMessage::MemberRemovedFromGroup);
|
||||||
@@ -2647,9 +2631,8 @@ pub async fn set_chat_name(
|
|||||||
if chat.is_promoted() && !chat.is_mailing_list() {
|
if chat.is_promoted() && !chat.is_mailing_list() {
|
||||||
msg.viewtype = Viewtype::Text;
|
msg.viewtype = Viewtype::Text;
|
||||||
msg.text = Some(
|
msg.text = Some(
|
||||||
MsgGrpName::stock_str(context, &chat.name, &new_name, DC_CONTACT_ID_SELF)
|
stock_str::msg_grp_name(context, &chat.name, &new_name, DC_CONTACT_ID_SELF)
|
||||||
.await
|
.await,
|
||||||
.to_string(),
|
|
||||||
);
|
);
|
||||||
msg.param.set_cmd(SystemMessage::GroupNameChanged);
|
msg.param.set_cmd(SystemMessage::GroupNameChanged);
|
||||||
if !chat.name.is_empty() {
|
if !chat.name.is_empty() {
|
||||||
@@ -2706,11 +2689,7 @@ pub async fn set_chat_profile_image(
|
|||||||
if new_image.as_ref().is_empty() {
|
if new_image.as_ref().is_empty() {
|
||||||
chat.param.remove(Param::ProfileImage);
|
chat.param.remove(Param::ProfileImage);
|
||||||
msg.param.remove(Param::Arg);
|
msg.param.remove(Param::Arg);
|
||||||
msg.text = Some(
|
msg.text = Some(stock_str::msg_grp_img_deleted(context, DC_CONTACT_ID_SELF).await);
|
||||||
MsgGrpImgDeleted::stock_str(context, DC_CONTACT_ID_SELF)
|
|
||||||
.await
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
let image_blob = match BlobObject::from_path(context, Path::new(new_image.as_ref())) {
|
let image_blob = match BlobObject::from_path(context, Path::new(new_image.as_ref())) {
|
||||||
Ok(blob) => Ok(blob),
|
Ok(blob) => Ok(blob),
|
||||||
@@ -2724,11 +2703,7 @@ pub async fn set_chat_profile_image(
|
|||||||
image_blob.recode_to_avatar_size(context).await?;
|
image_blob.recode_to_avatar_size(context).await?;
|
||||||
chat.param.set(Param::ProfileImage, image_blob.as_name());
|
chat.param.set(Param::ProfileImage, image_blob.as_name());
|
||||||
msg.param.set(Param::Arg, image_blob.as_name());
|
msg.param.set(Param::Arg, image_blob.as_name());
|
||||||
msg.text = Some(
|
msg.text = Some(stock_str::msg_grp_img_changed(context, DC_CONTACT_ID_SELF).await);
|
||||||
MsgGrpImgChanged::stock_str(context, DC_CONTACT_ID_SELF)
|
|
||||||
.await
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
chat.update_param(context).await?;
|
chat.update_param(context).await?;
|
||||||
if chat.is_promoted() && !chat.is_mailing_list() {
|
if chat.is_promoted() && !chat.is_mailing_list() {
|
||||||
@@ -3206,7 +3181,7 @@ mod tests {
|
|||||||
assert!(chat.visibility == ChatVisibility::Normal);
|
assert!(chat.visibility == ChatVisibility::Normal);
|
||||||
assert!(!chat.is_device_talk());
|
assert!(!chat.is_device_talk());
|
||||||
assert!(chat.can_send());
|
assert!(chat.can_send());
|
||||||
assert_eq!(chat.name, SavedMessages::stock_str(&t).await);
|
assert_eq!(chat.name, stock_str::saved_messages(&t).await);
|
||||||
assert!(chat.get_profile_image(&t).await.is_some());
|
assert!(chat.get_profile_image(&t).await.is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3222,7 +3197,7 @@ mod tests {
|
|||||||
assert!(chat.visibility == ChatVisibility::Normal);
|
assert!(chat.visibility == ChatVisibility::Normal);
|
||||||
assert!(!chat.is_device_talk());
|
assert!(!chat.is_device_talk());
|
||||||
assert!(!chat.can_send());
|
assert!(!chat.can_send());
|
||||||
assert_eq!(chat.name, DeadDrop::stock_str(&t).await);
|
assert_eq!(chat.name, stock_str::dead_drop(&t).await);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
@@ -3299,7 +3274,7 @@ mod tests {
|
|||||||
assert!(chat.is_device_talk());
|
assert!(chat.is_device_talk());
|
||||||
assert!(!chat.is_self_talk());
|
assert!(!chat.is_self_talk());
|
||||||
assert!(!chat.can_send());
|
assert!(!chat.can_send());
|
||||||
assert_eq!(chat.name, DeviceMessages::stock_str(&t).await);
|
assert_eq!(chat.name, stock_str::device_messages(&t).await);
|
||||||
assert!(chat.get_profile_image(&t).await.is_some());
|
assert!(chat.get_profile_image(&t).await.is_some());
|
||||||
|
|
||||||
// delete device message, make sure it is not added again
|
// delete device message, make sure it is not added again
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::context::Context;
|
|||||||
use crate::ephemeral::delete_expired_messages;
|
use crate::ephemeral::delete_expired_messages;
|
||||||
use crate::lot::Lot;
|
use crate::lot::Lot;
|
||||||
use crate::message::{Message, MessageState, MsgId};
|
use crate::message::{Message, MessageState, MsgId};
|
||||||
use crate::stock::NoMessages;
|
use crate::stock_str;
|
||||||
|
|
||||||
/// An object representing a single chatlist in memory.
|
/// An object representing a single chatlist in memory.
|
||||||
///
|
///
|
||||||
@@ -385,7 +385,7 @@ impl Chatlist {
|
|||||||
ret.text2 = None;
|
ret.text2 = None;
|
||||||
} else if lastmsg.is_none() || lastmsg.as_ref().unwrap().from_id == DC_CONTACT_ID_UNDEFINED
|
} else if lastmsg.is_none() || lastmsg.as_ref().unwrap().from_id == DC_CONTACT_ID_UNDEFINED
|
||||||
{
|
{
|
||||||
ret.text2 = Some(NoMessages::stock_str(context).await.to_string());
|
ret.text2 = Some(stock_str::no_messages(context).await.to_string());
|
||||||
} else {
|
} else {
|
||||||
ret.fill(&mut lastmsg.unwrap(), chat, lastcontact.as_ref(), context)
|
ret.fill(&mut lastmsg.unwrap(), chat, lastcontact.as_ref(), context)
|
||||||
.await;
|
.await;
|
||||||
@@ -440,7 +440,7 @@ mod tests {
|
|||||||
|
|
||||||
use crate::chat::{create_group_chat, ProtectionStatus};
|
use crate::chat::{create_group_chat, ProtectionStatus};
|
||||||
use crate::constants::Viewtype;
|
use crate::constants::Viewtype;
|
||||||
use crate::stock::StockMessage;
|
use crate::stock_str::StockMessage;
|
||||||
use crate::test_utils::TestContext;
|
use crate::test_utils::TestContext;
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use crate::job;
|
|||||||
use crate::message::MsgId;
|
use crate::message::MsgId;
|
||||||
use crate::mimefactory::RECOMMENDED_FILE_SIZE;
|
use crate::mimefactory::RECOMMENDED_FILE_SIZE;
|
||||||
use crate::provider::{get_provider_by_id, Provider};
|
use crate::provider::{get_provider_by_id, Provider};
|
||||||
use crate::stock::StatusLine;
|
use crate::stock_str;
|
||||||
|
|
||||||
/// The available configuration keys.
|
/// The available configuration keys.
|
||||||
#[derive(
|
#[derive(
|
||||||
@@ -173,7 +173,7 @@ impl Context {
|
|||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
match key {
|
match key {
|
||||||
Config::Selfstatus => Some(StatusLine::stock_str(self).await.into_owned()),
|
Config::Selfstatus => Some(stock_str::status_line(self).await),
|
||||||
Config::ConfiguredInboxFolder => Some("INBOX".to_owned()),
|
Config::ConfiguredInboxFolder => Some("INBOX".to_owned()),
|
||||||
_ => key.get_str("default").map(|s| s.to_string()),
|
_ => key.get_str("default").map(|s| s.to_string()),
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ impl Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Config::Selfstatus => {
|
Config::Selfstatus => {
|
||||||
let def = StatusLine::stock_str(self).await;
|
let def = stock_str::status_line(self).await;
|
||||||
let val = if value.is_none() || value.unwrap() == def {
|
let val = if value.is_none() || value.unwrap() == def {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use crate::message::Message;
|
|||||||
use crate::oauth2::dc_get_oauth2_addr;
|
use crate::oauth2::dc_get_oauth2_addr;
|
||||||
use crate::provider::{Protocol, Socket, UsernamePattern};
|
use crate::provider::{Protocol, Socket, UsernamePattern};
|
||||||
use crate::smtp::Smtp;
|
use crate::smtp::Smtp;
|
||||||
use crate::stock::{ConfigurationFailed, ErrorNoNetwork};
|
use crate::stock_str;
|
||||||
use crate::{chat, e2ee, provider};
|
use crate::{chat, e2ee, provider};
|
||||||
use crate::{config::Config, dc_tools::time};
|
use crate::{config::Config, dc_tools::time};
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -127,14 +127,13 @@ impl Context {
|
|||||||
self,
|
self,
|
||||||
0,
|
0,
|
||||||
Some(
|
Some(
|
||||||
ConfigurationFailed::stock_str(
|
stock_str::configuration_failed(
|
||||||
self,
|
self,
|
||||||
// We are using Anyhow's .context() and to show the
|
// We are using Anyhow's .context() and to show the
|
||||||
// inner error, too, we need the {:#}:
|
// inner error, too, we need the {:#}:
|
||||||
format!("{:#}", err),
|
format!("{:#}", err),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.to_string()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Err(err)
|
Err(err)
|
||||||
@@ -591,7 +590,7 @@ async fn nicer_configuration_error(context: &Context, errors: Vec<ConfigurationE
|
|||||||
.iter()
|
.iter()
|
||||||
.all(|e| e.msg.to_lowercase().contains("could not resolve"))
|
.all(|e| e.msg.to_lowercase().contains("could not resolve"))
|
||||||
{
|
{
|
||||||
return ErrorNoNetwork::stock_str(context).await.to_string();
|
return stock_str::error_no_network(context).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
if errors.iter().all(|e| e.msg == first_err.msg) {
|
if errors.iter().all(|e| e.msg == first_err.msg) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use crate::message::MessageState;
|
|||||||
use crate::mimeparser::AvatarAction;
|
use crate::mimeparser::AvatarAction;
|
||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
||||||
use crate::stock::{DeviceMessages, E2eAvailable, E2ePreferred, EncrNone, FingerPrints, SelfMsg};
|
use crate::stock_str;
|
||||||
|
|
||||||
/// An object representing a single contact in memory.
|
/// An object representing a single contact in memory.
|
||||||
///
|
///
|
||||||
@@ -195,7 +195,7 @@ impl Contact {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
if contact_id == DC_CONTACT_ID_SELF {
|
if contact_id == DC_CONTACT_ID_SELF {
|
||||||
res.name = SelfMsg::stock_str(context).await.to_string();
|
res.name = stock_str::self_msg(context).await;
|
||||||
res.addr = context
|
res.addr = context
|
||||||
.get_config(Config::ConfiguredAddr)
|
.get_config(Config::ConfiguredAddr)
|
||||||
.await
|
.await
|
||||||
@@ -205,7 +205,7 @@ impl Contact {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
} else if contact_id == DC_CONTACT_ID_DEVICE {
|
} else if contact_id == DC_CONTACT_ID_DEVICE {
|
||||||
res.name = DeviceMessages::stock_str(context).await.to_string();
|
res.name = stock_str::device_messages(context).await;
|
||||||
res.addr = DC_CONTACT_ID_DEVICE_ADDR.to_string();
|
res.addr = DC_CONTACT_ID_DEVICE_ADDR.to_string();
|
||||||
}
|
}
|
||||||
Ok(res)
|
Ok(res)
|
||||||
@@ -632,7 +632,7 @@ impl Contact {
|
|||||||
.get_config(Config::Displayname)
|
.get_config(Config::Displayname)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let self_name2 = SelfMsg::stock_str(context);
|
let self_name2 = stock_str::self_msg(context);
|
||||||
|
|
||||||
if let Some(query) = query {
|
if let Some(query) = query {
|
||||||
if self_addr.contains(query.as_ref())
|
if self_addr.contains(query.as_ref())
|
||||||
@@ -726,15 +726,15 @@ impl Contact {
|
|||||||
.is_some()
|
.is_some()
|
||||||
}) {
|
}) {
|
||||||
let stock_message = match peerstate.prefer_encrypt {
|
let stock_message = match peerstate.prefer_encrypt {
|
||||||
EncryptPreference::Mutual => E2ePreferred::stock_str(context).await,
|
EncryptPreference::Mutual => stock_str::e2e_preferred(context).await,
|
||||||
EncryptPreference::NoPreference => E2eAvailable::stock_str(context).await,
|
EncryptPreference::NoPreference => stock_str::e2e_available(context).await,
|
||||||
EncryptPreference::Reset => EncrNone::stock_str(context).await,
|
EncryptPreference::Reset => stock_str::encr_none(context).await,
|
||||||
};
|
};
|
||||||
|
|
||||||
ret += &format!(
|
ret += &format!(
|
||||||
"{}\n{}:",
|
"{}\n{}:",
|
||||||
stock_message,
|
stock_message,
|
||||||
FingerPrints::stock_str(context).await
|
stock_str::finger_prints(context).await
|
||||||
);
|
);
|
||||||
|
|
||||||
let fingerprint_self = SignedPublicKey::load_self(context)
|
let fingerprint_self = SignedPublicKey::load_self(context)
|
||||||
@@ -767,7 +767,7 @@ impl Contact {
|
|||||||
cat_fingerprint(&mut ret, &loginparam.addr, &fingerprint_self, "");
|
cat_fingerprint(&mut ret, &loginparam.addr, &fingerprint_self, "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret += &EncrNone::stock_str(context).await;
|
ret += &stock_str::encr_none(context).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1507,7 +1507,7 @@ mod tests {
|
|||||||
// check SELF
|
// check SELF
|
||||||
let contact = Contact::load_from_db(&t, DC_CONTACT_ID_SELF).await.unwrap();
|
let contact = Contact::load_from_db(&t, DC_CONTACT_ID_SELF).await.unwrap();
|
||||||
assert_eq!(DC_CONTACT_ID_SELF, 1);
|
assert_eq!(DC_CONTACT_ID_SELF, 1);
|
||||||
assert_eq!(contact.get_name(), SelfMsg::stock_str(&t).await);
|
assert_eq!(contact.get_name(), stock_str::self_msg(&t).await);
|
||||||
assert_eq!(contact.get_addr(), ""); // we're not configured
|
assert_eq!(contact.get_addr(), ""); // we're not configured
|
||||||
assert!(!contact.is_blocked());
|
assert!(!contact.is_blocked());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ use crate::mimeparser::{parse_message_ids, AvatarAction, MimeMessage, SystemMess
|
|||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::peerstate::{Peerstate, PeerstateKeyType, PeerstateVerifiedStatus};
|
use crate::peerstate::{Peerstate, PeerstateKeyType, PeerstateVerifiedStatus};
|
||||||
use crate::securejoin::{self, handle_securejoin_handshake, observe_securejoin_on_other_device};
|
use crate::securejoin::{self, handle_securejoin_handshake, observe_securejoin_on_other_device};
|
||||||
use crate::stock::{
|
use crate::stock_str;
|
||||||
MsgAddMember, MsgDelMember, MsgGroupLeft, MsgGrpImgChanged, MsgGrpImgDeleted, MsgGrpName,
|
|
||||||
MsgLocationEnabled, UnknownSenderForChat,
|
|
||||||
};
|
|
||||||
use crate::{contact, location};
|
use crate::{contact, location};
|
||||||
|
|
||||||
// IndexSet is like HashSet but maintains order of insertion
|
// IndexSet is like HashSet but maintains order of insertion
|
||||||
@@ -1168,9 +1165,7 @@ async fn create_or_lookup_group(
|
|||||||
let mut better_msg: String = From::from("");
|
let mut better_msg: String = From::from("");
|
||||||
|
|
||||||
if mime_parser.is_system_message == SystemMessage::LocationStreamingEnabled {
|
if mime_parser.is_system_message == SystemMessage::LocationStreamingEnabled {
|
||||||
better_msg = MsgLocationEnabled::stock_str_by(context, from_id)
|
better_msg = stock_str::msg_location_enabled_by(context, from_id).await;
|
||||||
.await
|
|
||||||
.to_string();
|
|
||||||
set_better_msg(mime_parser, &better_msg);
|
set_better_msg(mime_parser, &better_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1235,11 +1230,9 @@ async fn create_or_lookup_group(
|
|||||||
Some(contact_id) => {
|
Some(contact_id) => {
|
||||||
mime_parser.is_system_message = SystemMessage::MemberRemovedFromGroup;
|
mime_parser.is_system_message = SystemMessage::MemberRemovedFromGroup;
|
||||||
better_msg = if contact_id == from_id {
|
better_msg = if contact_id == from_id {
|
||||||
MsgGroupLeft::stock_str(context, from_id).await.to_string()
|
stock_str::msg_group_left(context, from_id).await
|
||||||
} else {
|
} else {
|
||||||
MsgDelMember::stock_str(context, &removed_addr, from_id)
|
stock_str::msg_del_member(context, &removed_addr, from_id).await
|
||||||
.await
|
|
||||||
.to_string()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
None => warn!(context, "removed {:?} has no contact_id", removed_addr),
|
None => warn!(context, "removed {:?} has no contact_id", removed_addr),
|
||||||
@@ -1248,13 +1241,11 @@ async fn create_or_lookup_group(
|
|||||||
let field = mime_parser.get(HeaderDef::ChatGroupMemberAdded).cloned();
|
let field = mime_parser.get(HeaderDef::ChatGroupMemberAdded).cloned();
|
||||||
if let Some(added_member) = field {
|
if let Some(added_member) = field {
|
||||||
mime_parser.is_system_message = SystemMessage::MemberAddedToGroup;
|
mime_parser.is_system_message = SystemMessage::MemberAddedToGroup;
|
||||||
better_msg = MsgAddMember::stock_str(context, &added_member, from_id)
|
better_msg = stock_str::msg_add_member(context, &added_member, from_id).await;
|
||||||
.await
|
|
||||||
.to_string();
|
|
||||||
X_MrAddToGrp = Some(added_member);
|
X_MrAddToGrp = Some(added_member);
|
||||||
} else if let Some(old_name) = mime_parser.get(HeaderDef::ChatGroupNameChanged) {
|
} else if let Some(old_name) = mime_parser.get(HeaderDef::ChatGroupNameChanged) {
|
||||||
X_MrGrpNameChanged = true;
|
X_MrGrpNameChanged = true;
|
||||||
better_msg = MsgGrpName::stock_str(
|
better_msg = stock_str::msg_grp_name(
|
||||||
context,
|
context,
|
||||||
old_name,
|
old_name,
|
||||||
if let Some(ref name) = grpname {
|
if let Some(ref name) = grpname {
|
||||||
@@ -1264,8 +1255,7 @@ async fn create_or_lookup_group(
|
|||||||
},
|
},
|
||||||
from_id as u32,
|
from_id as u32,
|
||||||
)
|
)
|
||||||
.await
|
.await;
|
||||||
.to_string();
|
|
||||||
mime_parser.is_system_message = SystemMessage::GroupNameChanged;
|
mime_parser.is_system_message = SystemMessage::GroupNameChanged;
|
||||||
} else if let Some(value) = mime_parser.get(HeaderDef::ChatContent) {
|
} else if let Some(value) = mime_parser.get(HeaderDef::ChatContent) {
|
||||||
if value == "group-avatar-changed" {
|
if value == "group-avatar-changed" {
|
||||||
@@ -1274,12 +1264,12 @@ async fn create_or_lookup_group(
|
|||||||
// apart from that, the group-avatar is send along with various other messages
|
// apart from that, the group-avatar is send along with various other messages
|
||||||
mime_parser.is_system_message = SystemMessage::GroupImageChanged;
|
mime_parser.is_system_message = SystemMessage::GroupImageChanged;
|
||||||
better_msg = match avatar_action {
|
better_msg = match avatar_action {
|
||||||
AvatarAction::Delete => MsgGrpImgDeleted::stock_str(context, from_id)
|
AvatarAction::Delete => {
|
||||||
.await
|
stock_str::msg_grp_img_deleted(context, from_id).await
|
||||||
.to_string(),
|
}
|
||||||
AvatarAction::Change(_) => MsgGrpImgChanged::stock_str(context, from_id)
|
AvatarAction::Change(_) => {
|
||||||
.await
|
stock_str::msg_grp_img_changed(context, from_id).await
|
||||||
.to_string(),
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1298,7 +1288,7 @@ async fn create_or_lookup_group(
|
|||||||
// but still show the message as part of the chat.
|
// but still show the message as part of the chat.
|
||||||
// After all, the sender has a reference/in-reply-to that
|
// After all, the sender has a reference/in-reply-to that
|
||||||
// points to this chat.
|
// points to this chat.
|
||||||
let s = UnknownSenderForChat::stock_str(context).await;
|
let s = stock_str::unknown_sender_for_chat(context).await;
|
||||||
mime_parser.repl_msg_by_error(s.to_string());
|
mime_parser.repl_msg_by_error(s.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1976,16 +1966,13 @@ fn dc_create_incoming_rfc724_mid(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::constants::{DC_CONTACT_ID_INFO, DC_GCL_NO_SPECIALS};
|
|
||||||
|
use crate::chat::{ChatItem, ChatVisibility};
|
||||||
|
use crate::chatlist::Chatlist;
|
||||||
|
use crate::constants::{DC_CHAT_ID_DEADDROP, DC_CONTACT_ID_INFO, DC_GCL_NO_SPECIALS};
|
||||||
use crate::message::ContactRequestDecision::*;
|
use crate::message::ContactRequestDecision::*;
|
||||||
use crate::message::Message;
|
use crate::message::Message;
|
||||||
use crate::stock::FailedSendingTo;
|
use crate::test_utils::{get_chat_msg, TestContext};
|
||||||
use crate::test_utils::TestContext;
|
|
||||||
use crate::{
|
|
||||||
chat::{ChatItem, ChatVisibility},
|
|
||||||
constants::DC_CHAT_ID_DEADDROP,
|
|
||||||
};
|
|
||||||
use crate::{chatlist::Chatlist, test_utils::get_chat_msg};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hex_hash() {
|
fn test_hex_hash() {
|
||||||
@@ -2647,7 +2634,7 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
last_msg.text,
|
last_msg.text,
|
||||||
Some(
|
Some(
|
||||||
FailedSendingTo::stock_str(&t, "assidhfaaspocwaeofi@gmail.com")
|
stock_str::failed_sending_to(&t, "assidhfaaspocwaeofi@gmail.com")
|
||||||
.await
|
.await
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use crate::context::Context;
|
|||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
use crate::message::Message;
|
use crate::message::Message;
|
||||||
use crate::provider::get_provider_update_timestamp;
|
use crate::provider::get_provider_update_timestamp;
|
||||||
use crate::stock::{BadTimeMsgBody, UpdateReminderMsgBody};
|
use crate::stock_str;
|
||||||
|
|
||||||
/// Shortens a string to a specified length and adds "[...]" to the
|
/// Shortens a string to a specified length and adds "[...]" to the
|
||||||
/// end of the shortened string.
|
/// end of the shortened string.
|
||||||
@@ -169,15 +169,14 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
|
|||||||
if now < known_past_timestamp {
|
if now < known_past_timestamp {
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some(
|
msg.text = Some(
|
||||||
BadTimeMsgBody::stock_str(
|
stock_str::bad_time_msg_body(
|
||||||
context,
|
context,
|
||||||
Local
|
Local
|
||||||
.timestamp(now, 0)
|
.timestamp(now, 0)
|
||||||
.format("%Y-%m-%d %H:%M:%S")
|
.format("%Y-%m-%d %H:%M:%S")
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
.await
|
.await,
|
||||||
.to_string(),
|
|
||||||
);
|
);
|
||||||
add_device_msg_with_importance(
|
add_device_msg_with_importance(
|
||||||
context,
|
context,
|
||||||
@@ -201,7 +200,7 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
|
|||||||
async fn maybe_warn_on_outdated(context: &Context, now: i64, approx_compile_time: i64) {
|
async fn maybe_warn_on_outdated(context: &Context, now: i64, approx_compile_time: i64) {
|
||||||
if now > approx_compile_time + DC_OUTDATED_WARNING_DAYS * 24 * 60 * 60 {
|
if now > approx_compile_time + DC_OUTDATED_WARNING_DAYS * 24 * 60 * 60 {
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some(UpdateReminderMsgBody::stock_str(context).await.into());
|
msg.text = Some(stock_str::update_reminder_msg_body(context).await);
|
||||||
add_device_msg(
|
add_device_msg(
|
||||||
context,
|
context,
|
||||||
Some(
|
Some(
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
//! the database entries which are expired either according to their
|
//! the database entries which are expired either according to their
|
||||||
//! ephemeral message timers or global `delete_server_after` setting.
|
//! ephemeral message timers or global `delete_server_after` setting.
|
||||||
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@@ -76,12 +75,7 @@ use crate::events::EventType;
|
|||||||
use crate::message::{Message, MessageState, MsgId};
|
use crate::message::{Message, MessageState, MsgId};
|
||||||
use crate::mimeparser::SystemMessage;
|
use crate::mimeparser::SystemMessage;
|
||||||
use crate::sql;
|
use crate::sql;
|
||||||
use crate::stock::{
|
use crate::stock_str;
|
||||||
MsgEphemeralTimerDay, MsgEphemeralTimerDays, MsgEphemeralTimerDisabled,
|
|
||||||
MsgEphemeralTimerEnabled, MsgEphemeralTimerHour, MsgEphemeralTimerHours,
|
|
||||||
MsgEphemeralTimerMinute, MsgEphemeralTimerMinutes, MsgEphemeralTimerWeek,
|
|
||||||
MsgEphemeralTimerWeeks,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
|
||||||
pub enum Timer {
|
pub enum Timer {
|
||||||
@@ -222,43 +216,43 @@ pub(crate) async fn stock_ephemeral_timer_changed(
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
timer: Timer,
|
timer: Timer,
|
||||||
from_id: u32,
|
from_id: u32,
|
||||||
) -> Cow<'static, str> {
|
) -> String {
|
||||||
match timer {
|
match timer {
|
||||||
Timer::Disabled => MsgEphemeralTimerDisabled::stock_str(context, from_id).await,
|
Timer::Disabled => stock_str::msg_ephemeral_timer_disabled(context, from_id).await,
|
||||||
Timer::Enabled { duration } => match duration {
|
Timer::Enabled { duration } => match duration {
|
||||||
0..=59 => {
|
0..=59 => {
|
||||||
MsgEphemeralTimerEnabled::stock_str(context, timer.to_string(), from_id).await
|
stock_str::msg_ephemeral_timer_enabled(context, timer.to_string(), from_id).await
|
||||||
}
|
}
|
||||||
60 => MsgEphemeralTimerMinute::stock_str(context, from_id).await,
|
60 => stock_str::msg_ephemeral_timer_minute(context, from_id).await,
|
||||||
61..=3599 => {
|
61..=3599 => {
|
||||||
MsgEphemeralTimerMinutes::stock_str(
|
stock_str::msg_ephemeral_timer_minutes(
|
||||||
context,
|
context,
|
||||||
format!("{}", (f64::from(duration) / 6.0).round() / 10.0),
|
format!("{}", (f64::from(duration) / 6.0).round() / 10.0),
|
||||||
from_id,
|
from_id,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
3600 => MsgEphemeralTimerHour::stock_str(context, from_id).await,
|
3600 => stock_str::msg_ephemeral_timer_hour(context, from_id).await,
|
||||||
3601..=86399 => {
|
3601..=86399 => {
|
||||||
MsgEphemeralTimerHours::stock_str(
|
stock_str::msg_ephemeral_timer_hours(
|
||||||
context,
|
context,
|
||||||
format!("{}", (f64::from(duration) / 360.0).round() / 10.0),
|
format!("{}", (f64::from(duration) / 360.0).round() / 10.0),
|
||||||
from_id,
|
from_id,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
86400 => MsgEphemeralTimerDay::stock_str(context, from_id).await,
|
86400 => stock_str::msg_ephemeral_timer_day(context, from_id).await,
|
||||||
86401..=604_799 => {
|
86401..=604_799 => {
|
||||||
MsgEphemeralTimerDays::stock_str(
|
stock_str::msg_ephemeral_timer_days(
|
||||||
context,
|
context,
|
||||||
format!("{}", (f64::from(duration) / 8640.0).round() / 10.0),
|
format!("{}", (f64::from(duration) / 8640.0).round() / 10.0),
|
||||||
from_id,
|
from_id,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
604_800 => MsgEphemeralTimerWeek::stock_str(context, from_id).await,
|
604_800 => stock_str::msg_ephemeral_timer_week(context, from_id).await,
|
||||||
_ => {
|
_ => {
|
||||||
MsgEphemeralTimerWeeks::stock_str(
|
stock_str::msg_ephemeral_timer_weeks(
|
||||||
context,
|
context,
|
||||||
format!("{}", (f64::from(duration) / 60480.0).round() / 10.0),
|
format!("{}", (f64::from(duration) / 60480.0).round() / 10.0),
|
||||||
from_id,
|
from_id,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ use crate::oauth2::dc_get_oauth2_access_token;
|
|||||||
use crate::param::Params;
|
use crate::param::Params;
|
||||||
use crate::provider::Socket;
|
use crate::provider::Socket;
|
||||||
use crate::scheduler::InterruptInfo;
|
use crate::scheduler::InterruptInfo;
|
||||||
use crate::stock::CannotLogin;
|
use crate::stock_str;
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
mod idle;
|
mod idle;
|
||||||
@@ -255,9 +255,7 @@ impl Imap {
|
|||||||
|
|
||||||
Err((err, _)) => {
|
Err((err, _)) => {
|
||||||
let imap_user = self.config.lp.user.to_owned();
|
let imap_user = self.config.lp.user.to_owned();
|
||||||
let message = CannotLogin::stock_str(context, &imap_user)
|
let message = stock_str::cannot_login(context, &imap_user).await;
|
||||||
.await
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
warn!(context, "{} ({})", message, err);
|
warn!(context, "{} ({})", message, err);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use crate::mimeparser::SystemMessage;
|
|||||||
use crate::param::Param;
|
use crate::param::Param;
|
||||||
use crate::pgp;
|
use crate::pgp;
|
||||||
use crate::sql::{self, Sql};
|
use crate::sql::{self, Sql};
|
||||||
use crate::stock::{AcSetupMsgBody, AcSetupMsgSubject};
|
use crate::stock_str;
|
||||||
use ::pgp::types::KeyTrait;
|
use ::pgp::types::KeyTrait;
|
||||||
use async_tar::Archive;
|
use async_tar::Archive;
|
||||||
|
|
||||||
@@ -275,8 +275,8 @@ pub async fn render_setup_file(context: &Context, passphrase: &str) -> Result<St
|
|||||||
);
|
);
|
||||||
let pgp_msg = encr.replace("-----BEGIN PGP MESSAGE-----", &replacement);
|
let pgp_msg = encr.replace("-----BEGIN PGP MESSAGE-----", &replacement);
|
||||||
|
|
||||||
let msg_subj = AcSetupMsgSubject::stock_str(context).await;
|
let msg_subj = stock_str::ac_setup_msg_subject(context).await;
|
||||||
let msg_body = AcSetupMsgBody::stock_str(context).await;
|
let msg_body = stock_str::ac_setup_msg_body(context).await;
|
||||||
let msg_body_html = msg_body.replace("\r", "").replace("\n", "<br>");
|
let msg_body_html = msg_body.replace("\r", "").replace("\n", "<br>");
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
concat!(
|
concat!(
|
||||||
@@ -904,7 +904,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use crate::pgp::{split_armored_data, HEADER_AUTOCRYPT, HEADER_SETUPCODE};
|
use crate::pgp::{split_armored_data, HEADER_AUTOCRYPT, HEADER_SETUPCODE};
|
||||||
use crate::stock::StockMessage;
|
use crate::stock_str::StockMessage;
|
||||||
use crate::test_utils::{alice_keypair, TestContext};
|
use crate::test_utils::{alice_keypair, TestContext};
|
||||||
|
|
||||||
use ::pgp::armor::BlockType;
|
use ::pgp::armor::BlockType;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ pub mod qr;
|
|||||||
pub mod securejoin;
|
pub mod securejoin;
|
||||||
mod simplify;
|
mod simplify;
|
||||||
mod smtp;
|
mod smtp;
|
||||||
pub mod stock;
|
pub mod stock_str;
|
||||||
mod token;
|
mod token;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod dehtml;
|
mod dehtml;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::job::{self, Job};
|
|||||||
use crate::message::{Message, MsgId};
|
use crate::message::{Message, MsgId};
|
||||||
use crate::mimeparser::SystemMessage;
|
use crate::mimeparser::SystemMessage;
|
||||||
use crate::param::Params;
|
use crate::param::Params;
|
||||||
use crate::stock::{MsgLocationDisabled, MsgLocationEnabled};
|
use crate::stock_str;
|
||||||
|
|
||||||
/// Location record
|
/// Location record
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -212,13 +212,13 @@ pub async fn send_locations_to_chat(context: &Context, chat_id: ChatId, seconds:
|
|||||||
{
|
{
|
||||||
if 0 != seconds && !is_sending_locations_before {
|
if 0 != seconds && !is_sending_locations_before {
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some(MsgLocationEnabled::stock_str(context).await.to_string());
|
msg.text = Some(stock_str::msg_location_enabled(context).await);
|
||||||
msg.param.set_cmd(SystemMessage::LocationStreamingEnabled);
|
msg.param.set_cmd(SystemMessage::LocationStreamingEnabled);
|
||||||
chat::send_msg(context, chat_id, &mut msg)
|
chat::send_msg(context, chat_id, &mut msg)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
} else if 0 == seconds && is_sending_locations_before {
|
} else if 0 == seconds && is_sending_locations_before {
|
||||||
let stock_str = MsgLocationDisabled::stock_str(context).await;
|
let stock_str = stock_str::msg_location_disabled(context).await;
|
||||||
chat::add_info_msg(context, chat_id, stock_str).await;
|
chat::add_info_msg(context, chat_id, stock_str).await;
|
||||||
}
|
}
|
||||||
context.emit_event(EventType::ChatModified(chat_id));
|
context.emit_event(EventType::ChatModified(chat_id));
|
||||||
@@ -710,7 +710,7 @@ pub(crate) async fn job_maybe_send_locations_ended(
|
|||||||
paramsv![chat_id],
|
paramsv![chat_id],
|
||||||
).await);
|
).await);
|
||||||
|
|
||||||
let stock_str = MsgLocationDisabled::stock_str(context).await;
|
let stock_str = stock_str::msg_location_disabled(context).await;
|
||||||
chat::add_info_msg(context, chat_id, stock_str).await;
|
chat::add_info_msg(context, chat_id, stock_str).await;
|
||||||
context.emit_event(EventType::ChatModified(chat_id));
|
context.emit_event(EventType::ChatModified(chat_id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ use crate::lot::{Lot, LotState, Meaning};
|
|||||||
use crate::mimeparser::{FailureReport, SystemMessage};
|
use crate::mimeparser::{FailureReport, SystemMessage};
|
||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::pgp::split_armored_data;
|
use crate::pgp::split_armored_data;
|
||||||
use crate::stock::{
|
use crate::stock_str;
|
||||||
AcSetupMsgSubject, Audio, Draft, FailedSendingTo, File, Gif, Image, Location, ReplyNoun,
|
|
||||||
SelfMsg, Sticker, Video, VideochatInvitation, VoiceMessage,
|
|
||||||
};
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
// In practice, the user additionally cuts the string themselves
|
// In practice, the user additionally cuts the string themselves
|
||||||
@@ -1058,14 +1055,14 @@ impl Lot {
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
) {
|
) {
|
||||||
if msg.state == MessageState::OutDraft {
|
if msg.state == MessageState::OutDraft {
|
||||||
self.text1 = Some(Draft::stock_str(context).await.to_owned().into());
|
self.text1 = Some(stock_str::draft(context).await);
|
||||||
self.text1_meaning = Meaning::Text1Draft;
|
self.text1_meaning = Meaning::Text1Draft;
|
||||||
} else if msg.from_id == DC_CONTACT_ID_SELF {
|
} else if msg.from_id == DC_CONTACT_ID_SELF {
|
||||||
if msg.is_info() || chat.is_self_talk() {
|
if msg.is_info() || chat.is_self_talk() {
|
||||||
self.text1 = None;
|
self.text1 = None;
|
||||||
self.text1_meaning = Meaning::None;
|
self.text1_meaning = Meaning::None;
|
||||||
} else {
|
} else {
|
||||||
self.text1 = Some(SelfMsg::stock_str(context).await.to_owned().into());
|
self.text1 = Some(stock_str::self_msg(context).await);
|
||||||
self.text1_meaning = Meaning::Text1Self;
|
self.text1_meaning = Meaning::Text1Self;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1098,7 +1095,7 @@ impl Lot {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
if text2.is_empty() && msg.quoted_text().is_some() {
|
if text2.is_empty() && msg.quoted_text().is_some() {
|
||||||
text2 = ReplyNoun::stock_str(context).await.into_owned()
|
text2 = stock_str::reply_noun(context).await
|
||||||
}
|
}
|
||||||
|
|
||||||
self.text2 = Some(text2);
|
self.text2 = Some(text2);
|
||||||
@@ -1550,15 +1547,15 @@ pub async fn get_summarytext_by_raw(
|
|||||||
) -> String {
|
) -> String {
|
||||||
let mut append_text = true;
|
let mut append_text = true;
|
||||||
let prefix = match viewtype {
|
let prefix = match viewtype {
|
||||||
Viewtype::Image => Image::stock_str(context).await.into_owned(),
|
Viewtype::Image => stock_str::image(context).await,
|
||||||
Viewtype::Gif => Gif::stock_str(context).await.into_owned(),
|
Viewtype::Gif => stock_str::gif(context).await,
|
||||||
Viewtype::Sticker => Sticker::stock_str(context).await.into_owned(),
|
Viewtype::Sticker => stock_str::sticker(context).await,
|
||||||
Viewtype::Video => Video::stock_str(context).await.into_owned(),
|
Viewtype::Video => stock_str::video(context).await,
|
||||||
Viewtype::Voice => VoiceMessage::stock_str(context).await.into_owned(),
|
Viewtype::Voice => stock_str::voice_message(context).await,
|
||||||
Viewtype::Audio | Viewtype::File => {
|
Viewtype::Audio | Viewtype::File => {
|
||||||
if param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
if param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
||||||
append_text = false;
|
append_text = false;
|
||||||
AcSetupMsgSubject::stock_str(context).await.to_string()
|
stock_str::ac_setup_msg_subject(context).await
|
||||||
} else {
|
} else {
|
||||||
let file_name: String = param
|
let file_name: String = param
|
||||||
.get_path(Param::File, context)
|
.get_path(Param::File, context)
|
||||||
@@ -1569,23 +1566,23 @@ pub async fn get_summarytext_by_raw(
|
|||||||
})
|
})
|
||||||
.unwrap_or_else(|| String::from("ErrFileName"));
|
.unwrap_or_else(|| String::from("ErrFileName"));
|
||||||
let label = if viewtype == Viewtype::Audio {
|
let label = if viewtype == Viewtype::Audio {
|
||||||
Audio::stock_str(context).await
|
stock_str::audio(context).await
|
||||||
} else {
|
} else {
|
||||||
File::stock_str(context).await
|
stock_str::file(context).await
|
||||||
};
|
};
|
||||||
format!("{} – {}", label, file_name)
|
format!("{} – {}", label, file_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Viewtype::VideochatInvitation => {
|
Viewtype::VideochatInvitation => {
|
||||||
append_text = false;
|
append_text = false;
|
||||||
VideochatInvitation::stock_str(context).await.into_owned()
|
stock_str::videochat_invitation(context).await
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if param.get_cmd() != SystemMessage::LocationOnly {
|
if param.get_cmd() != SystemMessage::LocationOnly {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
} else {
|
} else {
|
||||||
append_text = false;
|
append_text = false;
|
||||||
Location::stock_str(context).await.to_string()
|
stock_str::location(context).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1844,7 +1841,7 @@ async fn ndn_maybe_add_info_msg(
|
|||||||
let contact = Contact::load_from_db(context, contact_id).await?;
|
let contact = Contact::load_from_db(context, contact_id).await?;
|
||||||
// Tell the user which of the recipients failed if we know that (because in
|
// Tell the user which of the recipients failed if we know that (because in
|
||||||
// a group, this might otherwise be unclear)
|
// a group, this might otherwise be unclear)
|
||||||
let text = FailedSendingTo::stock_str(context, contact.get_display_name()).await;
|
let text = stock_str::failed_sending_to(context, contact.get_display_name()).await;
|
||||||
chat::add_info_msg(context, chat_id, text).await;
|
chat::add_info_msg(context, chat_id, text).await;
|
||||||
context.emit_event(EventType::ChatModified(chat_id));
|
context.emit_event(EventType::ChatModified(chat_id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ use crate::mimeparser::SystemMessage;
|
|||||||
use crate::param::Param;
|
use crate::param::Param;
|
||||||
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
use crate::peerstate::{Peerstate, PeerstateVerifiedStatus};
|
||||||
use crate::simplify::escape_message_footer_marks;
|
use crate::simplify::escape_message_footer_marks;
|
||||||
use crate::stock::{
|
use crate::stock_str;
|
||||||
AcSetupMsgBody, AcSetupMsgSubject, EncryptedMsg, ReadRcpt, ReadRcptMailBody, StatusLine,
|
|
||||||
SubjectForNewContact,
|
|
||||||
};
|
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
// attachments of 25 mb brutto should work on the majority of providers
|
// attachments of 25 mb brutto should work on the majority of providers
|
||||||
@@ -142,7 +139,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let default_str = StatusLine::stock_str(context).await.to_string();
|
let default_str = stock_str::status_line(context).await;
|
||||||
let factory = MimeFactory {
|
let factory = MimeFactory {
|
||||||
from_addr,
|
from_addr,
|
||||||
from_displayname,
|
from_displayname,
|
||||||
@@ -180,7 +177,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
.get_config(Config::Displayname)
|
.get_config(Config::Displayname)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let default_str = StatusLine::stock_str(context).await.to_string();
|
let default_str = stock_str::status_line(context).await;
|
||||||
let selfstatus = context
|
let selfstatus = context
|
||||||
.get_config(Config::Selfstatus)
|
.get_config(Config::Selfstatus)
|
||||||
.await
|
.await
|
||||||
@@ -342,9 +339,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
match self.loaded {
|
match self.loaded {
|
||||||
Loaded::Message { ref chat } => {
|
Loaded::Message { ref chat } => {
|
||||||
if self.msg.param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
if self.msg.param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
||||||
AcSetupMsgSubject::stock_str(self.context)
|
stock_str::ac_setup_msg_subject(self.context).await
|
||||||
.await
|
|
||||||
.into_owned()
|
|
||||||
} else if chat.typ == Chattype::Group {
|
} else if chat.typ == Chattype::Group {
|
||||||
let re = if self.in_reply_to.is_empty() {
|
let re = if self.in_reply_to.is_empty() {
|
||||||
""
|
""
|
||||||
@@ -386,14 +381,12 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
SubjectForNewContact::stock_str(self.context, self_name)
|
stock_str::subject_for_new_contact(self.context, self_name).await
|
||||||
.await
|
|
||||||
.to_string()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded::MDN { .. } => ReadRcpt::stock_str(self.context).await.into_owned(),
|
Loaded::MDN { .. } => stock_str::read_rcpt(self.context).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,7 +790,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
unprotected_headers
|
unprotected_headers
|
||||||
.push(Header::new("Autocrypt-Setup-Message".into(), "v1".into()));
|
.push(Header::new("Autocrypt-Setup-Message".into(), "v1".into()));
|
||||||
|
|
||||||
placeholdertext = Some(AcSetupMsgBody::stock_str(self.context).await.to_string());
|
placeholdertext = Some(stock_str::ac_setup_msg_body(self.context).await);
|
||||||
}
|
}
|
||||||
SystemMessage::SecurejoinMessage => {
|
SystemMessage::SecurejoinMessage => {
|
||||||
let msg = &self.msg;
|
let msg = &self.msg;
|
||||||
@@ -1055,11 +1048,11 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
.get_int(Param::GuaranteeE2ee)
|
.get_int(Param::GuaranteeE2ee)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
{
|
{
|
||||||
EncryptedMsg::stock_str(self.context).await.into_owned()
|
stock_str::encrypted_msg(self.context).await
|
||||||
} else {
|
} else {
|
||||||
self.msg.get_summarytext(self.context, 32).await
|
self.msg.get_summarytext(self.context, 32).await
|
||||||
};
|
};
|
||||||
let p2 = ReadRcptMailBody::stock_str(self.context, p1).await;
|
let p2 = stock_str::read_rcpt_mail_body(self.context, p1).await;
|
||||||
let message_text = format!("{}\r\n", p2);
|
let message_text = format!("{}\r\n", p2);
|
||||||
message = message.child(
|
message = message.child(
|
||||||
PartBuilder::new()
|
PartBuilder::new()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use crate::message;
|
|||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::peerstate::Peerstate;
|
use crate::peerstate::Peerstate;
|
||||||
use crate::simplify::simplify;
|
use crate::simplify::simplify;
|
||||||
use crate::stock::CantDecryptMsgBody;
|
use crate::stock_str;
|
||||||
|
|
||||||
/// A parsed MIME message.
|
/// A parsed MIME message.
|
||||||
///
|
///
|
||||||
@@ -629,7 +629,7 @@ impl MimeMessage {
|
|||||||
// we currently do not try to decrypt non-autocrypt messages
|
// we currently do not try to decrypt non-autocrypt messages
|
||||||
// at all. If we see an encrypted part, we set
|
// at all. If we see an encrypted part, we set
|
||||||
// decrypting_failed.
|
// decrypting_failed.
|
||||||
let msg_body = CantDecryptMsgBody::stock_str(context).await;
|
let msg_body = stock_str::cant_decrypt_msg_body(context).await;
|
||||||
let txt = format!("[{}]", msg_body);
|
let txt = format!("[{}]", msg_body);
|
||||||
|
|
||||||
let part = Part {
|
let part = Part {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use crate::context::Context;
|
|||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
use crate::key::{DcKey, Fingerprint, SignedPublicKey};
|
use crate::key::{DcKey, Fingerprint, SignedPublicKey};
|
||||||
use crate::sql::Sql;
|
use crate::sql::Sql;
|
||||||
use crate::stock::ContactSetupChanged;
|
use crate::stock_str;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum PeerstateKeyType {
|
pub enum PeerstateKeyType {
|
||||||
@@ -281,7 +281,7 @@ impl<'a> Peerstate<'a> {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let msg = ContactSetupChanged::stock_str(context, self.addr.clone()).await;
|
let msg = stock_str::contact_setup_changed(context, self.addr.clone()).await;
|
||||||
|
|
||||||
chat::add_info_msg(context, contact_chat_id, msg).await;
|
chat::add_info_msg(context, contact_chat_id, msg).await;
|
||||||
emit_event!(context, EventType::ChatModified(contact_chat_id));
|
emit_event!(context, EventType::ChatModified(contact_chat_id));
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use crate::param::Param;
|
|||||||
use crate::peerstate::{Peerstate, PeerstateKeyType, PeerstateVerifiedStatus, ToSave};
|
use crate::peerstate::{Peerstate, PeerstateKeyType, PeerstateVerifiedStatus, ToSave};
|
||||||
use crate::qr::check_qr;
|
use crate::qr::check_qr;
|
||||||
use crate::sql;
|
use crate::sql;
|
||||||
use crate::stock::{ContactNotVerified, ContactVerified};
|
use crate::stock_str;
|
||||||
use crate::token;
|
use crate::token;
|
||||||
|
|
||||||
mod bobstate;
|
mod bobstate;
|
||||||
@@ -822,7 +822,7 @@ async fn secure_connection_established(context: &Context, contact_chat_id: ChatI
|
|||||||
} else {
|
} else {
|
||||||
"?"
|
"?"
|
||||||
};
|
};
|
||||||
let msg = ContactVerified::stock_str(context, addr).await;
|
let msg = stock_str::contact_verified(context, addr).await;
|
||||||
chat::add_info_msg(context, contact_chat_id, msg).await;
|
chat::add_info_msg(context, contact_chat_id, msg).await;
|
||||||
emit_event!(context, EventType::ChatModified(contact_chat_id));
|
emit_event!(context, EventType::ChatModified(contact_chat_id));
|
||||||
info!(context, "StockMessage::ContactVerified posted to 1:1 chat");
|
info!(context, "StockMessage::ContactVerified posted to 1:1 chat");
|
||||||
@@ -835,7 +835,7 @@ async fn could_not_establish_secure_connection(
|
|||||||
) {
|
) {
|
||||||
let contact_id = chat_id_2_contact_id(context, contact_chat_id).await;
|
let contact_id = chat_id_2_contact_id(context, contact_chat_id).await;
|
||||||
let contact = Contact::get_by_id(context, contact_id).await;
|
let contact = Contact::get_by_id(context, contact_id).await;
|
||||||
let msg = ContactNotVerified::stock_str(
|
let msg = stock_str::contact_not_verified(
|
||||||
context,
|
context,
|
||||||
if let Ok(ref contact) = contact {
|
if let Ok(ref contact) = contact {
|
||||||
contact.get_addr()
|
contact.get_addr()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use crate::events::EventType;
|
|||||||
use crate::login_param::{dc_build_tls, CertificateChecks, LoginParam, ServerLoginParam};
|
use crate::login_param::{dc_build_tls, CertificateChecks, LoginParam, ServerLoginParam};
|
||||||
use crate::oauth2::dc_get_oauth2_access_token;
|
use crate::oauth2::dc_get_oauth2_access_token;
|
||||||
use crate::provider::Socket;
|
use crate::provider::Socket;
|
||||||
use crate::stock::ServerResponse;
|
use crate::stock_str;
|
||||||
|
|
||||||
/// SMTP write and read timeout in seconds.
|
/// SMTP write and read timeout in seconds.
|
||||||
const SMTP_TIMEOUT: u64 = 30;
|
const SMTP_TIMEOUT: u64 = 30;
|
||||||
@@ -111,13 +111,12 @@ impl Smtp {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
if let Err(ref err) = res {
|
if let Err(ref err) = res {
|
||||||
let message = ServerResponse::stock_str(
|
let message = stock_str::server_response(
|
||||||
context,
|
context,
|
||||||
format!("SMTP {}:{}", lp.smtp.server, lp.smtp.port),
|
format!("SMTP {}:{}", lp.smtp.server, lp.smtp.port),
|
||||||
err.to_string(),
|
err.to_string(),
|
||||||
)
|
)
|
||||||
.await
|
.await;
|
||||||
.to_string();
|
|
||||||
|
|
||||||
context.emit_event(EventType::ErrorNetwork(message));
|
context.emit_event(EventType::ErrorNetwork(message));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use crate::message::Message;
|
|||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::peerstate::Peerstate;
|
use crate::peerstate::Peerstate;
|
||||||
use crate::provider::get_provider_by_domain;
|
use crate::provider::get_provider_by_domain;
|
||||||
use crate::stock::DeleteServerTurnedOff;
|
use crate::stock_str;
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! paramsv {
|
macro_rules! paramsv {
|
||||||
@@ -1541,7 +1541,7 @@ CREATE INDEX devmsglabels_index1 ON devmsglabels (label);
|
|||||||
// So, for people who have delete_server enabled, disable it and add a hint to the devicechat:
|
// So, for people who have delete_server enabled, disable it and add a hint to the devicechat:
|
||||||
if context.get_config_delete_server_after().await.is_some() {
|
if context.get_config_delete_server_after().await.is_some() {
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some(DeleteServerTurnedOff::stock_str(context).await.into());
|
msg.text = Some(stock_str::delete_server_turned_off(context).await);
|
||||||
add_device_msg(context, None, Some(&mut msg)).await?;
|
add_device_msg(context, None, Some(&mut msg)).await?;
|
||||||
context.set_config(DeleteServerAfter, Some("0")).await?;
|
context.set_config(DeleteServerAfter, Some("0")).await?;
|
||||||
}
|
}
|
||||||
|
|||||||
1623
src/stock.rs
1623
src/stock.rs
File diff suppressed because it is too large
Load Diff
1084
src/stock_str.rs
Normal file
1084
src/stock_str.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user