meli: restructure pub use melib::* imports
parent
c5ecaceae1
commit
299c8e0f99
|
@ -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::{
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use melib::Card;
|
||||
|
||||
use super::*;
|
||||
|
||||
mod contact_list;
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::{
|
|||
ops::{Deref, DerefMut},
|
||||
};
|
||||
|
||||
use melib::backends::EnvelopeHashBatch;
|
||||
use melib::{backends::EnvelopeHashBatch, Address};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
use std::{cmp, iter::FromIterator};
|
||||
|
||||
use melib::{Address, ThreadNode};
|
||||
|
||||
use super::{EntryStrings, *};
|
||||
use crate::{components::PageMovement, jobs::JoinHandle};
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
use std::{cmp, convert::TryInto, fmt::Write, iter::FromIterator};
|
||||
|
||||
use melib::{ThreadNode, Threads};
|
||||
|
||||
use super::*;
|
||||
use crate::components::PageMovement;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::{MailBackendExtensionStatus, SpecialUsageMailbox};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
use std::cmp;
|
||||
|
||||
use melib::UnixTimestamp;
|
||||
|
||||
use super::*;
|
||||
use crate::components::PageMovement;
|
||||
|
||||
|
|
|
@ -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<dyn Fn(&Context, &str) -> Vec<AutoCompleteEntry> + Send + Sync>;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -2396,77 +2396,82 @@ fn build_mailboxes_order(
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mailbox_utf7() {
|
||||
#[derive(Debug)]
|
||||
struct TestMailbox(String);
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
impl melib::BackendMailbox for TestMailbox {
|
||||
fn hash(&self) -> MailboxHash {
|
||||
unimplemented!()
|
||||
#[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 path(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
|
||||
fn children(&self) -> &[MailboxHash] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn clone(&self) -> Mailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn special_usage(&self) -> SpecialUsageMailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<MailboxHash> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn permissions(&self) -> MailboxPermissions {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn is_subscribed(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_is_subscribed(&mut self, _: bool) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_special_usage(&mut self, _: SpecialUsageMailbox) -> Result<()> {
|
||||
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());
|
||||
|
||||
fn name(&self) -> &str {
|
||||
&self.0
|
||||
let entry = MailboxEntry::new(
|
||||
MailboxStatus::None,
|
||||
n.to_string(),
|
||||
Box::new(ref_mbox),
|
||||
FileMailboxConf {
|
||||
mailbox_conf: conf,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
assert_eq!(&entry.path, d);
|
||||
}
|
||||
|
||||
fn path(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
|
||||
fn children(&self) -> &[MailboxHash] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn clone(&self) -> Mailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn special_usage(&self) -> SpecialUsageMailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<MailboxHash> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn permissions(&self) -> MailboxPermissions {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn is_subscribed(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_is_subscribed(&mut self, _: bool) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_special_usage(&mut self, _: SpecialUsageMailbox) -> Result<()> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
11
src/lib.rs
11
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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue