diff --git a/melib/src/email.rs b/melib/src/email.rs
index 294e6a79..84622b9e 100644
--- a/melib/src/email.rs
+++ b/melib/src/email.rs
@@ -112,7 +112,6 @@ pub use address::{Address, MessageID, References, StrBuild, StrBuilder};
pub use attachments::{Attachment, AttachmentBuilder};
pub use compose::{attachment_from_file, Draft};
pub use headers::*;
-pub use mailto::*;
use smallvec::SmallVec;
use crate::{
diff --git a/src/command/actions.rs b/src/command/actions.rs
index 46c8decc..0a69606a 100644
--- a/src/command/actions.rs
+++ b/src/command/actions.rs
@@ -26,7 +26,7 @@
use std::path::PathBuf;
pub use melib::thread::{SortField, SortOrder};
-use melib::uuid::Uuid;
+use melib::{email::mailto::Mailto, uuid::Uuid};
use crate::components::Component;
@@ -91,7 +91,7 @@ pub enum ComposeAction {
SaveDraft,
ToggleSign,
ToggleEncrypt,
- Mailto(melib::Mailto),
+ Mailto(Mailto),
}
#[derive(Debug)]
diff --git a/src/components/contacts.rs b/src/components/contacts.rs
index b707ba14..ceeb90aa 100644
--- a/src/components/contacts.rs
+++ b/src/components/contacts.rs
@@ -21,6 +21,8 @@
use std::collections::HashMap;
+use melib::Card;
+
use super::*;
mod contact_list;
diff --git a/src/components/contacts/contact_list.rs b/src/components/contacts/contact_list.rs
index b5ce8e2a..ecc91e44 100644
--- a/src/components/contacts/contact_list.rs
+++ b/src/components/contacts/contact_list.rs
@@ -18,12 +18,12 @@
* You should have received a copy of the GNU General Public License
* along with meli. If not, see .
*/
+
use std::cmp;
-use melib::{backends::AccountHash, CardId};
+use melib::{backends::AccountHash, text_processing::TextProcessing, CardId, Draft};
use super::*;
-use crate::melib::text_processing::TextProcessing;
#[derive(Debug, PartialEq, Eq)]
enum ViewMode {
diff --git a/src/components/mail/compose.rs b/src/components/mail/compose.rs
index f5cca6b4..50d1a0b7 100644
--- a/src/components/mail/compose.rs
+++ b/src/components/mail/compose.rs
@@ -31,7 +31,8 @@ use std::{
use indexmap::IndexSet;
use melib::{
email::attachment_types::{ContentType, MultipartType},
- list_management, Draft,
+ list_management, Address, AddressBook, Draft, HeaderName, SpecialUsageMailbox, SubjectPrefix,
+ UnixTimestamp,
};
use nix::sys::wait::WaitStatus;
diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs
index 5d6e0982..11bb0182 100644
--- a/src/components/mail/listing.rs
+++ b/src/components/mail/listing.rs
@@ -25,7 +25,7 @@ use std::{
ops::{Deref, DerefMut},
};
-use melib::backends::EnvelopeHashBatch;
+use melib::{backends::EnvelopeHashBatch, Address};
use smallvec::SmallVec;
use super::*;
diff --git a/src/components/mail/listing/compact.rs b/src/components/mail/listing/compact.rs
index 127f4404..52103e19 100644
--- a/src/components/mail/listing/compact.rs
+++ b/src/components/mail/listing/compact.rs
@@ -22,6 +22,7 @@
use std::{cmp, collections::BTreeMap, convert::TryInto, iter::FromIterator};
use indexmap::IndexSet;
+use melib::{TagHash, Threads};
use super::*;
use crate::{components::PageMovement, jobs::JoinHandle};
diff --git a/src/components/mail/listing/conversations.rs b/src/components/mail/listing/conversations.rs
index d9751d61..c2c45320 100644
--- a/src/components/mail/listing/conversations.rs
+++ b/src/components/mail/listing/conversations.rs
@@ -22,6 +22,7 @@
use std::{collections::BTreeMap, iter::FromIterator};
use indexmap::IndexSet;
+use melib::{TagHash, Threads, UnixTimestamp};
use super::*;
use crate::{components::PageMovement, jobs::JoinHandle};
diff --git a/src/components/mail/listing/plain.rs b/src/components/mail/listing/plain.rs
index d7af0c33..f0416ccd 100644
--- a/src/components/mail/listing/plain.rs
+++ b/src/components/mail/listing/plain.rs
@@ -21,6 +21,8 @@
use std::{cmp, iter::FromIterator};
+use melib::{Address, ThreadNode};
+
use super::{EntryStrings, *};
use crate::{components::PageMovement, jobs::JoinHandle};
diff --git a/src/components/mail/listing/thread.rs b/src/components/mail/listing/thread.rs
index ed0398f2..c1439b72 100644
--- a/src/components/mail/listing/thread.rs
+++ b/src/components/mail/listing/thread.rs
@@ -21,6 +21,8 @@
use std::{cmp, convert::TryInto, fmt::Write, iter::FromIterator};
+use melib::{ThreadNode, Threads};
+
use super::*;
use crate::components::PageMovement;
diff --git a/src/components/mail/status.rs b/src/components/mail/status.rs
index b93e93a1..92554e5d 100644
--- a/src/components/mail/status.rs
+++ b/src/components/mail/status.rs
@@ -19,6 +19,8 @@
* along with meli. If not, see .
*/
+use melib::{MailBackendExtensionStatus, SpecialUsageMailbox};
+
use super::*;
#[derive(Debug)]
diff --git a/src/components/mail/view.rs b/src/components/mail/view.rs
index 4d40ec1d..6b3fd8f7 100644
--- a/src/components/mail/view.rs
+++ b/src/components/mail/view.rs
@@ -29,7 +29,8 @@ use std::{
};
use melib::{
- datetime, email::attachment_types::ContentType, list_management, parser::BytesExt, HeaderName,
+ datetime, email::attachment_types::ContentType, list_management, mailto::Mailto,
+ parser::BytesExt, Card, Draft, HeaderName, SpecialUsageMailbox,
};
use smallvec::SmallVec;
@@ -46,7 +47,7 @@ pub use self::thread::*;
mod envelope;
use linkify::LinkFinder;
-use xdg_utils::query_default_app;
+use melib::xdg_utils::query_default_app;
pub use self::envelope::*;
diff --git a/src/components/mail/view/envelope.rs b/src/components/mail/view/envelope.rs
index 061a6c9c..610ac27c 100644
--- a/src/components/mail/view/envelope.rs
+++ b/src/components/mail/view/envelope.rs
@@ -22,7 +22,7 @@
use std::process::{Command, Stdio};
use linkify::{Link, LinkFinder};
-use xdg_utils::query_default_app;
+use melib::xdg_utils::query_default_app;
use super::*;
diff --git a/src/components/mail/view/thread.rs b/src/components/mail/view/thread.rs
index c0b7298f..89e0a40c 100644
--- a/src/components/mail/view/thread.rs
+++ b/src/components/mail/view/thread.rs
@@ -21,6 +21,8 @@
use std::cmp;
+use melib::UnixTimestamp;
+
use super::*;
use crate::components::PageMovement;
diff --git a/src/components/utilities.rs b/src/components/utilities.rs
index 25e71b10..07b300f4 100644
--- a/src/components/utilities.rs
+++ b/src/components/utilities.rs
@@ -21,7 +21,8 @@
/*! Various useful components that can be used in a generic fashion.
*/
-use text_processing::Reflow;
+
+use melib::{text_processing::Reflow, ShellExpandTrait};
pub type AutoCompleteFn = Box Vec + Send + Sync>;
diff --git a/src/conf.rs b/src/conf.rs
index 986793ae..3f6d7645 100644
--- a/src/conf.rs
+++ b/src/conf.rs
@@ -67,6 +67,7 @@ use melib::{
conf::{AccountSettings, MailboxConf, ToggleFlag},
error::*,
};
+use pager::PagerSettings;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
pub use self::{accounts::Account, composing::*, pgp::*, shortcuts::*, tags::*};
@@ -74,7 +75,6 @@ use self::{
default_vals::*, listing::ListingSettings, notifications::NotificationsSettings,
terminal::TerminalSettings,
};
-use crate::pager::PagerSettings;
#[macro_export]
macro_rules! split_command {
diff --git a/src/conf/accounts.rs b/src/conf/accounts.rs
index 27802575..8053e452 100644
--- a/src/conf/accounts.rs
+++ b/src/conf/accounts.rs
@@ -2396,77 +2396,82 @@ fn build_mailboxes_order(
}
}
-#[test]
-fn test_mailbox_utf7() {
- #[derive(Debug)]
- struct TestMailbox(String);
-
- impl melib::BackendMailbox for TestMailbox {
- fn hash(&self) -> MailboxHash {
- unimplemented!()
- }
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_mailbox_utf7() {
+ #[derive(Debug)]
+ struct TestMailbox(String);
+
+ impl melib::BackendMailbox for TestMailbox {
+ fn hash(&self) -> MailboxHash {
+ unimplemented!()
+ }
- fn name(&self) -> &str {
- &self.0
- }
+ fn name(&self) -> &str {
+ &self.0
+ }
- fn path(&self) -> &str {
- &self.0
- }
+ fn path(&self) -> &str {
+ &self.0
+ }
- fn children(&self) -> &[MailboxHash] {
- unimplemented!()
- }
+ fn children(&self) -> &[MailboxHash] {
+ unimplemented!()
+ }
- fn clone(&self) -> Mailbox {
- unimplemented!()
- }
+ fn clone(&self) -> Mailbox {
+ unimplemented!()
+ }
- fn special_usage(&self) -> SpecialUsageMailbox {
- unimplemented!()
- }
+ fn special_usage(&self) -> SpecialUsageMailbox {
+ unimplemented!()
+ }
- fn parent(&self) -> Option {
- unimplemented!()
- }
+ fn parent(&self) -> Option {
+ unimplemented!()
+ }
- fn permissions(&self) -> MailboxPermissions {
- unimplemented!()
- }
+ fn permissions(&self) -> MailboxPermissions {
+ unimplemented!()
+ }
- fn is_subscribed(&self) -> bool {
- unimplemented!()
- }
+ fn is_subscribed(&self) -> bool {
+ unimplemented!()
+ }
- fn set_is_subscribed(&mut self, _: bool) -> Result<()> {
- unimplemented!()
- }
+ fn set_is_subscribed(&mut self, _: bool) -> Result<()> {
+ unimplemented!()
+ }
- fn set_special_usage(&mut self, _: SpecialUsageMailbox) -> Result<()> {
- unimplemented!()
- }
+ fn set_special_usage(&mut self, _: SpecialUsageMailbox) -> Result<()> {
+ unimplemented!()
+ }
- fn count(&self) -> Result<(usize, usize)> {
- unimplemented!()
+ fn count(&self) -> Result<(usize, usize)> {
+ unimplemented!()
+ }
+ }
+ for (n, d) in [
+ ("~peter/mail/&U,BTFw-/&ZeVnLIqe-", "~peter/mail/台北/日本語"),
+ ("&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-", "Отправленные"),
+ ] {
+ let ref_mbox = TestMailbox(n.to_string());
+ let mut conf: melib::MailboxConf = Default::default();
+ conf.extra.insert("encoding".to_string(), "utf7".into());
+
+ let entry = MailboxEntry::new(
+ MailboxStatus::None,
+ n.to_string(),
+ Box::new(ref_mbox),
+ FileMailboxConf {
+ mailbox_conf: conf,
+ ..Default::default()
+ },
+ );
+ assert_eq!(&entry.path, d);
}
- }
- for (n, d) in [
- ("~peter/mail/&U,BTFw-/&ZeVnLIqe-", "~peter/mail/台北/日本語"),
- ("&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-", "Отправленные"),
- ] {
- let ref_mbox = TestMailbox(n.to_string());
- let mut conf: melib::MailboxConf = Default::default();
- conf.extra.insert("encoding".to_string(), "utf7".into());
-
- let entry = MailboxEntry::new(
- MailboxStatus::None,
- n.to_string(),
- Box::new(ref_mbox),
- FileMailboxConf {
- mailbox_conf: conf,
- ..Default::default()
- },
- );
- assert_eq!(&entry.path, d);
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 875b50cd..81f1144e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -48,8 +48,11 @@ pub use structopt::StructOpt;
static GLOBAL: System = System;
#[macro_use]
-extern crate melib;
-pub use melib::*;
+pub extern crate melib;
+pub use melib::{
+ error::*, log, AccountHash, Envelope, EnvelopeHash, EnvelopeRef, Flag, LogLevel, Mail, Mailbox,
+ MailboxHash, ThreadHash, ToggleFlag,
+};
#[macro_use]
pub mod types;
@@ -71,7 +74,9 @@ pub use crate::components::*;
#[macro_use]
pub mod conf;
-pub use crate::conf::*;
+pub use crate::conf::{
+ Account, DotAddressable, IndexStyle, SearchBackend, Settings, Shortcuts, ThemeAttribute,
+};
#[cfg(feature = "sqlite3")]
pub mod sqlite3;
diff --git a/src/main.rs b/src/main.rs
index 07d828b9..df9830af 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -324,7 +324,9 @@ fn run_app(opt: Opt) -> Result<()> {
recv(receiver) -> r => {
match r {
Ok(ThreadEvent::Pulse) | Ok(ThreadEvent::UIEvent(UIEvent::Timer(_))) => {},
- _ => {debug!(&r);}
+ _ => {
+ log::debug!("{:?}", &r);
+ }
}
match r.unwrap() {
ThreadEvent::Input((Key::Ctrl('z'), _)) if state.mode != UIMode::Embed => {
@@ -424,7 +426,7 @@ fn run_app(opt: Opt) -> Result<()> {
state.redraw();
},
ThreadEvent::JobFinished(id) => {
- debug!("Job finished {}", id);
+ log::debug!("Job finished {}", id);
for account in state.context.accounts.values_mut() {
if account.process_event(&id) {
break;
@@ -449,7 +451,7 @@ fn run_app(opt: Opt) -> Result<()> {
}
other => {
- debug!("got other signal: {:?}", other);
+ log::debug!("got other signal: {:?}", other);
}
}
},
diff --git a/src/state.rs b/src/state.rs
index 1cc2188c..c03087cb 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -33,7 +33,10 @@ use std::{env, os::unix::io::RawFd, sync::Arc, thread};
use crossbeam::channel::{unbounded, Receiver, Sender};
use indexmap::IndexMap;
//use crate::plugins::PluginManager;
-use melib::backends::{AccountHash, BackendEventConsumer};
+use melib::{
+ backends::{AccountHash, BackendEvent, BackendEventConsumer, Backends, RefreshEvent},
+ UnixTimestamp,
+};
use smallvec::SmallVec;
use super::*;
@@ -177,7 +180,7 @@ impl Context {
let settings = Box::new(Settings::new().unwrap());
let accounts = vec![{
let name = "test".to_string();
- let mut account_conf = AccountConf::default();
+ let mut account_conf = crate::conf::AccountConf::default();
account_conf.conf.format = "maildir".to_string();
account_conf.account.format = "maildir".to_string();
account_conf.account.root_mailbox = dir.path().display().to_string();
diff --git a/tools/src/embed.rs b/tools/src/embed.rs
index 63a7f6a2..bda184b0 100644
--- a/tools/src/embed.rs
+++ b/tools/src/embed.rs
@@ -433,7 +433,9 @@ fn main() -> std::io::Result<()> {
recv(receiver) -> r => {
match r {
Ok(ThreadEvent::Pulse) | Ok(ThreadEvent::UIEvent(UIEvent::Timer(_))) => {},
- _ => {debug!(&r);}
+ _ => {
+ log::debug!("{:?}", &r);
+ }
}
match r.unwrap() {
ThreadEvent::Input((Key::Ctrl('z'), _)) if state.mode != UIMode::Embed => {
@@ -528,7 +530,7 @@ fn main() -> std::io::Result<()> {
state.redraw();
},
ThreadEvent::JobFinished(id) => {
- debug!("Job finished {}", id);
+ log::debug!("Job finished {}", id);
for account in state.context.accounts.values_mut() {
if account.process_event(&id) {
break;
@@ -553,7 +555,7 @@ fn main() -> std::io::Result<()> {
}
other => {
- debug!("got other signal: {:?}", other);
+ log::debug!("got other signal: {:?}", other);
}
}
},