imap: small fixes
parent
00acba7717
commit
5a5408ecd5
|
@ -682,6 +682,13 @@ impl MailBackend for ImapType {
|
||||||
|
|
||||||
{
|
{
|
||||||
let mailboxes = uid_store.mailboxes.lock().await;
|
let mailboxes = uid_store.mailboxes.lock().await;
|
||||||
|
|
||||||
|
if mailboxes.values().any(|f| f.path == path) {
|
||||||
|
return Err(MeliError::new(format!(
|
||||||
|
"Mailbox named `{}` already exists.",
|
||||||
|
path,
|
||||||
|
)));
|
||||||
|
}
|
||||||
for root_mailbox in mailboxes.values().filter(|f| f.parent.is_none()) {
|
for root_mailbox in mailboxes.values().filter(|f| f.parent.is_none()) {
|
||||||
if path.starts_with(&root_mailbox.name) {
|
if path.starts_with(&root_mailbox.name) {
|
||||||
debug!("path starts with {:?}", &root_mailbox);
|
debug!("path starts with {:?}", &root_mailbox);
|
||||||
|
@ -693,12 +700,8 @@ impl MailBackend for ImapType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if mailboxes.values().any(|f| f.path == path) {
|
/* FIXME Do not try to CREATE a sub-mailbox in a mailbox that has the \Noinferiors
|
||||||
return Err(MeliError::new(format!(
|
* flag set. */
|
||||||
"Mailbox named `{}` already exists.",
|
|
||||||
path,
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut response = String::with_capacity(8 * 1024);
|
let mut response = String::with_capacity(8 * 1024);
|
||||||
|
@ -1387,7 +1390,6 @@ async fn fetch_hlpr(
|
||||||
permissions.set_flags = !examine_response.read_only;
|
permissions.set_flags = !examine_response.read_only;
|
||||||
permissions.rename_messages = !examine_response.read_only;
|
permissions.rename_messages = !examine_response.read_only;
|
||||||
permissions.delete_messages = !examine_response.read_only;
|
permissions.delete_messages = !examine_response.read_only;
|
||||||
permissions.delete_messages = !examine_response.read_only;
|
|
||||||
mailbox_exists
|
mailbox_exists
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -525,10 +525,12 @@ impl ImapConnection {
|
||||||
ret.push_str(&response);
|
ret.push_str(&response);
|
||||||
}
|
}
|
||||||
ImapResponse::No(ref response_code) => {
|
ImapResponse::No(ref response_code) => {
|
||||||
|
//FIXME return error
|
||||||
debug!("Received NO response: {:?} {:?}", response_code, response);
|
debug!("Received NO response: {:?} {:?}", response_code, response);
|
||||||
ret.push_str(&response);
|
ret.push_str(&response);
|
||||||
}
|
}
|
||||||
ImapResponse::Bad(ref response_code) => {
|
ImapResponse::Bad(ref response_code) => {
|
||||||
|
//FIXME return error
|
||||||
debug!("Received BAD response: {:?} {:?}", response_code, response);
|
debug!("Received BAD response: {:?} {:?}", response_code, response);
|
||||||
ret.push_str(&response);
|
ret.push_str(&response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,6 +539,7 @@ pub fn uid_fetch_response(input: &str) -> ImapParseResult<UidFetchResponse<'_>>
|
||||||
let mut has_attachments = false;
|
let mut has_attachments = false;
|
||||||
while i < input.len() {
|
while i < input.len() {
|
||||||
eat_whitespace!(break);
|
eat_whitespace!(break);
|
||||||
|
bounds!(break);
|
||||||
|
|
||||||
if input[i..].starts_with("UID ") {
|
if input[i..].starts_with("UID ") {
|
||||||
i += "UID ".len();
|
i += "UID ".len();
|
||||||
|
@ -877,12 +878,12 @@ pub enum UntaggedResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn untagged_responses(input: &[u8]) -> IResult<&[u8], Option<UntaggedResponse>> {
|
pub fn untagged_responses(input: &[u8]) -> IResult<&[u8], Option<UntaggedResponse>> {
|
||||||
debug!("Parse untagged response from {:?}", to_str!(input));
|
|
||||||
let (input, _) = tag("* ")(input)?;
|
let (input, _) = tag("* ")(input)?;
|
||||||
let (input, num) = map_res(digit1, |s| usize::from_str(to_str!(s)))(input)?;
|
let (input, num) = map_res(digit1, |s| usize::from_str(to_str!(s)))(input)?;
|
||||||
let (input, _) = tag(" ")(input)?;
|
let (input, _) = tag(" ")(input)?;
|
||||||
let (input, _tag) = take_until("\r\n")(input)?;
|
let (input, _tag) = take_until("\r\n")(input)?;
|
||||||
let (input, _) = tag("\r\n")(input)?;
|
let (input, _) = tag("\r\n")(input)?;
|
||||||
|
debug!("Parse untagged response from {:?}", to_str!(input));
|
||||||
Ok((input, {
|
Ok((input, {
|
||||||
use UntaggedResponse::*;
|
use UntaggedResponse::*;
|
||||||
match _tag {
|
match _tag {
|
||||||
|
|
Loading…
Reference in New Issue