mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
set subject to group-name, tweak prefixes
this commit sets the subject of groups to the name of the group. if the message is a reply in the group, also the prefix `Re:` is added. the Chat: prefix is removed for groups, also the Fwd: prefix, as it this would be expected to be set to the group name of the forwarded message, which is not really compatible with the rule "group-name = subject" (forwarded messages are detected by the body, not by the subject)
This commit is contained in:
committed by
holger krekel
parent
08bd16c1b6
commit
d7c07e0ed3
@@ -327,38 +327,35 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
fn subject_str(&self) -> String {
|
fn subject_str(&self) -> String {
|
||||||
match self.loaded {
|
match self.loaded {
|
||||||
Loaded::Message { ref chat } => {
|
Loaded::Message { ref chat } => {
|
||||||
let raw = message::get_summarytext_by_raw(
|
|
||||||
self.msg.viewtype,
|
|
||||||
self.msg.text.as_ref(),
|
|
||||||
&self.msg.param,
|
|
||||||
32,
|
|
||||||
self.context,
|
|
||||||
);
|
|
||||||
let mut lines = raw.lines();
|
|
||||||
let raw_subject = if let Some(line) = lines.next() {
|
|
||||||
line
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
};
|
|
||||||
|
|
||||||
let afwd_email = self.msg.param.exists(Param::Forwarded);
|
|
||||||
let fwd = if afwd_email { "Fwd: " } else { "" };
|
|
||||||
|
|
||||||
if self.msg.param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
if self.msg.param.get_cmd() == SystemMessage::AutocryptSetupMessage {
|
||||||
// do not add the "Chat:" prefix for setup messages
|
|
||||||
self.context
|
self.context
|
||||||
.stock_str(StockMessage::AcSetupMsgSubject)
|
.stock_str(StockMessage::AcSetupMsgSubject)
|
||||||
.into_owned()
|
.into_owned()
|
||||||
} else if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup {
|
} else if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup {
|
||||||
format!("Chat: {}: {}{}", chat.name, fwd, raw_subject)
|
let re = if self.in_reply_to.is_empty() {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
"Re: "
|
||||||
|
};
|
||||||
|
format!("{}{}", re, chat.name)
|
||||||
} else {
|
} else {
|
||||||
format!("Chat: {}{}", fwd, raw_subject)
|
let raw = message::get_summarytext_by_raw(
|
||||||
|
self.msg.viewtype,
|
||||||
|
self.msg.text.as_ref(),
|
||||||
|
&self.msg.param,
|
||||||
|
32,
|
||||||
|
self.context,
|
||||||
|
);
|
||||||
|
let mut lines = raw.lines();
|
||||||
|
let raw_subject = if let Some(line) = lines.next() {
|
||||||
|
line
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
format!("Chat: {}", raw_subject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded::MDN => {
|
Loaded::MDN => self.context.stock_str(StockMessage::ReadRcpt).into_owned(),
|
||||||
let e = self.context.stock_str(StockMessage::ReadRcpt);
|
|
||||||
format!("Chat: {}", e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user