Use SEARCH command instead of STATUS for UNSEEN query as it's more efficient and correct according to RFC-3501
patch ff24551724e04c3827a8d24ee5495dd643bc65ee
Author: Enrique D. Bosch <presidev@AT@gmail.com>
Date: Mon May 30 20:53:02 CEST 2016
* Use SEARCH command instead of STATUS for UNSEEN query as it's more efficient and correct according to RFC-3501
diff -rN -u old-idlebiff/idlebiff new-idlebiff/idlebiff
--- old-idlebiff/idlebiff 2024-11-22 15:50:04.959814987 +0100
+++ new-idlebiff/idlebiff 2024-11-22 15:50:04.959814987 +0100
@@ -300,9 +300,7 @@
proc ask_unseen { con } \
{
- variable ::shared::conf
-
- imap_command_tagged $con "STATUS $conf(mailbox) (UNSEEN)"
+ imap_command_tagged $con "SEARCH UNSEEN"
}
proc check_cap_logindis { linea } \
@@ -328,12 +326,7 @@
after cancel $ka
set idle 0
exit_idle $con
- if $check \
- {
- exit_mailbox $con
- ask_unseen $con
- enter_mailbox $con
- }
+ if $check { ask_unseen $con }
enter_idle $con
set ka [ after ${conf(keepalive)}000 { idle_cycle $con 0 } ]
}
@@ -344,8 +337,8 @@
variable ::shared::ka
fileevent $con readable { parse_idle_check $con }
- ask_unseen $con
enter_mailbox $con
+ ask_unseen $con
enter_idle $con
set ka [ after ${conf(keepalive)}000 { idle_cycle $con 0 } ]
}
@@ -418,9 +411,9 @@
variable ::shared::img_down
variable ::shared::new_messages
- append statusexp {^\*\s+status\s+} {"*} $conf(mailbox) {"*} {\s+\(unseen\s+(\d+)\).*$}
- if [ regexp -lineanchor -nocase $statusexp $linea -> new_messages ] \
+ if [ regexp -lineanchor -nocase {^\*\s+search\s+(.*)$} $linea -> msg_list ] \
{
+ set new_messages [ llength $msg_list ]
if { $new_messages > 0 } \
{ set current $img_up } \
else { set current $img_down }