melib/imap: remove unused imap_trace! and fix comp

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/365/head
Manos Pitsidianakis 2 months ago
parent 3b93fa8e7c
commit b820bd6d9c
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -183,10 +183,11 @@ install-bin: meli
.NOTPARALLEL: yes .NOTPARALLEL: yes
install: meli install-bin install-doc install: meli install-bin install-doc
@(if [ -z $${NO_MAN+x} ]; then \ @(if [ -z $${NO_MAN+x} ]; then \
echo "\n You're ready to go. You might want to read the \"STARTING WITH meli\" section in the manpage (\`man meli\`)" ;\ $(PRINTF) "\n You're ready to go. You might want to read the \"STARTING WITH meli\" section in the manpage (\`man meli\`)" ;\
$(PRINTF) "\n or the tutorial in meli(7) (\`man 7 meli\`).\n" ;\
fi) fi)
@echo " - Report bugs in the mailing list or git issue tracker ${UNDERLINE}https://git.meli.delivery${ANSI_RESET}" @$(PRINTF) " - Report bugs in the mailing list or git issue tracker ${UNDERLINE}https://git.meli-email.org${ANSI_RESET}\n"
@echo " - If you have a specific feature or workflow you want to use, you can post in the mailing list or git issue tracker." @$(PRINTF) " - If you have a specific feature or workflow you want to use, you can post in the mailing list or git issue tracker.\n"
.PHONY: dist .PHONY: dist
dist: dist:

@ -31,9 +31,8 @@ use crate::{
LogLevel, LogLevel,
}; };
extern crate native_tls; extern crate native_tls;
#[cfg(debug_assertions)]
use std::borrow::Cow;
use std::{ use std::{
borrow::Cow,
collections::HashSet, collections::HashSet,
convert::TryFrom, convert::TryFrom,
future::Future, future::Future,
@ -64,17 +63,6 @@ pub use smol::Async as AsyncWrapper;
const IMAP_PROTOCOL_TIMEOUT: Duration = Duration::from_secs(60 * 28); const IMAP_PROTOCOL_TIMEOUT: Duration = Duration::from_secs(60 * 28);
macro_rules! imap_trace {
($conn:expr, $fmt:literal, $($t:tt)*) => {
#[cfg(debug_assertions)]
log::trace!(std::concat!("{} ", $fmt), $conn.id, $($t)*);
};
($conn:expr, $fmt:literal) => {
#[cfg(debug_assertions)]
log::trace!(std::concat!("{} ", $fmt), $conn.id);
};
}
macro_rules! imap_log { macro_rules! imap_log {
($fn:ident, $conn:expr, $fmt:literal, $($t:tt)*) => { ($fn:ident, $conn:expr, $fmt:literal, $($t:tt)*) => {
log::$fn!(std::concat!("{} ", $fmt), $conn.id, $($t)*); log::$fn!(std::concat!("{} ", $fmt), $conn.id, $($t)*);
@ -125,7 +113,6 @@ impl Default for ImapExtensionUse {
#[derive(Debug)] #[derive(Debug)]
pub struct ImapStream { pub struct ImapStream {
pub cmd_id: usize, pub cmd_id: usize,
#[cfg(debug_assertions)]
pub id: Cow<'static, str>, pub id: Cow<'static, str>,
pub stream: AsyncWrapper<Connection>, pub stream: AsyncWrapper<Connection>,
pub protocol: ImapProtocol, pub protocol: ImapProtocol,
@ -152,7 +139,6 @@ async fn try_await(cl: impl Future<Output = Result<()>> + Send) -> Result<()> {
#[derive(Debug)] #[derive(Debug)]
pub struct ImapConnection { pub struct ImapConnection {
#[cfg(debug_assertions)]
pub id: Cow<'static, str>, pub id: Cow<'static, str>,
pub stream: Result<ImapStream>, pub stream: Result<ImapStream>,
pub server_conf: ImapServerConf, pub server_conf: ImapServerConf,
@ -163,7 +149,7 @@ pub struct ImapConnection {
impl ImapStream { impl ImapStream {
pub async fn new_connection( pub async fn new_connection(
server_conf: &ImapServerConf, server_conf: &ImapServerConf,
#[cfg(debug_assertions)] id: Cow<'static, str>, id: Cow<'static, str>,
uid_store: &UIDStore, uid_store: &UIDStore,
) -> Result<(Capabilities, Self)> { ) -> Result<(Capabilities, Self)> {
let path = &server_conf.server_hostname; let path = &server_conf.server_hostname;
@ -310,7 +296,6 @@ impl ImapStream {
let mut res = Vec::with_capacity(8 * 1024); let mut res = Vec::with_capacity(8 * 1024);
let mut ret = Self { let mut ret = Self {
cmd_id, cmd_id,
#[cfg(debug_assertions)]
id, id,
stream, stream,
protocol: server_conf.protocol, protocol: server_conf.protocol,
@ -527,7 +512,7 @@ impl ImapStream {
} }
} }
} }
//imap_trace!(self, "returning IMAP response:\n{:?}", &ret); //imap_log!(trace, self, "returning IMAP response:\n{:?}", &ret);
Ok(()) Ok(())
} }
@ -548,9 +533,9 @@ impl ImapStream {
match self.protocol { match self.protocol {
ImapProtocol::IMAP { .. } => { ImapProtocol::IMAP { .. } => {
if matches!(command.body, CommandBody::Login { .. }) { if matches!(command.body, CommandBody::Login { .. }) {
imap_trace!(self, "sent: M{} LOGIN ..", self.cmd_id - 1); imap_log!(trace, self, "sent: M{} LOGIN ..", self.cmd_id - 1);
} else { } else {
imap_trace!(self, "sent: M{} {:?}", self.cmd_id - 1, command.body); imap_log!(trace, self, "sent: M{} {:?}", self.cmd_id - 1, command.body);
} }
} }
ImapProtocol::ManageSieve => {} ImapProtocol::ManageSieve => {}
@ -604,11 +589,11 @@ impl ImapStream {
match self.protocol { match self.protocol {
ImapProtocol::IMAP { .. } => { ImapProtocol::IMAP { .. } => {
if !command.starts_with(b"LOGIN") { if !command.starts_with(b"LOGIN") {
imap_trace!(self, "sent: M{} {}", self.cmd_id - 1, unsafe { imap_log!(trace, self, "sent: M{} {}", self.cmd_id - 1, unsafe {
std::str::from_utf8_unchecked(command) std::str::from_utf8_unchecked(command)
}); });
} else { } else {
imap_trace!(self, "sent: M{} LOGIN ..", self.cmd_id - 1); imap_log!(trace, self, "sent: M{} LOGIN ..", self.cmd_id - 1);
} }
} }
ImapProtocol::ManageSieve => {} ImapProtocol::ManageSieve => {}
@ -638,12 +623,11 @@ impl ImapStream {
impl ImapConnection { impl ImapConnection {
pub fn new_connection( pub fn new_connection(
server_conf: &ImapServerConf, server_conf: &ImapServerConf,
#[cfg(debug_assertions)] id: Cow<'static, str>, id: Cow<'static, str>,
uid_store: Arc<UIDStore>, uid_store: Arc<UIDStore>,
) -> Self { ) -> Self {
Self { Self {
stream: Err(Error::new("Offline".to_string())), stream: Err(Error::new("Offline".to_string())),
#[cfg(debug_assertions)]
id, id,
server_conf: server_conf.clone(), server_conf: server_conf.clone(),
sync_policy: if *uid_store.keep_offline_cache.lock().unwrap() { sync_policy: if *uid_store.keep_offline_cache.lock().unwrap() {
@ -679,9 +663,15 @@ impl ImapConnection {
}) })
.await .await
{ {
imap_trace!(self, "connect(): connection is probably dead: {:?}", &_err); imap_log!(
trace,
self,
"connect(): connection is probably dead: {:?}",
&_err
);
} else { } else {
imap_trace!( imap_log!(
trace,
self, self,
"connect(): connection is probably alive, NOOP returned {:?}", "connect(): connection is probably alive, NOOP returned {:?}",
&String::from_utf8_lossy(&ret) &String::from_utf8_lossy(&ret)
@ -689,13 +679,9 @@ impl ImapConnection {
return Ok(()); return Ok(());
} }
} }
let new_stream = ImapStream::new_connection( let new_stream =
&self.server_conf, ImapStream::new_connection(&self.server_conf, self.id.clone(), &self.uid_store)
#[cfg(debug_assertions)] .await;
self.id.clone(),
&self.uid_store,
)
.await;
if let Err(err) = new_stream.as_ref() { if let Err(err) = new_stream.as_ref() {
self.uid_store.is_online.lock().unwrap().1 = Err(err.clone()); self.uid_store.is_online.lock().unwrap().1 = Err(err.clone());
} else { } else {
@ -769,7 +755,6 @@ impl ImapConnection {
ImapResponse::Ok(_) => { ImapResponse::Ok(_) => {
let ImapStream { let ImapStream {
cmd_id, cmd_id,
#[cfg(debug_assertions)]
id, id,
stream, stream,
protocol, protocol,
@ -779,7 +764,6 @@ impl ImapConnection {
let stream = stream.into_inner()?; let stream = stream.into_inner()?;
self.stream = Ok(ImapStream { self.stream = Ok(ImapStream {
cmd_id, cmd_id,
#[cfg(debug_assertions)]
id, id,
stream: AsyncWrapper::new(stream.deflate())?, stream: AsyncWrapper::new(stream.deflate())?,
protocol, protocol,
@ -823,7 +807,8 @@ impl ImapConnection {
ImapResponse::No(ref _response_code) ImapResponse::No(ref _response_code)
if required_responses.intersects(RequiredResponses::NO_REQUIRED) => if required_responses.intersects(RequiredResponses::NO_REQUIRED) =>
{ {
imap_trace!( imap_log!(
trace,
self, self,
"Received expected NO response: {:?} {:?}", "Received expected NO response: {:?} {:?}",
_response_code, _response_code,
@ -831,7 +816,8 @@ impl ImapConnection {
); );
} }
ImapResponse::No(ref response_code) => { ImapResponse::No(ref response_code) => {
imap_trace!( imap_log!(
trace,
self, self,
"Received NO response: {:?} {:?}", "Received NO response: {:?} {:?}",
response_code, response_code,
@ -849,7 +835,8 @@ impl ImapConnection {
return r.into(); return r.into();
} }
ImapResponse::Bad(ref response_code) => { ImapResponse::Bad(ref response_code) => {
imap_trace!( imap_log!(
trace,
self, self,
"Received BAD response: {:?} {:?}", "Received BAD response: {:?} {:?}",
response_code, response_code,
@ -868,12 +855,12 @@ impl ImapConnection {
} }
_ => {} _ => {}
} }
/* imap_trace!(self, /* imap_log!(trace, self,
"check every line for required_responses: {:#?}", "check every line for required_responses: {:#?}",
&required_responses &required_responses
);*/ );*/
for l in response.split_rn() { for l in response.split_rn() {
/* imap_trace!(self, "check line: {}", &l); */ /* imap_log!(trace, self, "check line: {}", &l); */
if required_responses.check(l) || !self.process_untagged(l).await? { if required_responses.check(l) || !self.process_untagged(l).await? {
ret.extend_from_slice(l); ret.extend_from_slice(l);
} }
@ -992,7 +979,8 @@ impl ImapConnection {
.await?; .await?;
self.read_response(ret, RequiredResponses::SELECT_REQUIRED) self.read_response(ret, RequiredResponses::SELECT_REQUIRED)
.await?; .await?;
imap_trace!( imap_log!(
trace,
self, self,
"{} SELECT response {}", "{} SELECT response {}",
imap_path, imap_path,
@ -1076,7 +1064,12 @@ impl ImapConnection {
self.read_response(ret, RequiredResponses::EXAMINE_REQUIRED) self.read_response(ret, RequiredResponses::EXAMINE_REQUIRED)
.await?; .await?;
imap_trace!(self, "EXAMINE response {}", String::from_utf8_lossy(ret)); imap_log!(
trace,
self,
"EXAMINE response {}",
String::from_utf8_lossy(ret)
);
let select_response = protocol_parser::select_response(ret).chain_err_summary(|| { let select_response = protocol_parser::select_response(ret).chain_err_summary(|| {
format!("Could not parse select response for mailbox {}", imap_path) format!("Could not parse select response for mailbox {}", imap_path)
})?; })?;

@ -95,7 +95,6 @@ impl ManageSieveConnection {
Ok(Self { Ok(Self {
inner: ImapConnection::new_connection( inner: ImapConnection::new_connection(
&server_conf, &server_conf,
#[cfg(debug_assertions)]
"ManageSieveConnection::new()".into(), "ManageSieveConnection::new()".into(),
uid_store, uid_store,
), ),

@ -381,7 +381,6 @@ impl MailBackend for ImapType {
} }
}; };
Ok(Box::pin(async_stream::try_stream! { Ok(Box::pin(async_stream::try_stream! {
#[cfg(debug_assertions)]
let id = state.connection.lock().await.id.clone(); let id = state.connection.lock().await.id.clone();
{ {
let f = &state.uid_store.mailboxes.lock().await[&mailbox_hash]; let f = &state.uid_store.mailboxes.lock().await[&mailbox_hash];
@ -393,7 +392,6 @@ impl MailBackend for ImapType {
}; };
loop { loop {
let res = fetch_hlpr(&mut state).await.map_err(|err| { let res = fetch_hlpr(&mut state).await.map_err(|err| {
#[cfg(debug_assertions)]
log::trace!("{} fetch_hlpr at stage {:?} err {:?}", id, state.stage, &err); log::trace!("{} fetch_hlpr at stage {:?} err {:?}", id, state.stage, &err);
err err
})?; })?;
@ -476,7 +474,7 @@ impl MailBackend for ImapType {
Ok(Box::pin(async move { Ok(Box::pin(async move {
match timeout(timeout_dur, connection.lock()).await { match timeout(timeout_dur, connection.lock()).await {
Ok(mut conn) => { Ok(mut conn) => {
imap_trace!(conn, "is_online"); imap_log!(trace, conn, "is_online");
match timeout(timeout_dur, conn.connect()).await { match timeout(timeout_dur, conn.connect()).await {
Ok(Ok(())) => Ok(()), Ok(Ok(())) => Ok(()),
Err(err) | Ok(Err(err)) => { Err(err) | Ok(Err(err)) => {
@ -512,7 +510,6 @@ impl MailBackend for ImapType {
idle(ImapWatchKit { idle(ImapWatchKit {
conn: ImapConnection::new_connection( conn: ImapConnection::new_connection(
&server_conf, &server_conf,
#[cfg(debug_assertions)]
"watch()::idle".into(), "watch()::idle".into(),
uid_store.clone(), uid_store.clone(),
), ),
@ -524,7 +521,6 @@ impl MailBackend for ImapType {
poll_with_examine(ImapWatchKit { poll_with_examine(ImapWatchKit {
conn: ImapConnection::new_connection( conn: ImapConnection::new_connection(
&server_conf, &server_conf,
#[cfg(debug_assertions)]
"watch()::poll_with_examine".into(), "watch()::poll_with_examine".into(),
uid_store.clone(), uid_store.clone(),
), ),
@ -901,7 +897,8 @@ impl MailBackend for ImapType {
conn.send_command(CommandBody::Expunge).await?; conn.send_command(CommandBody::Expunge).await?;
conn.read_response(&mut response, RequiredResponses::empty()) conn.read_response(&mut response, RequiredResponses::empty())
.await?; .await?;
imap_trace!( imap_log!(
trace,
conn, conn,
"EXPUNGE response: {}", "EXPUNGE response: {}",
&String::from_utf8_lossy(&response) &String::from_utf8_lossy(&response)
@ -1227,7 +1224,8 @@ impl MailBackend for ImapType {
.await?; .await?;
conn.read_response(&mut response, RequiredResponses::SEARCH) conn.read_response(&mut response, RequiredResponses::SEARCH)
.await?; .await?;
imap_trace!( imap_log!(
trace,
conn, conn,
"searching for {} returned: {}", "searching for {} returned: {}",
query_str, query_str,
@ -1323,12 +1321,8 @@ impl ImapType {
server_conf.timeout, server_conf.timeout,
) )
}); });
let connection = ImapConnection::new_connection( let connection =
&server_conf, ImapConnection::new_connection(&server_conf, "ImapType::new".into(), uid_store.clone());
#[cfg(debug_assertions)]
"ImapType::new".into(),
uid_store.clone(),
);
Ok(Box::new(Self { Ok(Box::new(Self {
server_conf, server_conf,
@ -1341,7 +1335,6 @@ impl ImapType {
pub fn shell(&mut self) { pub fn shell(&mut self) {
let mut conn = ImapConnection::new_connection( let mut conn = ImapConnection::new_connection(
&self.server_conf, &self.server_conf,
#[cfg(debug_assertions)]
"ImapType::shell".into(), "ImapType::shell".into(),
self.uid_store.clone(), self.uid_store.clone(),
); );
@ -1389,7 +1382,7 @@ impl ImapType {
if input.trim() == "IDLE" { if input.trim() == "IDLE" {
let mut iter = ImapBlockingConnection::from(conn); let mut iter = ImapBlockingConnection::from(conn);
while let Some(line) = iter.next() { while let Some(line) = iter.next() {
imap_trace!("out: {}", unsafe { std::str::from_utf8_unchecked(&line) }); imap_log!(trace, "out: {}", unsafe { std::str::from_utf8_unchecked(&line) });
} }
conn = iter.into_conn(); conn = iter.into_conn();
} }
@ -1428,7 +1421,7 @@ impl ImapType {
conn.read_response(&mut res, RequiredResponses::LIST_REQUIRED) conn.read_response(&mut res, RequiredResponses::LIST_REQUIRED)
.await?; .await?;
} }
imap_trace!(conn, "LIST reply: {}", String::from_utf8_lossy(&res)); imap_log!(trace, conn, "LIST reply: {}", String::from_utf8_lossy(&res));
for l in res.split_rn() { for l in res.split_rn() {
if !l.starts_with(b"*") { if !l.starts_with(b"*") {
continue; continue;
@ -1470,14 +1463,14 @@ impl ImapType {
} }
} }
} else { } else {
imap_trace!(conn, "parse error for {:?}", l); imap_log!(trace, conn, "parse error for {:?}", l);
} }
} }
mailboxes.retain(|_, v| !v.hash.is_null()); mailboxes.retain(|_, v| !v.hash.is_null());
conn.send_command(CommandBody::lsub("", "*")?).await?; conn.send_command(CommandBody::lsub("", "*")?).await?;
conn.read_response(&mut res, RequiredResponses::LSUB_REQUIRED) conn.read_response(&mut res, RequiredResponses::LSUB_REQUIRED)
.await?; .await?;
imap_trace!(conn, "LSUB reply: {}", String::from_utf8_lossy(&res)); imap_log!(trace, conn, "LSUB reply: {}", String::from_utf8_lossy(&res));
for l in res.split_rn() { for l in res.split_rn() {
if !l.starts_with(b"*") { if !l.starts_with(b"*") {
continue; continue;
@ -1492,7 +1485,7 @@ impl ImapType {
f.is_subscribed = true; f.is_subscribed = true;
} }
} else { } else {
imap_trace!(conn, "parse error for {:?}", l); imap_log!(trace, conn, "parse error for {:?}", l);
} }
} }
Ok(mailboxes) Ok(mailboxes)
@ -1624,7 +1617,8 @@ struct FetchState {
} }
async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> { async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
imap_trace!( imap_log!(
trace,
state.connection.lock().await, state.connection.lock().await,
"fetch_hlpr mailbox: {:?} stage: {:?}", "fetch_hlpr mailbox: {:?} stage: {:?}",
state.mailbox_hash, state.mailbox_hash,
@ -1686,7 +1680,8 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
} }
Ok(Some(cached_payload)) => { Ok(Some(cached_payload)) => {
state.stage = FetchStage::ResyncCache; state.stage = FetchStage::ResyncCache;
imap_trace!( imap_log!(
trace,
state.connection.lock().await, state.connection.lock().await,
"fetch_hlpr fetch_cached_envs payload {} len for mailbox_hash {}", "fetch_hlpr fetch_cached_envs payload {} len for mailbox_hash {}",
cached_payload.len(), cached_payload.len(),
@ -1758,7 +1753,13 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
conn.examine_mailbox(mailbox_hash, &mut response, false) conn.examine_mailbox(mailbox_hash, &mut response, false)
.await?; .await?;
if max_uid_left > 0 { if max_uid_left > 0 {
imap_trace!(conn, "{} max_uid_left= {}", mailbox_hash, max_uid_left); imap_log!(
trace,
conn,
"{} max_uid_left= {}",
mailbox_hash,
max_uid_left
);
let sequence_set = if max_uid_left == 1 { let sequence_set = if max_uid_left == 1 {
SequenceSet::from(ONE) SequenceSet::from(ONE)
} else { } else {
@ -1782,7 +1783,8 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
) )
})?; })?;
let (_, mut v, _) = protocol_parser::fetch_responses(&response)?; let (_, mut v, _) = protocol_parser::fetch_responses(&response)?;
imap_trace!( imap_log!(
trace,
conn, conn,
"fetch response is {} bytes and {} lines and has {} parsed Envelopes", "fetch response is {} bytes and {} lines and has {} parsed Envelopes",
response.len(), response.len(),
@ -1799,7 +1801,8 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
} in v.iter_mut() } in v.iter_mut()
{ {
if uid.is_none() || envelope.is_none() || flags.is_none() { if uid.is_none() || envelope.is_none() || flags.is_none() {
imap_trace!( imap_log!(
trace,
conn, conn,
"BUG? something in fetch is none. UID: {:?}, envelope: {:?} \ "BUG? something in fetch is none. UID: {:?}, envelope: {:?} \
flags: {:?}", flags: {:?}",
@ -1807,7 +1810,8 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
envelope, envelope,
flags flags
); );
imap_trace!( imap_log!(
trace,
conn, conn,
"response was: {}", "response was: {}",
String::from_utf8_lossy(&response) String::from_utf8_lossy(&response)
@ -1861,7 +1865,7 @@ async fn fetch_hlpr(state: &mut FetchState) -> Result<Vec<Envelope>> {
let uid = uid.unwrap(); let uid = uid.unwrap();
let env = envelope.unwrap(); let env = envelope.unwrap();
/* /*
imap_trace!( imap_log!(trace,
"env hash {} {} UID = {} MSN = {}", "env hash {} {} UID = {} MSN = {}",
env.hash(), env.hash(),
env.subject(), env.subject(),

@ -46,7 +46,7 @@ impl ImapConnection {
($mailbox_hash: expr, $($result:expr $(,)*)+) => { ($mailbox_hash: expr, $($result:expr $(,)*)+) => {
$(if let Err(err) = $result { $(if let Err(err) = $result {
self.uid_store.is_online.lock().unwrap().1 = Err(err.clone()); self.uid_store.is_online.lock().unwrap().1 = Err(err.clone());
imap_trace!(self, "failure: {}", err.to_string()); imap_log!(trace, self, "failure: {}", err.to_string());
log::debug!("failure: {}", err.to_string()); log::debug!("failure: {}", err.to_string());
self.add_refresh_event(RefreshEvent { self.add_refresh_event(RefreshEvent {
account_hash: self.uid_store.account_hash, account_hash: self.uid_store.account_hash,
@ -176,7 +176,7 @@ impl ImapConnection {
.entry(mailbox_hash) .entry(mailbox_hash)
.or_default() .or_default()
.remove(TryInto::<usize>::try_into(n).unwrap().saturating_sub(1)); .remove(TryInto::<usize>::try_into(n).unwrap().saturating_sub(1));
imap_trace!(self, "expunge {}, UID = {}", n, deleted_uid); imap_log!(trace, self, "expunge {}, UID = {}", n, deleted_uid);
let deleted_hash: crate::email::EnvelopeHash = match self let deleted_hash: crate::email::EnvelopeHash = match self
.uid_store .uid_store
.uid_index .uid_index
@ -224,7 +224,7 @@ impl ImapConnection {
} }
} }
UntaggedResponse::Exists(n) => { UntaggedResponse::Exists(n) => {
imap_trace!(self, "exists {}", n); imap_log!(trace, self, "exists {}", n);
try_fail!( try_fail!(
mailbox_hash, mailbox_hash,
self.send_command(CommandBody::fetch(n, common_attributes(), false)?).await self.send_command(CommandBody::fetch(n, common_attributes(), false)?).await
@ -233,7 +233,8 @@ impl ImapConnection {
let mut v = match super::protocol_parser::fetch_responses(&response) { let mut v = match super::protocol_parser::fetch_responses(&response) {
Ok((_, v, _)) => v, Ok((_, v, _)) => v,
Err(err) => { Err(err) => {
imap_trace!( imap_log!(
trace,
self, self,
"Error when parsing FETCH response after untagged exists {:?}", "Error when parsing FETCH response after untagged exists {:?}",
err err
@ -241,7 +242,7 @@ impl ImapConnection {
return Ok(true); return Ok(true);
} }
}; };
imap_trace!(self, "responses len is {}", v.len()); imap_log!(trace, self, "responses len is {}", v.len());
for FetchResponse { for FetchResponse {
ref uid, ref uid,
ref mut envelope, ref mut envelope,
@ -297,7 +298,8 @@ impl ImapConnection {
.lock() .lock()
.unwrap() .unwrap()
.insert((mailbox_hash, uid), env.hash()); .insert((mailbox_hash, uid), env.hash());
imap_trace!( imap_log!(
trace,
self, self,
"Create event {} {} {}", "Create event {} {} {}",
env.hash(), env.hash(),
@ -343,7 +345,7 @@ impl ImapConnection {
.map_err(Error::from) .map_err(Error::from)
{ {
Ok(&[]) => { Ok(&[]) => {
imap_trace!(self, "UID SEARCH RECENT returned no results"); imap_log!(trace, self, "UID SEARCH RECENT returned no results");
} }
Ok(v) => { Ok(v) => {
let command = { let command = {
@ -377,7 +379,7 @@ impl ImapConnection {
return Ok(true); return Ok(true);
} }
}; };
imap_trace!(self, "responses len is {}", v.len()); imap_log!(trace, self, "responses len is {}", v.len());
for FetchResponse { for FetchResponse {
ref uid, ref uid,
ref mut envelope, ref mut envelope,

Loading…
Cancel
Save