diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2018-08-08 10:41:25 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:27 +0300 |
commit | a8fed3a042fbf8510a46908eb3c7fecf1a643544 (patch) | |
tree | 200d41b2bfc753951afea79b79dbc27c26e6f927 /ui | |
parent | f16fd889e47caeeb4d52275a057ced5574db90a3 (diff) |
Add Charset type and Charset based decoding
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/components/mail/view.rs | 2 | ||||
-rw-r--r-- | ui/src/state.rs | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs index 8a8c2212..516e2002 100644 --- a/ui/src/components/mail/view.rs +++ b/ui/src/components/mail/view.rs @@ -292,7 +292,7 @@ impl Component for MailView { let envelope: &Envelope = &mailbox.collection[envelope_idx]; if let Some(u) = envelope.body().attachments().get(lidx) { match u.content_type().0 { - ContentType::Text => { + ContentType::Text { .. } => { self.mode = ViewMode::Attachment(lidx); self.dirty = true; } diff --git a/ui/src/state.rs b/ui/src/state.rs index edc5135d..c41c9549 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -41,6 +41,7 @@ use termion::{clear, cursor, style}; /// A context container for loaded settings, accounts, UI changes, etc. pub struct Context { pub accounts: Vec<Account>, + mailbox_hashes: FnvHashMap<u64, (usize, usize)>, pub settings: Settings, pub runtime_settings: Settings, @@ -151,6 +152,8 @@ impl State<std::io::Stdout> { context: Context { accounts, + mailbox_hashes: FnvHashMap::with_capacity_and_hasher(1, Default::default()), + _backends: backends, settings: settings.clone(), runtime_settings: settings, @@ -172,14 +175,24 @@ impl State<std::io::Stdout> { cursor::Goto(1, 1) ).unwrap(); s.flush(); - for account in &mut s.context.accounts { + for (x, account) in s.context.accounts.iter_mut().enumerate() { + for (y, folder) in account.settings.folders.iter().enumerate() { + s.context.mailbox_hashes.insert(folder.hash(), (x, y)); + } let sender = s.sender.clone(); account.watch(RefreshEventConsumer::new(Box::new(move |r| { sender.send(ThreadEvent::from(r)); }))); } + for (k, v) in &s.context.mailbox_hashes { + eprintln!("{:x} -> {:?}", k, v); + + } s } + pub fn hash_to_folder(&self, hash: u64) { + eprintln!("got refresh {:?}", self.context.mailbox_hashes[&hash]); + } /// If an owned thread returns a `ThreadEvent::ThreadJoin` event to `State` then it must remove /// the thread from its list and `join` it. |