ui: save sent messages to Sent folder
parent
8149f5712f
commit
42a512d010
|
@ -258,7 +258,8 @@ impl Component for Composer {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.initialized {
|
if !self.initialized {
|
||||||
if !self.draft.headers().contains_key("From") {
|
if !self.draft.headers().contains_key("From") || self.draft.headers()["From"].is_empty()
|
||||||
|
{
|
||||||
self.draft.headers_mut().insert(
|
self.draft.headers_mut().insert(
|
||||||
"From".into(),
|
"From".into(),
|
||||||
get_display_name(context, self.account_cursor),
|
get_display_name(context, self.account_cursor),
|
||||||
|
@ -555,6 +556,24 @@ impl Component for Composer {
|
||||||
stdin
|
stdin
|
||||||
.write_all(draft.as_bytes())
|
.write_all(draft.as_bytes())
|
||||||
.expect("Failed to write to stdin");
|
.expect("Failed to write to stdin");
|
||||||
|
if let Err(e) = context.accounts[self.account_cursor].save(
|
||||||
|
draft.as_bytes(),
|
||||||
|
&context.accounts[self.account_cursor]
|
||||||
|
.settings
|
||||||
|
.conf()
|
||||||
|
.sent_folder(),
|
||||||
|
) {
|
||||||
|
if cfg!(feature = "debug_log") {
|
||||||
|
eprintln!("{:?} could not save sent msg", e);
|
||||||
|
}
|
||||||
|
context.replies.push_back(UIEvent {
|
||||||
|
id: 0,
|
||||||
|
event_type: UIEventType::Notification(
|
||||||
|
Some("Could not save in 'Sent' folder.".into()),
|
||||||
|
e.into(),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
context.replies.push_back(UIEvent {
|
context.replies.push_back(UIEvent {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
|
@ -122,6 +122,9 @@ impl FileAccount {
|
||||||
pub fn index(&self) -> IndexStyle {
|
pub fn index(&self) -> IndexStyle {
|
||||||
self.index
|
self.index
|
||||||
}
|
}
|
||||||
|
pub fn sent_folder(&self) -> &str {
|
||||||
|
self.sent_folder.as_str()
|
||||||
|
}
|
||||||
pub fn html_filter(&self) -> Option<&str> {
|
pub fn html_filter(&self) -> Option<&str> {
|
||||||
self.html_filter.as_ref().map(|f| f.as_str())
|
self.html_filter.as_ref().map(|f| f.as_str())
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,9 @@ impl Account {
|
||||||
self.backend
|
self.backend
|
||||||
.save(&finalize.as_bytes(), &self.settings.conf.draft_folder)
|
.save(&finalize.as_bytes(), &self.settings.conf.draft_folder)
|
||||||
}
|
}
|
||||||
|
pub fn save(&self, bytes: &[u8], folder: &str) -> Result<()> {
|
||||||
|
self.backend.save(bytes, folder)
|
||||||
|
}
|
||||||
pub fn iter_mailboxes<'a>(&'a self) -> MailboxIterator<'a> {
|
pub fn iter_mailboxes<'a>(&'a self) -> MailboxIterator<'a> {
|
||||||
MailboxIterator {
|
MailboxIterator {
|
||||||
folders: &self.folders,
|
folders: &self.folders,
|
||||||
|
|
Loading…
Reference in New Issue