mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-15 20:07:57 +08:00
use uid by default over seq
This commit is contained in:
@@ -33,13 +33,13 @@ pub struct GetEnvelopeCommand {
|
||||
#[command(flatten)]
|
||||
pub mailbox: MailboxNameOptionalFlag,
|
||||
|
||||
/// The message sequence number or UID.
|
||||
/// The message UID (or sequence number with --seq).
|
||||
#[arg(name = "id", value_name = "ID")]
|
||||
pub id: u32,
|
||||
|
||||
/// Use UID FETCH instead of FETCH.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl GetEnvelopeCommand {
|
||||
@@ -68,7 +68,7 @@ impl GetEnvelopeCommand {
|
||||
]);
|
||||
|
||||
let mut arg = None;
|
||||
let mut coroutine = ImapFetchFirst::new(context, id, item_names, self.uid);
|
||||
let mut coroutine = ImapFetchFirst::new(context, id, item_names, !self.seq);
|
||||
|
||||
let items = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
|
||||
@@ -46,9 +46,9 @@ pub struct ListEnvelopesCommand {
|
||||
#[arg(short, long, default_value = "1:*")]
|
||||
pub sequence: String,
|
||||
|
||||
/// Use UID FETCH instead of FETCH.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl ListEnvelopesCommand {
|
||||
@@ -77,7 +77,7 @@ impl ListEnvelopesCommand {
|
||||
MacroOrMessageDataItemNames::MessageDataItemNames(vec![MessageDataItemName::Envelope]);
|
||||
|
||||
let mut arg = None;
|
||||
let mut coroutine = ImapFetch::new(context, sequence_set, item_names, self.uid);
|
||||
let mut coroutine = ImapFetch::new(context, sequence_set, item_names, !self.seq);
|
||||
|
||||
let data = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
@@ -87,7 +87,7 @@ impl ListEnvelopesCommand {
|
||||
}
|
||||
};
|
||||
|
||||
let table = EnvelopesTable::new(data, self.uid);
|
||||
let table = EnvelopesTable::new(data, !self.seq);
|
||||
|
||||
printer.out(table)?;
|
||||
Ok(())
|
||||
|
||||
@@ -51,9 +51,9 @@ pub struct SearchEnvelopesCommand {
|
||||
#[arg(name = "query", value_name = "QUERY", default_value = "all")]
|
||||
pub query: String,
|
||||
|
||||
/// Use UID SEARCH instead of SEARCH.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl SearchEnvelopesCommand {
|
||||
@@ -79,7 +79,7 @@ impl SearchEnvelopesCommand {
|
||||
|
||||
// SEARCH
|
||||
let mut arg = None;
|
||||
let mut coroutine = ImapSearch::new(context, criteria, self.uid);
|
||||
let mut coroutine = ImapSearch::new(context, criteria, !self.seq);
|
||||
|
||||
let ids = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
@@ -89,7 +89,7 @@ impl SearchEnvelopesCommand {
|
||||
}
|
||||
};
|
||||
|
||||
let table = SearchResultsTable::new(ids, self.uid);
|
||||
let table = SearchResultsTable::new(ids, !self.seq);
|
||||
|
||||
printer.out(table)?;
|
||||
Ok(())
|
||||
|
||||
@@ -52,9 +52,9 @@ pub struct SortEnvelopesCommand {
|
||||
#[arg(name = "query", value_name = "QUERY", default_value = "all")]
|
||||
pub query: String,
|
||||
|
||||
/// Use UID SORT instead of SORT.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl SortEnvelopesCommand {
|
||||
@@ -87,7 +87,7 @@ impl SortEnvelopesCommand {
|
||||
|
||||
// SORT
|
||||
let mut arg = None;
|
||||
let mut coroutine = ImapSort::new(context, sort_criteria, search_criteria, self.uid);
|
||||
let mut coroutine = ImapSort::new(context, sort_criteria, search_criteria, !self.seq);
|
||||
|
||||
let ids = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
@@ -97,7 +97,7 @@ impl SortEnvelopesCommand {
|
||||
}
|
||||
};
|
||||
|
||||
let table = SortResultsTable::new(ids, self.uid);
|
||||
let table = SortResultsTable::new(ids, !self.seq);
|
||||
|
||||
printer.out(table)?;
|
||||
Ok(())
|
||||
|
||||
@@ -44,9 +44,9 @@ pub struct ThreadEnvelopesCommand {
|
||||
#[arg(name = "query", value_name = "QUERY", default_value = "all")]
|
||||
pub query: String,
|
||||
|
||||
/// Use UID THREAD instead of THREAD.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl ThreadEnvelopesCommand {
|
||||
@@ -75,7 +75,7 @@ impl ThreadEnvelopesCommand {
|
||||
|
||||
// THREAD
|
||||
let mut arg = None;
|
||||
let mut coroutine = ImapThread::new(context, algorithm, search_criteria, self.uid);
|
||||
let mut coroutine = ImapThread::new(context, algorithm, search_criteria, !self.seq);
|
||||
|
||||
let (context, threads) = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
@@ -90,12 +90,12 @@ impl ThreadEnvelopesCommand {
|
||||
|
||||
// Fetch subjects for all messages in threads
|
||||
let subjects = if !all_ids.is_empty() {
|
||||
fetch_subjects(&mut stream, context, &all_ids, self.uid)?
|
||||
fetch_subjects(&mut stream, context, &all_ids, !self.seq)?
|
||||
} else {
|
||||
HashMap::new()
|
||||
};
|
||||
|
||||
let table = ThreadResultsTable::new(threads, subjects, self.uid);
|
||||
let table = ThreadResultsTable::new(threads, subjects, !self.seq);
|
||||
|
||||
printer.out(table)?;
|
||||
Ok(())
|
||||
|
||||
@@ -29,9 +29,9 @@ pub struct AddFlagsCommand {
|
||||
#[arg(short, long, required = true, num_args = 1..)]
|
||||
pub flags: Vec<String>,
|
||||
|
||||
/// Use UID STORE instead of STORE.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl AddFlagsCommand {
|
||||
@@ -65,7 +65,7 @@ impl AddFlagsCommand {
|
||||
// Store flags
|
||||
let mut arg = None;
|
||||
let mut coroutine =
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Add, flags, self.uid);
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Add, flags, !self.seq);
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
|
||||
@@ -29,9 +29,9 @@ pub struct RemoveFlagsCommand {
|
||||
#[arg(short, long, required = true, num_args = 1..)]
|
||||
pub flags: Vec<String>,
|
||||
|
||||
/// Use UID STORE instead of STORE.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl RemoveFlagsCommand {
|
||||
@@ -65,7 +65,7 @@ impl RemoveFlagsCommand {
|
||||
// Store flags
|
||||
let mut arg = None;
|
||||
let mut coroutine =
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Remove, flags, self.uid);
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Remove, flags, !self.seq);
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
|
||||
@@ -29,9 +29,9 @@ pub struct SetFlagsCommand {
|
||||
#[arg(short, long, required = true, num_args = 1..)]
|
||||
pub flags: Vec<String>,
|
||||
|
||||
/// Use UID STORE instead of STORE.
|
||||
/// Use sequence numbers instead of UIDs.
|
||||
#[arg(long)]
|
||||
pub uid: bool,
|
||||
pub seq: bool,
|
||||
}
|
||||
|
||||
impl SetFlagsCommand {
|
||||
@@ -65,7 +65,7 @@ impl SetFlagsCommand {
|
||||
// Store flags
|
||||
let mut arg = None;
|
||||
let mut coroutine =
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Replace, flags, self.uid);
|
||||
ImapStoreSilent::new(context, sequence_set, StoreType::Replace, flags, !self.seq);
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
|
||||
Reference in New Issue
Block a user