mirror of
https://github.com/chatmail/core.git
synced 2026-05-17 05:46:30 +03:00
some comments fix imap->inbox naming in example
This commit is contained in:
@@ -496,7 +496,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
|
|||||||
println!("{:#?}", context.get_info());
|
println!("{:#?}", context.get_info());
|
||||||
}
|
}
|
||||||
"interrupt" => {
|
"interrupt" => {
|
||||||
interrupt_imap_idle(context);
|
interrupt_inbox_idle(context, true);
|
||||||
}
|
}
|
||||||
"maybenetwork" => {
|
"maybenetwork" => {
|
||||||
maybe_network(context);
|
maybe_network(context);
|
||||||
|
|||||||
@@ -150,11 +150,11 @@ fn start_threads(c: Arc<RwLock<Context>>) {
|
|||||||
let ctx = c.clone();
|
let ctx = c.clone();
|
||||||
let handle_imap = std::thread::spawn(move || loop {
|
let handle_imap = std::thread::spawn(move || loop {
|
||||||
while_running!({
|
while_running!({
|
||||||
perform_imap_jobs(&ctx.read().unwrap());
|
perform_inbox_jobs(&ctx.read().unwrap());
|
||||||
perform_imap_fetch(&ctx.read().unwrap());
|
perform_inbox_fetch(&ctx.read().unwrap());
|
||||||
while_running!({
|
while_running!({
|
||||||
let context = ctx.read().unwrap();
|
let context = ctx.read().unwrap();
|
||||||
perform_imap_idle(&context);
|
perform_inbox_idle(&context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -202,7 +202,7 @@ fn stop_threads(context: &Context) {
|
|||||||
println!("Stopping threads");
|
println!("Stopping threads");
|
||||||
IS_RUNNING.store(false, Ordering::Relaxed);
|
IS_RUNNING.store(false, Ordering::Relaxed);
|
||||||
|
|
||||||
interrupt_imap_idle(context);
|
interrupt_inbox_idle(context, true);
|
||||||
interrupt_mvbox_idle(context);
|
interrupt_mvbox_idle(context);
|
||||||
interrupt_sentbox_idle(context);
|
interrupt_sentbox_idle(context);
|
||||||
interrupt_smtp_idle(context);
|
interrupt_smtp_idle(context);
|
||||||
@@ -455,9 +455,9 @@ unsafe fn handle_cmd(line: &str, ctx: Arc<RwLock<Context>>) -> Result<ExitResult
|
|||||||
}
|
}
|
||||||
"imap-jobs" => {
|
"imap-jobs" => {
|
||||||
if HANDLE.clone().lock().unwrap().is_some() {
|
if HANDLE.clone().lock().unwrap().is_some() {
|
||||||
println!("imap-jobs are already running in a thread.");
|
println!("inbox-jobs are already running in a thread.");
|
||||||
} else {
|
} else {
|
||||||
perform_imap_jobs(&ctx.read().unwrap());
|
perform_inbox_jobs(&ctx.read().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"configure" => {
|
"configure" => {
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
//! # Imap handling module
|
||||||
|
//!
|
||||||
|
//! uses [async-email/async-imap](https://github.com/async-email/async-imap)
|
||||||
|
//! to implement connect, fetch, delete functionality with standard IMAP servers.
|
||||||
|
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
||||||
|
|
||||||
@@ -280,7 +285,7 @@ impl Imap {
|
|||||||
cfg.has_xlist = false;
|
cfg.has_xlist = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Connects to configured account
|
/// Connects to imap account using already-configured parameters.
|
||||||
pub fn connect_configured(&self, context: &Context) -> Result<()> {
|
pub fn connect_configured(&self, context: &Context) -> Result<()> {
|
||||||
if async_std::task::block_on(async move {
|
if async_std::task::block_on(async move {
|
||||||
self.is_connected().await && !self.should_reconnect()
|
self.is_connected().await && !self.should_reconnect()
|
||||||
@@ -310,6 +315,8 @@ impl Imap {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// tries connecting to imap account using the specific login
|
||||||
|
/// parameters
|
||||||
pub fn connect(&self, context: &Context, lp: &LoginParam) -> bool {
|
pub fn connect(&self, context: &Context, lp: &LoginParam) -> bool {
|
||||||
task::block_on(async move {
|
task::block_on(async move {
|
||||||
if lp.mail_server.is_empty() || lp.mail_user.is_empty() || lp.mail_pw.is_empty() {
|
if lp.mail_server.is_empty() || lp.mail_user.is_empty() || lp.mail_pw.is_empty() {
|
||||||
|
|||||||
Reference in New Issue
Block a user