Browse Source

melib/imap: don't print raw bytes in debug prints

jmap-eventsource
Manos Pitsidianakis 2 years ago
parent
commit
9bafba3905
Signed by untrusted user: epilys GPG Key ID: 73627C2F690DF710
  1. 19
      melib/src/backends/imap/connection.rs
  2. 5
      melib/src/backends/imap/protocol_parser.rs

19
melib/src/backends/imap/connection.rs

@ -425,7 +425,7 @@ impl ImapStream {
if !termination_string.is_empty()
&& ret[last_line_idx..].starts_with(termination_string)
{
debug!(&ret[last_line_idx..]);
debug!(String::from_utf8_lossy(&ret[last_line_idx..]));
if !keep_termination_string {
ret.splice(last_line_idx.., std::iter::empty::<u8>());
}
@ -562,7 +562,7 @@ impl ImapConnection {
} else {
debug!(
"connect(): connection is probably alive, NOOP returned {:?}",
&ret
&String::from_utf8_lossy(&ret)
);
return Ok(());
}
@ -675,12 +675,17 @@ impl ImapConnection {
{
debug!(
"Received expected NO response: {:?} {:?}",
response_code, response
response_code,
String::from_utf8_lossy(&response)
);
}
ImapResponse::No(ref response_code) => {
//FIXME return error
debug!("Received NO response: {:?} {:?}", response_code, response);
debug!(
"Received NO response: {:?} {:?}",
response_code,
String::from_utf8_lossy(&response)
);
(self.uid_store.event_consumer)(
self.uid_store.account_hash,
crate::backends::BackendEvent::Notice {
@ -694,7 +699,11 @@ impl ImapConnection {
}
ImapResponse::Bad(ref response_code) => {
//FIXME return error
debug!("Received BAD response: {:?} {:?}", response_code, response);
debug!(
"Received BAD response: {:?} {:?}",
response_code,
String::from_utf8_lossy(&response)
);
(self.uid_store.event_consumer)(
self.uid_store.account_hash,
crate::backends::BackendEvent::Notice {

5
melib/src/backends/imap/protocol_parser.rs

@ -829,7 +829,10 @@ pub fn untagged_responses(input: &[u8]) -> ImapParseResult<Option<UntaggedRespon
let (input, _tag) =
take_until::<_, &[u8], (&[u8], nom::error::ErrorKind)>(&b"\r\n"[..])(input)?;
let (input, _) = tag::<_, &[u8], (&[u8], nom::error::ErrorKind)>(b"\r\n")(input)?;
debug!("Parse untagged response from {:?}", orig_input);
debug!(
"Parse untagged response from {:?}",
String::from_utf8_lossy(&orig_input)
);
Ok((
input,
{

Loading…
Cancel
Save