mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-05 17:15:12 +00:00
move attachment, body and header to dedicated folders
This commit is contained in:
parent
cdce6c0bf2
commit
474fae06ee
|
@ -1,4 +1,4 @@
|
|||
//! Module related to mailboxes.
|
||||
//! Module related to mailbox.
|
||||
|
||||
pub mod arg;
|
||||
pub mod entity;
|
||||
|
|
|
@ -226,22 +226,12 @@ fn page_arg<'a>() -> Arg<'a, 'a> {
|
|||
.default_value("0")
|
||||
}
|
||||
|
||||
/// Message attachment argument.
|
||||
/// TODO: move to attachment folder
|
||||
fn attachment_arg<'a>() -> Arg<'a, 'a> {
|
||||
Arg::with_name("attachments")
|
||||
.help("Adds attachment to the message")
|
||||
.short("a")
|
||||
.long("attachment")
|
||||
.value_name("PATH")
|
||||
.multiple(true)
|
||||
}
|
||||
|
||||
/// Message subcommands.
|
||||
pub fn subcmds<'a>() -> Vec<App<'a, 'a>> {
|
||||
vec![
|
||||
msg::flag::arg::subcmds(),
|
||||
msg::tpl::arg::subcmds(),
|
||||
msg::attachment::arg::subcmds(),
|
||||
vec![
|
||||
SubCommand::with_name("list")
|
||||
.aliases(&["lst", "l"])
|
||||
|
@ -262,7 +252,7 @@ pub fn subcmds<'a>() -> Vec<App<'a, 'a>> {
|
|||
),
|
||||
SubCommand::with_name("write")
|
||||
.about("Writes a new message")
|
||||
.arg(attachment_arg()),
|
||||
.arg(msg::attachment::arg::path_arg()),
|
||||
SubCommand::with_name("send")
|
||||
.about("Sends a raw message")
|
||||
.arg(Arg::with_name("message").raw(true).last(true)),
|
||||
|
@ -287,19 +277,16 @@ pub fn subcmds<'a>() -> Vec<App<'a, 'a>> {
|
|||
.long("raw")
|
||||
.short("r"),
|
||||
),
|
||||
SubCommand::with_name("attachments")
|
||||
.about("Downloads all message attachments")
|
||||
.arg(uid_arg()),
|
||||
SubCommand::with_name("reply")
|
||||
.about("Answers to a message")
|
||||
.arg(uid_arg())
|
||||
.arg(reply_all_arg())
|
||||
.arg(attachment_arg()),
|
||||
.arg(msg::attachment::arg::path_arg()),
|
||||
SubCommand::with_name("forward")
|
||||
.aliases(&["fwd"])
|
||||
.about("Forwards a message")
|
||||
.arg(uid_arg())
|
||||
.arg(attachment_arg()),
|
||||
.arg(msg::attachment::arg::path_arg()),
|
||||
SubCommand::with_name("copy")
|
||||
.aliases(&["cp"])
|
||||
.about("Copies a message to the targetted mailbox")
|
||||
|
|
24
src/domain/msg/attachment/arg.rs
Normal file
24
src/domain/msg/attachment/arg.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
//! Module related to message attachment CLI.
|
||||
//!
|
||||
//! This module provides arguments related to message attachment.
|
||||
|
||||
use clap::{App, Arg, SubCommand};
|
||||
|
||||
use crate::domain::msg;
|
||||
|
||||
/// Message attachment subcommands.
|
||||
pub(crate) fn subcmds<'a>() -> Vec<App<'a, 'a>> {
|
||||
vec![SubCommand::with_name("attachments")
|
||||
.about("Downloads all message attachments")
|
||||
.arg(msg::arg::uid_arg())]
|
||||
}
|
||||
|
||||
/// Message attachment path argument.
|
||||
pub(crate) fn path_arg<'a>() -> Arg<'a, 'a> {
|
||||
Arg::with_name("attachments")
|
||||
.help("Adds attachment to the message")
|
||||
.short("a")
|
||||
.long("attachment")
|
||||
.value_name("PATH")
|
||||
.multiple(true)
|
||||
}
|
4
src/domain/msg/attachment/mod.rs
Normal file
4
src/domain/msg/attachment/mod.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
//! Module related to message attachment.
|
||||
|
||||
pub mod arg;
|
||||
pub mod entity;
|
1
src/domain/msg/body/mod.rs
Normal file
1
src/domain/msg/body/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod entity;
|
|
@ -3,10 +3,12 @@ use imap::types::{Fetch, Flag, ZeroCopy};
|
|||
use log::debug;
|
||||
use mailparse;
|
||||
|
||||
use super::{attachment::Attachment, body::Body, headers::Headers};
|
||||
use crate::{
|
||||
config::entity::Account,
|
||||
domain::msg::flag::entity::Flags,
|
||||
domain::msg::{
|
||||
attachment::entity::Attachment, body::entity::Body, flag::entity::Flags,
|
||||
header::entity::Headers,
|
||||
},
|
||||
ui::table::{Cell, Row, Table},
|
||||
};
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@ use crate::{
|
|||
mbox::entity::Mbox,
|
||||
msg::{
|
||||
self,
|
||||
body::Body,
|
||||
entity::{Msg, Msgs},
|
||||
body::entity::Body,
|
||||
entity::{Msg, MsgSerialized, Msgs},
|
||||
flag::entity::Flags,
|
||||
header::entity::Headers,
|
||||
},
|
||||
smtp::service::SmtpServiceInterface,
|
||||
},
|
||||
|
@ -27,8 +29,6 @@ use crate::{
|
|||
ui::choice::{self, PostEditChoice},
|
||||
};
|
||||
|
||||
use super::{entity::MsgSerialized, flag::entity::Flags, headers::Headers};
|
||||
|
||||
// TODO: move this function to the right folder
|
||||
fn msg_interaction<ImapService: ImapServiceInterface, SmtpService: SmtpServiceInterface>(
|
||||
output: &OutputService,
|
||||
|
|
1
src/domain/msg/header/mod.rs
Normal file
1
src/domain/msg/header/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod entity;
|
|
@ -30,7 +30,7 @@ pub mod attachment;
|
|||
|
||||
/// This module is used in the `Msg` struct, which should represent the headers
|
||||
/// fields like `To:` and `From:`.
|
||||
pub mod headers;
|
||||
pub mod header;
|
||||
|
||||
/// This module is used in the `Msg` struct, which should represent the body of
|
||||
/// a msg; The part where you're writing some text like `Dear Mr. LMAO`.
|
||||
|
|
|
@ -13,9 +13,9 @@ use crate::{
|
|||
domain::{
|
||||
imap::service::ImapServiceInterface,
|
||||
msg::{
|
||||
body::Body,
|
||||
body::entity::Body,
|
||||
entity::{Msg, MsgSerialized},
|
||||
headers::Headers,
|
||||
header::entity::Headers,
|
||||
tpl::arg::Tpl,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue