mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 21:37:55 +08:00
refactor backend system, remove accouts flattening
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -82,7 +83,7 @@ impl ListEnvelopesCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
list_envelopes_kind,
|
||||
|builder| builder.set_list_envelopes(Some(None)),
|
||||
|builder| builder.set_list_envelopes(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#[cfg(feature = "envelope-list")]
|
||||
pub mod list;
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
pub mod watch;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -8,10 +6,7 @@ use clap::Subcommand;
|
||||
|
||||
use crate::{config::TomlConfig, printer::Printer};
|
||||
|
||||
#[cfg(feature = "envelope-list")]
|
||||
use self::list::ListEnvelopesCommand;
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
use self::watch::WatchEnvelopesCommand;
|
||||
use self::{list::ListEnvelopesCommand, watch::WatchEnvelopesCommand};
|
||||
|
||||
/// Manage envelopes.
|
||||
///
|
||||
@@ -21,11 +16,9 @@ use self::watch::WatchEnvelopesCommand;
|
||||
/// manage them.
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum EnvelopeSubcommand {
|
||||
#[cfg(feature = "envelope-list")]
|
||||
#[command(alias = "lst")]
|
||||
List(ListEnvelopesCommand),
|
||||
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
#[command()]
|
||||
Watch(WatchEnvelopesCommand),
|
||||
}
|
||||
@@ -34,9 +27,7 @@ impl EnvelopeSubcommand {
|
||||
#[allow(unused)]
|
||||
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "envelope-list")]
|
||||
Self::List(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
Self::Watch(cmd) => cmd.execute(printer, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::{backend::feature::BackendFeatureSource, envelope::watch::WatchEnvelopes};
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -43,7 +44,7 @@ impl WatchEnvelopesCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
watch_envelopes_kind,
|
||||
|builder| builder.set_watch_envelopes(Some(None)),
|
||||
|builder| builder.set_watch_envelopes(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(feature = "account-sync")]
|
||||
use email::envelope::sync::config::EnvelopeSyncConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -5,30 +7,25 @@ use crate::backend::BackendKind;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct EnvelopeConfig {
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
pub list: Option<ListEnvelopesConfig>,
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
pub watch: Option<WatchEnvelopesConfig>,
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-get"))]
|
||||
pub get: Option<GetEnvelopeConfig>,
|
||||
#[cfg(feature = "account-sync")]
|
||||
pub sync: Option<EnvelopeSyncConfig>,
|
||||
}
|
||||
|
||||
impl EnvelopeConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
#[allow(unused_mut)]
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
if let Some(list) = &self.list {
|
||||
kinds.extend(list.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
if let Some(watch) = &self.watch {
|
||||
kinds.extend(watch.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-get"))]
|
||||
if let Some(get) = &self.get {
|
||||
kinds.extend(get.get_used_backends());
|
||||
}
|
||||
@@ -37,7 +34,6 @@ impl EnvelopeConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct ListEnvelopesConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
@@ -46,7 +42,6 @@ pub struct ListEnvelopesConfig {
|
||||
pub remote: email::envelope::list::config::EnvelopeListConfig,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
impl ListEnvelopesConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -59,7 +54,6 @@ impl ListEnvelopesConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct WatchEnvelopesConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
@@ -68,7 +62,6 @@ pub struct WatchEnvelopesConfig {
|
||||
pub remote: email::envelope::watch::config::WatchEnvelopeConfig,
|
||||
}
|
||||
|
||||
#[cfg(feature = "envelope-watch")]
|
||||
impl WatchEnvelopesConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -81,13 +74,11 @@ impl WatchEnvelopesConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-get"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct GetEnvelopeConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-get"))]
|
||||
impl GetEnvelopeConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -51,7 +52,7 @@ impl FlagAddCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
add_flags_kind,
|
||||
|builder| builder.set_add_flags(Some(None)),
|
||||
|builder| builder.set_add_flags(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#[cfg(feature = "flag-add")]
|
||||
mod add;
|
||||
#[cfg(feature = "flag-remove")]
|
||||
mod remove;
|
||||
#[cfg(feature = "flag-set")]
|
||||
mod set;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -10,12 +7,7 @@ use clap::Subcommand;
|
||||
|
||||
use crate::{config::TomlConfig, printer::Printer};
|
||||
|
||||
#[cfg(feature = "flag-add")]
|
||||
use self::add::FlagAddCommand;
|
||||
#[cfg(feature = "flag-remove")]
|
||||
use self::remove::FlagRemoveCommand;
|
||||
#[cfg(feature = "flag-set")]
|
||||
use self::set::FlagSetCommand;
|
||||
use self::{add::FlagAddCommand, remove::FlagRemoveCommand, set::FlagSetCommand};
|
||||
|
||||
/// Manage flags.
|
||||
///
|
||||
@@ -25,17 +17,14 @@ use self::set::FlagSetCommand;
|
||||
/// synchronization does not take care of them yet).
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum FlagSubcommand {
|
||||
#[cfg(feature = "flag-add")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(alias = "create")]
|
||||
Add(FlagAddCommand),
|
||||
|
||||
#[cfg(feature = "flag-set")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(aliases = ["update", "change", "replace"])]
|
||||
Set(FlagSetCommand),
|
||||
|
||||
#[cfg(feature = "flag-remove")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(aliases = ["rm", "delete", "del"])]
|
||||
Remove(FlagRemoveCommand),
|
||||
@@ -45,11 +34,8 @@ impl FlagSubcommand {
|
||||
#[allow(unused)]
|
||||
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "flag-add")]
|
||||
Self::Add(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "flag-set")]
|
||||
Self::Set(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "flag-remove")]
|
||||
Self::Remove(cmd) => cmd.execute(printer, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -51,7 +52,7 @@ impl FlagRemoveCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
remove_flags_kind,
|
||||
|builder| builder.set_remove_flags(Some(None)),
|
||||
|builder| builder.set_remove_flags(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -51,7 +52,7 @@ impl FlagSetCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
set_flags_kind,
|
||||
|builder| builder.set_set_flags(Some(None)),
|
||||
|builder| builder.set_set_flags(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(feature = "account-sync")]
|
||||
use email::flag::sync::config::FlagSyncConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -5,30 +7,25 @@ use crate::backend::BackendKind;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct FlagConfig {
|
||||
#[cfg(feature = "flag-add")]
|
||||
pub add: Option<FlagAddConfig>,
|
||||
#[cfg(feature = "flag-set")]
|
||||
pub set: Option<FlagSetConfig>,
|
||||
#[cfg(feature = "flag-remove")]
|
||||
pub remove: Option<FlagRemoveConfig>,
|
||||
#[cfg(feature = "account-sync")]
|
||||
pub sync: Option<FlagSyncConfig>,
|
||||
}
|
||||
|
||||
impl FlagConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
#[allow(unused_mut)]
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
#[cfg(feature = "flag-add")]
|
||||
if let Some(add) = &self.add {
|
||||
kinds.extend(add.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-set")]
|
||||
if let Some(set) = &self.set {
|
||||
kinds.extend(set.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-remove")]
|
||||
if let Some(remove) = &self.remove {
|
||||
kinds.extend(remove.get_used_backends());
|
||||
}
|
||||
@@ -37,13 +34,11 @@ impl FlagConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-add")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct FlagAddConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-add")]
|
||||
impl FlagAddConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -56,13 +51,11 @@ impl FlagAddConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-set")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct FlagSetConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-set")]
|
||||
impl FlagSetConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -75,13 +68,11 @@ impl FlagSetConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-remove")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct FlagRemoveConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "flag-remove")]
|
||||
impl FlagRemoveConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
@@ -30,7 +30,6 @@ pub struct Envelope {
|
||||
pub date: String,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
impl Table for Envelope {
|
||||
fn head() -> Row {
|
||||
Row::new()
|
||||
@@ -76,12 +75,10 @@ impl Table for Envelope {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
/// Represents the list of envelopes.
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct Envelopes(Vec<Envelope>);
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
impl Envelopes {
|
||||
pub fn from_backend(
|
||||
config: &AccountConfig,
|
||||
@@ -108,7 +105,6 @@ impl Envelopes {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
impl ops::Deref for Envelopes {
|
||||
type Target = Vec<Envelope>;
|
||||
|
||||
@@ -117,7 +113,6 @@ impl ops::Deref for Envelopes {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "envelope-list"))]
|
||||
impl PrintTable for Envelopes {
|
||||
fn print_table(&self, writer: &mut dyn WriteColor, opts: PrintTableOpts) -> Result<()> {
|
||||
writeln!(writer)?;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
use std::{fs, path::PathBuf};
|
||||
use uuid::Uuid;
|
||||
@@ -51,7 +52,7 @@ impl AttachmentDownloadCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
get_messages_kind,
|
||||
|builder| builder.set_get_messages(Some(None)),
|
||||
|builder| builder.set_get_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#[cfg(feature = "attachment-download")]
|
||||
pub mod download;
|
||||
mod download;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Subcommand;
|
||||
|
||||
use crate::{config::TomlConfig, printer::Printer};
|
||||
|
||||
#[cfg(feature = "attachment-download")]
|
||||
use self::download::AttachmentDownloadCommand;
|
||||
|
||||
/// Manage attachments.
|
||||
@@ -16,16 +14,13 @@ use self::download::AttachmentDownloadCommand;
|
||||
/// body.
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum AttachmentSubcommand {
|
||||
#[cfg(feature = "attachment-download")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
Download(AttachmentDownloadCommand),
|
||||
}
|
||||
|
||||
impl AttachmentSubcommand {
|
||||
#[allow(unused)]
|
||||
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "attachment-download")]
|
||||
Self::Download(cmd) => cmd.execute(printer, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -53,7 +54,7 @@ impl MessageCopyCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
copy_messages_kind,
|
||||
|builder| builder.set_copy_messages(Some(None)),
|
||||
|builder| builder.set_copy_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -51,7 +52,7 @@ impl MessageDeleteCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
delete_messages_kind,
|
||||
|builder| builder.set_delete_messages(Some(None)),
|
||||
|builder| builder.set_delete_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -63,8 +64,8 @@ impl MessageForwardCommand {
|
||||
account_config.clone(),
|
||||
add_message_kind.into_iter().chain(send_message_kind),
|
||||
|builder| {
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(Some(None));
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::{debug, info};
|
||||
use mail_builder::MessageBuilder;
|
||||
use url::Url;
|
||||
@@ -58,8 +59,8 @@ impl MessageMailtoCommand {
|
||||
account_config.clone(),
|
||||
add_message_kind.into_iter().chain(send_message_kind),
|
||||
|builder| {
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(Some(None));
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
#[cfg(feature = "message-copy")]
|
||||
pub mod copy;
|
||||
#[cfg(feature = "message-delete")]
|
||||
pub mod delete;
|
||||
#[cfg(feature = "message-forward")]
|
||||
pub mod forward;
|
||||
#[cfg(feature = "message-mailto")]
|
||||
pub mod mailto;
|
||||
#[cfg(feature = "message-move")]
|
||||
pub mod r#move;
|
||||
#[cfg(feature = "message-read")]
|
||||
pub mod read;
|
||||
#[cfg(feature = "message-reply")]
|
||||
pub mod reply;
|
||||
#[cfg(feature = "message-save")]
|
||||
pub mod save;
|
||||
#[cfg(feature = "message-send")]
|
||||
pub mod send;
|
||||
#[cfg(feature = "message-write")]
|
||||
pub mod write;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -24,26 +14,12 @@ use clap::Subcommand;
|
||||
|
||||
use crate::{config::TomlConfig, printer::Printer};
|
||||
|
||||
#[cfg(feature = "message-copy")]
|
||||
use self::copy::MessageCopyCommand;
|
||||
#[cfg(feature = "message-delete")]
|
||||
use self::delete::MessageDeleteCommand;
|
||||
#[cfg(feature = "message-forward")]
|
||||
use self::forward::MessageForwardCommand;
|
||||
#[cfg(feature = "message-mailto")]
|
||||
use self::mailto::MessageMailtoCommand;
|
||||
#[cfg(feature = "message-move")]
|
||||
use self::r#move::MessageMoveCommand;
|
||||
#[cfg(feature = "message-read")]
|
||||
use self::read::MessageReadCommand;
|
||||
#[cfg(feature = "message-reply")]
|
||||
use self::reply::MessageReplyCommand;
|
||||
#[cfg(feature = "message-save")]
|
||||
use self::save::MessageSaveCommand;
|
||||
#[cfg(feature = "message-send")]
|
||||
use self::send::MessageSendCommand;
|
||||
#[cfg(feature = "message-write")]
|
||||
use self::write::MessageWriteCommand;
|
||||
use self::{
|
||||
copy::MessageCopyCommand, delete::MessageDeleteCommand, forward::MessageForwardCommand,
|
||||
mailto::MessageMailtoCommand, r#move::MessageMoveCommand, read::MessageReadCommand,
|
||||
reply::MessageReplyCommand, save::MessageSaveCommand, send::MessageSendCommand,
|
||||
write::MessageWriteCommand,
|
||||
};
|
||||
|
||||
/// Manage messages.
|
||||
///
|
||||
@@ -53,43 +29,33 @@ use self::write::MessageWriteCommand;
|
||||
/// subcommand allows you to manage them.
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum MessageSubcommand {
|
||||
#[cfg(feature = "message-read")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
Read(MessageReadCommand),
|
||||
|
||||
#[cfg(feature = "message-write")]
|
||||
#[command(aliases = ["add", "create", "new", "compose"])]
|
||||
Write(MessageWriteCommand),
|
||||
|
||||
#[cfg(feature = "message-reply")]
|
||||
#[command()]
|
||||
Reply(MessageReplyCommand),
|
||||
|
||||
#[cfg(feature = "message-forward")]
|
||||
#[command(aliases = ["fwd", "fd"])]
|
||||
Forward(MessageForwardCommand),
|
||||
|
||||
#[cfg(feature = "message-mailto")]
|
||||
#[command()]
|
||||
Mailto(MessageMailtoCommand),
|
||||
|
||||
#[cfg(feature = "message-save")]
|
||||
Save(MessageSaveCommand),
|
||||
|
||||
#[cfg(feature = "message-send")]
|
||||
Send(MessageSendCommand),
|
||||
|
||||
#[cfg(feature = "message-copy")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(aliases = ["cpy", "cp"])]
|
||||
Copy(MessageCopyCommand),
|
||||
|
||||
#[cfg(feature = "message-move")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(alias = "mv")]
|
||||
Move(MessageMoveCommand),
|
||||
|
||||
#[cfg(feature = "message-delete")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(aliases = ["remove", "rm"])]
|
||||
Delete(MessageDeleteCommand),
|
||||
@@ -99,25 +65,15 @@ impl MessageSubcommand {
|
||||
#[allow(unused)]
|
||||
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "message-read")]
|
||||
Self::Read(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-write")]
|
||||
Self::Write(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-reply")]
|
||||
Self::Reply(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-forward")]
|
||||
Self::Forward(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-mailto")]
|
||||
Self::Mailto(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-save")]
|
||||
Self::Save(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-send")]
|
||||
Self::Send(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-copy")]
|
||||
Self::Copy(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-move")]
|
||||
Self::Move(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "message-delete")]
|
||||
Self::Delete(cmd) => cmd.execute(printer, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -54,7 +55,7 @@ impl MessageMoveCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
move_messages_kind,
|
||||
|builder| builder.set_move_messages(Some(None)),
|
||||
|builder| builder.set_move_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
use mml::message::FilterParts;
|
||||
|
||||
@@ -96,7 +97,7 @@ impl MessageReadCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
get_messages_kind,
|
||||
|builder| builder.set_get_messages(Some(None)),
|
||||
|builder| builder.set_get_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -65,8 +66,8 @@ impl MessageReplyCommand {
|
||||
account_config.clone(),
|
||||
add_message_kind.into_iter().chain(send_message_kind),
|
||||
|builder| {
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(Some(None));
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
|
||||
@@ -48,7 +49,7 @@ impl MessageSaveCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config,
|
||||
add_message_kind,
|
||||
|builder| builder.set_add_message(Some(None)),
|
||||
|builder| builder.set_add_message(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::{backend::feature::BackendFeatureSource, message::send::SendMessageThenSaveCopy};
|
||||
use log::info;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
|
||||
@@ -37,10 +38,7 @@ impl MessageSendCommand {
|
||||
self.cache.disable,
|
||||
)?;
|
||||
|
||||
let send_message_kind = toml_account_config.send_message_kind();
|
||||
|
||||
#[cfg(feature = "message-add")]
|
||||
let send_message_kind = send_message_kind.into_iter().chain(
|
||||
let send_message_kind = toml_account_config.send_message_kind().into_iter().chain(
|
||||
toml_account_config
|
||||
.add_message_kind()
|
||||
.filter(|_| account_config.should_save_copy_sent_message()),
|
||||
@@ -51,9 +49,8 @@ impl MessageSendCommand {
|
||||
account_config,
|
||||
send_message_kind,
|
||||
|builder| {
|
||||
builder.set_send_message(Some(None));
|
||||
#[cfg(feature = "message-add")]
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
@@ -69,7 +66,7 @@ impl MessageSendCommand {
|
||||
.join("\r\n")
|
||||
};
|
||||
|
||||
backend.send_message(msg.as_bytes()).await?;
|
||||
backend.send_message_then_save_copy(msg.as_bytes()).await?;
|
||||
|
||||
printer.print("Message successfully sent!")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::message::Message;
|
||||
use email::{backend::feature::BackendFeatureSource, message::Message};
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -54,8 +54,8 @@ impl MessageWriteCommand {
|
||||
account_config.clone(),
|
||||
add_message_kind.into_iter().chain(send_message_kind),
|
||||
|builder| {
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(Some(None));
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(feature = "account-sync")]
|
||||
use email::message::sync::config::MessageSyncConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -5,53 +7,41 @@ use crate::backend::BackendKind;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageConfig {
|
||||
#[cfg(any(feature = "account-sync", feature = "message-add"))]
|
||||
pub write: Option<MessageAddConfig>,
|
||||
#[cfg(any(feature = "message-send", feature = "template-send"))]
|
||||
pub send: Option<MessageSendConfig>,
|
||||
#[cfg(feature = "account-sync")]
|
||||
pub peek: Option<MessagePeekConfig>,
|
||||
#[cfg(any(feature = "account-sync", feature = "message-get"))]
|
||||
pub read: Option<MessageGetConfig>,
|
||||
#[cfg(feature = "message-copy")]
|
||||
pub copy: Option<MessageCopyConfig>,
|
||||
#[cfg(any(feature = "account-sync", feature = "message-move"))]
|
||||
pub r#move: Option<MessageMoveConfig>,
|
||||
#[cfg(feature = "message-delete")]
|
||||
pub delete: Option<MessageDeleteConfig>,
|
||||
#[cfg(feature = "account-sync")]
|
||||
pub sync: Option<MessageSyncConfig>,
|
||||
}
|
||||
|
||||
impl MessageConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
#[allow(unused_mut)]
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-add"))]
|
||||
if let Some(add) = &self.write {
|
||||
kinds.extend(add.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "message-send", feature = "template-send"))]
|
||||
if let Some(send) = &self.send {
|
||||
kinds.extend(send.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
if let Some(peek) = &self.peek {
|
||||
kinds.extend(peek.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-get"))]
|
||||
if let Some(get) = &self.read {
|
||||
kinds.extend(get.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-copy")]
|
||||
if let Some(copy) = &self.copy {
|
||||
kinds.extend(copy.get_used_backends());
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-move"))]
|
||||
if let Some(move_) = &self.r#move {
|
||||
kinds.extend(move_.get_used_backends());
|
||||
}
|
||||
@@ -60,7 +50,6 @@ impl MessageConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-add"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageAddConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
@@ -69,7 +58,6 @@ pub struct MessageAddConfig {
|
||||
pub remote: email::message::add::config::MessageWriteConfig,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-add"))]
|
||||
impl MessageAddConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -82,7 +70,6 @@ impl MessageAddConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "message-send", feature = "template-send"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageSendConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
@@ -91,7 +78,6 @@ pub struct MessageSendConfig {
|
||||
pub remote: email::message::send::config::MessageSendConfig,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "message-send", feature = "template-send"))]
|
||||
impl MessageSendConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -104,13 +90,11 @@ impl MessageSendConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-peek"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessagePeekConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-peek"))]
|
||||
impl MessagePeekConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -123,7 +107,6 @@ impl MessagePeekConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-get"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageGetConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
@@ -132,7 +115,6 @@ pub struct MessageGetConfig {
|
||||
pub remote: email::message::get::config::MessageReadConfig,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-get"))]
|
||||
impl MessageGetConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -145,13 +127,11 @@ impl MessageGetConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-copy")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageCopyConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-copy")]
|
||||
impl MessageCopyConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -164,13 +144,11 @@ impl MessageCopyConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-move"))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageMoveConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "account-sync", feature = "message-move"))]
|
||||
impl MessageMoveConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
@@ -183,13 +161,11 @@ impl MessageMoveConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-delete")]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct MessageDeleteConfig {
|
||||
pub backend: Option<BackendKind>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "message-delete")]
|
||||
impl MessageDeleteConfig {
|
||||
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
|
||||
let mut kinds = HashSet::default();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -59,7 +60,7 @@ impl TemplateForwardCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
get_messages_kind,
|
||||
|builder| builder.set_get_messages(Some(None)),
|
||||
|builder| builder.set_get_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,29 +1,18 @@
|
||||
#[cfg(feature = "template-forward")]
|
||||
pub mod forward;
|
||||
#[cfg(feature = "template-reply")]
|
||||
pub mod reply;
|
||||
#[cfg(feature = "template-save")]
|
||||
pub mod save;
|
||||
#[cfg(feature = "template-send")]
|
||||
pub mod send;
|
||||
#[cfg(feature = "template-write")]
|
||||
pub mod write;
|
||||
mod forward;
|
||||
mod reply;
|
||||
mod save;
|
||||
mod send;
|
||||
mod write;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Subcommand;
|
||||
|
||||
use crate::{config::TomlConfig, printer::Printer};
|
||||
|
||||
#[cfg(feature = "template-forward")]
|
||||
use self::forward::TemplateForwardCommand;
|
||||
#[cfg(feature = "template-reply")]
|
||||
use self::reply::TemplateReplyCommand;
|
||||
#[cfg(feature = "template-save")]
|
||||
use self::save::TemplateSaveCommand;
|
||||
#[cfg(feature = "template-send")]
|
||||
use self::send::TemplateSendCommand;
|
||||
#[cfg(feature = "template-write")]
|
||||
use self::write::TemplateWriteCommand;
|
||||
use self::{
|
||||
forward::TemplateForwardCommand, reply::TemplateReplyCommand, save::TemplateSaveCommand,
|
||||
send::TemplateSendCommand, write::TemplateWriteCommand,
|
||||
};
|
||||
|
||||
/// Manage templates.
|
||||
///
|
||||
@@ -36,41 +25,30 @@ use self::write::TemplateWriteCommand;
|
||||
/// <https://crates.io/crates/mml-lib>.
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum TemplateSubcommand {
|
||||
#[cfg(feature = "template-write")]
|
||||
#[command(aliases = ["add", "create", "new", "compose"])]
|
||||
Write(TemplateWriteCommand),
|
||||
|
||||
#[cfg(feature = "template-reply")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
Reply(TemplateReplyCommand),
|
||||
|
||||
#[cfg(feature = "template-forward")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
#[command(alias = "fwd")]
|
||||
Forward(TemplateForwardCommand),
|
||||
|
||||
#[cfg(feature = "template-save")]
|
||||
#[command()]
|
||||
Save(TemplateSaveCommand),
|
||||
|
||||
#[cfg(feature = "template-send")]
|
||||
#[command()]
|
||||
Send(TemplateSendCommand),
|
||||
}
|
||||
|
||||
impl TemplateSubcommand {
|
||||
#[allow(unused)]
|
||||
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
|
||||
match self {
|
||||
#[cfg(feature = "template-write")]
|
||||
Self::Write(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "template-reply")]
|
||||
Self::Reply(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "template-forward")]
|
||||
Self::Forward(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "template-save")]
|
||||
Self::Save(cmd) => cmd.execute(printer, config).await,
|
||||
#[cfg(feature = "template-send")]
|
||||
Self::Send(cmd) => cmd.execute(printer, config).await,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
|
||||
#[cfg(feature = "account-sync")]
|
||||
@@ -64,7 +65,7 @@ impl TemplateReplyCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
get_messages_kind,
|
||||
|builder| builder.set_get_messages(Some(None)),
|
||||
|builder| builder.set_get_messages(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::backend::feature::BackendFeatureSource;
|
||||
use log::info;
|
||||
use mml::MmlCompilerBuilder;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
@@ -52,7 +53,7 @@ impl TemplateSaveCommand {
|
||||
toml_account_config.clone(),
|
||||
account_config.clone(),
|
||||
add_message_kind,
|
||||
|builder| builder.set_add_message(Some(None)),
|
||||
|builder| builder.set_add_message(BackendFeatureSource::Context),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use email::{backend::feature::BackendFeatureSource, message::send::SendMessageThenSaveCopy};
|
||||
use log::info;
|
||||
use mml::MmlCompilerBuilder;
|
||||
use std::io::{self, BufRead, IsTerminal};
|
||||
@@ -40,10 +41,7 @@ impl TemplateSendCommand {
|
||||
self.cache.disable,
|
||||
)?;
|
||||
|
||||
let send_message_kind = toml_account_config.send_message_kind();
|
||||
|
||||
#[cfg(feature = "message-add")]
|
||||
let send_message_kind = send_message_kind.into_iter().chain(
|
||||
let send_message_kind = toml_account_config.send_message_kind().into_iter().chain(
|
||||
toml_account_config
|
||||
.add_message_kind()
|
||||
.filter(|_| account_config.should_save_copy_sent_message()),
|
||||
@@ -54,9 +52,8 @@ impl TemplateSendCommand {
|
||||
account_config.clone(),
|
||||
send_message_kind,
|
||||
|builder| {
|
||||
builder.set_send_message(Some(None));
|
||||
#[cfg(feature = "message-add")]
|
||||
builder.set_add_message(Some(None));
|
||||
builder.set_send_message(BackendFeatureSource::Context);
|
||||
builder.set_add_message(BackendFeatureSource::Context);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
@@ -80,7 +77,7 @@ impl TemplateSendCommand {
|
||||
|
||||
let msg = compiler.build(tpl.as_str())?.compile().await?.into_vec()?;
|
||||
|
||||
backend.send_message(&msg).await?;
|
||||
backend.send_message_then_save_copy(&msg).await?;
|
||||
|
||||
printer.print("Message successfully sent!")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user