summaryrefslogtreecommitdiffstats
path: root/src/components/mail/listing/conversations.rs
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-03-18 19:13:07 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-03-18 19:13:07 +0200
commit9ff54f236b59e4bb9684353121e5686da08e26a5 (patch)
tree704d24740741a26079e820e4041151a84e8d1888 /src/components/mail/listing/conversations.rs
parenta8c1016f3773174d891bbddd45731eec86f51cd2 (diff)
Add conf_override! macro
conf_override! wraps struct definitions and defines a secondary Override struct that wraps each field in an Option. The macro mailbox_settings! is used to select settings from an account & mailbox index. If a user defines an overriding setting, the macro returns the override instead of the immediately next in the hierarchy setting. The selection is done for a specific field as follows: if per-folder override is defined, return per-folder override else if per-account override is defined, return per-account override else return global setting field value.
Diffstat (limited to 'src/components/mail/listing/conversations.rs')
-rw-r--r--src/components/mail/listing/conversations.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/components/mail/listing/conversations.rs b/src/components/mail/listing/conversations.rs
index 921b38e1..77c54351 100644
--- a/src/components/mail/listing/conversations.rs
+++ b/src/components/mail/listing/conversations.rs
@@ -593,20 +593,28 @@ impl ConversationsListing {
hash: ThreadHash,
) -> EntryStrings {
let thread = threads.thread_ref(hash);
- let settings = mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].tags);
let mut tags = String::new();
let mut colors = SmallVec::new();
let backend_lck = context.accounts[self.cursor_pos.0].backend.read().unwrap();
if let Some(t) = backend_lck.tags() {
let tags_lck = t.read().unwrap();
for t in e.labels().iter() {
- if settings.ignore_tags.contains(t) {
+ if mailbox_settings!(
+ context[self.cursor_pos.0][&self.cursor_pos.1]
+ .tags
+ .ignore_tags
+ )
+ .contains(t)
+ {
continue;
}
tags.push(' ');
tags.push_str(tags_lck.get(t).as_ref().unwrap());
tags.push(' ');
- if let Some(&c) = settings.colors.get(t) {
+ if let Some(&c) =
+ mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].tags.colors)
+ .get(t)
+ {
colors.push(c);
} else {
colors.push(Color::Byte(8));
@@ -698,10 +706,12 @@ impl ConversationsListing {
.collection
.get_env(root_env_hash);
use crate::cache::QueryTrait;
- if let Some(filter_query) =
- mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].listing)
+ if let Some(filter_query) = mailbox_settings!(
+ context[self.cursor_pos.0][&self.cursor_pos.1]
+ .listing
.filter
- .as_ref()
+ )
+ .as_ref()
{
if !root_envelope.is_match(filter_query) {
continue;