mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
Bunch of feedback: renames, simple functions, no cow
This commit is contained in:
@@ -25,7 +25,7 @@ use crate::message::MessageState;
|
||||
use crate::mimeparser::AvatarAction;
|
||||
use crate::param::{Param, Params};
|
||||
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.
|
||||
///
|
||||
@@ -195,7 +195,7 @@ impl Contact {
|
||||
)
|
||||
.await?;
|
||||
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
|
||||
.get_config(Config::ConfiguredAddr)
|
||||
.await
|
||||
@@ -205,7 +205,7 @@ impl Contact {
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
} 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();
|
||||
}
|
||||
Ok(res)
|
||||
@@ -632,7 +632,7 @@ impl Contact {
|
||||
.get_config(Config::Displayname)
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
let self_name2 = SelfMsg::stock_str(context);
|
||||
let self_name2 = stock_str::self_msg(context);
|
||||
|
||||
if let Some(query) = query {
|
||||
if self_addr.contains(query.as_ref())
|
||||
@@ -726,15 +726,15 @@ impl Contact {
|
||||
.is_some()
|
||||
}) {
|
||||
let stock_message = match peerstate.prefer_encrypt {
|
||||
EncryptPreference::Mutual => E2ePreferred::stock_str(context).await,
|
||||
EncryptPreference::NoPreference => E2eAvailable::stock_str(context).await,
|
||||
EncryptPreference::Reset => EncrNone::stock_str(context).await,
|
||||
EncryptPreference::Mutual => stock_str::e2e_preferred(context).await,
|
||||
EncryptPreference::NoPreference => stock_str::e2e_available(context).await,
|
||||
EncryptPreference::Reset => stock_str::encr_none(context).await,
|
||||
};
|
||||
|
||||
ret += &format!(
|
||||
"{}\n{}:",
|
||||
stock_message,
|
||||
FingerPrints::stock_str(context).await
|
||||
stock_str::finger_prints(context).await
|
||||
);
|
||||
|
||||
let fingerprint_self = SignedPublicKey::load_self(context)
|
||||
@@ -767,7 +767,7 @@ impl Contact {
|
||||
cat_fingerprint(&mut ret, &loginparam.addr, &fingerprint_self, "");
|
||||
}
|
||||
} else {
|
||||
ret += &EncrNone::stock_str(context).await;
|
||||
ret += &stock_str::encr_none(context).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1507,7 +1507,7 @@ mod tests {
|
||||
// check SELF
|
||||
let contact = Contact::load_from_db(&t, DC_CONTACT_ID_SELF).await.unwrap();
|
||||
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!(!contact.is_blocked());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user