Fix some warnings
parent
c2da09de99
commit
56cda63c83
|
@ -375,18 +375,24 @@ impl From<ImapConnection> for ImapBlockingConnection {
|
|||
fn from(mut conn: ImapConnection) -> Self {
|
||||
conn.set_nonblocking(false)
|
||||
.expect("set_nonblocking call failed");
|
||||
conn.stream.as_mut().map(|s| {
|
||||
s.stream
|
||||
.get_mut()
|
||||
.set_write_timeout(Some(std::time::Duration::new(5 * 60, 0)))
|
||||
.expect("set_write_timeout call failed")
|
||||
});
|
||||
conn.stream.as_mut().map(|s| {
|
||||
s.stream
|
||||
.get_mut()
|
||||
.set_read_timeout(Some(std::time::Duration::new(5 * 60, 0)))
|
||||
.expect("set_read_timeout call failed")
|
||||
});
|
||||
conn.stream
|
||||
.as_mut()
|
||||
.map(|s| {
|
||||
s.stream
|
||||
.get_mut()
|
||||
.set_write_timeout(Some(std::time::Duration::new(5 * 60, 0)))
|
||||
.expect("set_write_timeout call failed")
|
||||
})
|
||||
.expect("set_write_timeout call failed");
|
||||
conn.stream
|
||||
.as_mut()
|
||||
.map(|s| {
|
||||
s.stream
|
||||
.get_mut()
|
||||
.set_read_timeout(Some(std::time::Duration::new(5 * 60, 0)))
|
||||
.expect("set_read_timeout call failed")
|
||||
})
|
||||
.expect("set_read_timeout call failed");
|
||||
ImapBlockingConnection {
|
||||
buf: [0; 1024],
|
||||
conn,
|
||||
|
|
|
@ -86,7 +86,6 @@ pub fn poll_with_examine(kit: ImapWatchKit) -> Result<()> {
|
|||
main_conn.send_command(b"NOOP").unwrap();
|
||||
main_conn.read_response(&mut response).unwrap();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn idle(kit: ImapWatchKit) -> Result<()> {
|
||||
|
@ -208,7 +207,7 @@ pub fn idle(kit: ImapWatchKit) -> Result<()> {
|
|||
if now.duration_since(watch) >= _5_mins {
|
||||
/* Time to poll all inboxes */
|
||||
let mut conn = main_conn.lock().unwrap();
|
||||
for (hash, folder) in folders.lock().unwrap().iter() {
|
||||
for folder in folders.lock().unwrap().values() {
|
||||
work_context
|
||||
.set_status
|
||||
.send((
|
||||
|
@ -216,7 +215,13 @@ pub fn idle(kit: ImapWatchKit) -> Result<()> {
|
|||
format!("examining `{}` for updates...", folder.path()),
|
||||
))
|
||||
.unwrap();
|
||||
examine_updates(folder, &sender, &mut conn, &uid_store, &work_context);
|
||||
exit_on_error!(
|
||||
sender,
|
||||
folder_hash,
|
||||
work_context,
|
||||
thread_id,
|
||||
examine_updates(folder, &sender, &mut conn, &uid_store, &work_context)
|
||||
);
|
||||
}
|
||||
work_context
|
||||
.set_status
|
||||
|
|
|
@ -467,7 +467,7 @@ fn display_addr(input: &[u8]) -> IResult<&[u8], Address> {
|
|||
match phrase(&input[0..end + display_name.length + 3]) {
|
||||
IResult::Error(e) => IResult::Error(e),
|
||||
IResult::Incomplete(i) => IResult::Incomplete(i),
|
||||
IResult::Done(rest, raw) => {
|
||||
IResult::Done(_, raw) => {
|
||||
let display_name_end = raw.find(b"<").unwrap();
|
||||
display_name.length = { raw[0..display_name_end].trim().len() };
|
||||
let address_spec = if display_name_end == 0 {
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use crate::structs::StackVec;
|
||||
|
||||
pub type Result<'a, Output> = std::result::Result<(&'a str, Output), &'a str>;
|
||||
|
||||
pub trait Parser<'a, Output> {
|
||||
|
@ -54,16 +52,6 @@ pub trait Parser<'a, Output> {
|
|||
{
|
||||
BoxedParser::new(and_then(self, f))
|
||||
}
|
||||
|
||||
fn seq<P, NewOutput>(self, p: P) -> BoxedParser<'a, NewOutput>
|
||||
where
|
||||
Self: Sized + 'a,
|
||||
Output: 'a,
|
||||
NewOutput: 'a,
|
||||
P: Parser<'a, NewOutput> + 'a,
|
||||
{
|
||||
BoxedParser::new(seq(self, p))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn left<'a, P1, P2, R1, R2>(parser1: P1, parser2: P2) -> impl Parser<'a, R1>
|
||||
|
@ -321,14 +309,3 @@ where
|
|||
Err(_) => Ok((input, None)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn seq<'a, P1, P2, R1, R2>(parser1: P1, parser2: P2) -> impl Parser<'a, R2>
|
||||
where
|
||||
P1: Parser<'a, R1>,
|
||||
P2: Parser<'a, R2>,
|
||||
{
|
||||
move |input| match parser1.parse(input) {
|
||||
Ok((next_input, result)) => parser2.parse(next_input),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ pub fn query_to_imap(q: &Query) -> String {
|
|||
|
||||
pub fn imap_search(
|
||||
term: &str,
|
||||
(sort_field, sort_order): (SortField, SortOrder),
|
||||
(_sort_field, _sort_order): (SortField, SortOrder),
|
||||
folder_hash: FolderHash,
|
||||
backend: &Arc<RwLock<Box<dyn MailBackend>>>,
|
||||
) -> Result<StackVec<EnvelopeHash>> {
|
||||
|
|
|
@ -522,12 +522,14 @@ impl PlainListing {
|
|||
return;
|
||||
}
|
||||
}
|
||||
let envelopes = context.accounts[self.cursor_pos.0]
|
||||
.collection
|
||||
self.local_collection = context.accounts[self.cursor_pos.0][folder_hash]
|
||||
.unwrap()
|
||||
.envelopes
|
||||
.read()
|
||||
.unwrap();
|
||||
self.local_collection = envelopes.keys().cloned().collect();
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
self.redraw_list(context);
|
||||
|
||||
if self.length > 0 {
|
||||
let env_hash = self.get_env_under_cursor(self.cursor_pos.2, context);
|
||||
let temp = (self.new_cursor_pos.0, self.new_cursor_pos.1, env_hash);
|
||||
|
@ -537,8 +539,6 @@ impl PlainListing {
|
|||
self.view = MailView::new(temp, None, None);
|
||||
}
|
||||
}
|
||||
|
||||
self.redraw_list(context);
|
||||
}
|
||||
|
||||
fn redraw_list(&mut self, context: &Context) {
|
||||
|
@ -765,9 +765,7 @@ impl PlainListing {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_env_under_cursor(&self, cursor: usize, context: &Context) -> EnvelopeHash {
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash();
|
||||
fn get_env_under_cursor(&self, cursor: usize, _context: &Context) -> EnvelopeHash {
|
||||
if self.filter_term.is_empty() {
|
||||
self.local_collection[cursor]
|
||||
} else {
|
||||
|
@ -993,7 +991,9 @@ impl Component for PlainListing {
|
|||
UIEvent::EnvelopeRename(ref old_hash, ref new_hash) => {
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let folder_hash = account[self.cursor_pos.1].unwrap().folder.hash();
|
||||
if !account.collection.contains_key(new_hash) {
|
||||
if !account.collection.contains_key(new_hash)
|
||||
|| !account[folder_hash].unwrap().envelopes.contains(new_hash)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue