melib/ui: small fixes

- melib/imap: accept quoted strings with escaped quotes in
protocol_parser
- ui/accounts: return unavailabity correctly if folder's worker slot is
empty instead of judging only by its vacancy
- ui/MailView: set view as not dirty if envelope loading from backend
fails so that it stops requesting it in every subsequent redraw
async
Manos Pitsidianakis 2019-12-11 00:17:11 +02:00
parent 6f76cd9acc
commit f05a4205f7
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
3 changed files with 14 additions and 3 deletions

View File

@ -815,8 +815,7 @@ pub fn quoted(input: &[u8]) -> IResult<&[u8], Vec<u8>> {
let mut i = 1;
while i < input.len() {
if input[i] == b'\"' {
//&& input[i - 1] != b'\\' {
if input[i] == b'\"' && (i == 0 || (input[i - 1] != b'\\')) {
return match crate::email::parser::phrase(&input[1..i]) {
IResult::Done(_, out) => IResult::Done(&input[i + 1..], out),
e => e,

View File

@ -513,6 +513,11 @@ impl Component for MailView {
match envelope.body(op) {
Ok(body) => body,
Err(e) => {
self.dirty = false;
clear_area(grid, (set_y(upper_left, y), bottom_right));
context
.dirty_areas
.push_back((set_y(upper_left, y), bottom_right));
context.replies.push_back(UIEvent::Notification(
Some("Failed to open e-mail".to_string()),
e.to_string(),

View File

@ -827,7 +827,14 @@ impl Account {
pub fn status(&mut self, folder_hash: FolderHash) -> result::Result<(), usize> {
match self.workers.get_mut(&folder_hash).unwrap() {
None => {
return Ok(());
return if self.folders[&folder_hash].is_available()
|| (self.folders[&folder_hash].is_parsing()
&& self.collection.threads.contains_key(&folder_hash))
{
Ok(())
} else {
Err(0)
};
}
Some(ref mut w) => match w.poll() {
Ok(AsyncStatus::NoUpdate) => {