Bunch of feedback: renames, simple functions, no cow

This commit is contained in:
Floris Bruynooghe
2021-02-11 22:24:56 +01:00
parent 29f184b4c4
commit 46a3226e43
22 changed files with 1216 additions and 1814 deletions

View File

@@ -14,7 +14,7 @@ use crate::job::{self, Job};
use crate::message::{Message, MsgId};
use crate::mimeparser::SystemMessage;
use crate::param::Params;
use crate::stock::{MsgLocationDisabled, MsgLocationEnabled};
use crate::stock_str;
/// Location record
#[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 {
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);
chat::send_msg(context, chat_id, &mut msg)
.await
.unwrap_or_default();
} 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;
}
context.emit_event(EventType::ChatModified(chat_id));
@@ -710,7 +710,7 @@ pub(crate) async fn job_maybe_send_locations_ended(
paramsv![chat_id],
).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;
context.emit_event(EventType::ChatModified(chat_id));
}