patch 83b5d85caf2a4557ec715816e73d43b4a9b8ac06 Author: Enrique D. Bosch Date: Wed Nov 16 21:33:45 CET 2016 * Add config option "criteria" for IMAP SEARCH criteria (UNSEEN by default) diff -rN -u old-idlebiff/.idlebiffrc new-idlebiff/.idlebiffrc --- old-idlebiff/.idlebiffrc 2024-11-22 21:32:00.411228130 +0100 +++ new-idlebiff/.idlebiffrc 2024-11-22 21:32:00.411228130 +0100 @@ -19,6 +19,7 @@ pos_y=1 tip=1 nodecor=1 +criteria= tls_validate_cert=1 tls_ca_dir= tls_ca_file= diff -rN -u old-idlebiff/idlebiff new-idlebiff/idlebiff --- old-idlebiff/idlebiff 2024-11-22 21:32:00.411228130 +0100 +++ new-idlebiff/idlebiff 2024-11-22 21:32:00.419228118 +0100 @@ -43,6 +43,7 @@ logindisabled 0 esearch 0 } + variable criteria variable msgs 0 variable sock variable conf @@ -169,6 +170,15 @@ } } +proc set_params { } \ +{ + variable ::shared::conf + variable ::shared::criteria + + if { [ info exists conf(criteria) ] && $conf(criteria)!="" } { set criteria $conf(criteria) } \ + else { set criteria UNSEEN } +} + proc set_timeout { } \ { variable ::shared::conf @@ -310,12 +320,13 @@ imap_command_tagged $con CLOSE } -proc ask_unseen con \ +proc do_search con \ { variable ::shared::cap + variable ::shared::criteria - if $cap(esearch) { imap_command_tagged $con "SEARCH RETURN (COUNT) UNSEEN" } \ - else { imap_command_tagged $con "SEARCH UNSEEN" } + if $cap(esearch) { imap_command_tagged $con "SEARCH RETURN (COUNT) $criteria" } \ + else { imap_command_tagged $con "SEARCH $criteria" } } proc check_cap { linea capname } \ @@ -338,7 +349,7 @@ after cancel $ka set idle 0 exit_idle $con - if $check { ask_unseen $con } + if $check { do_search $con } enter_idle $con set ka [ after ${conf(keepalive)}000 { idle_cycle $con 0 } ] } @@ -350,7 +361,7 @@ fileevent $con readable { parse_idle_check $con } enter_mailbox $con - ask_unseen $con + do_search $con enter_idle $con set ka [ after ${conf(keepalive)}000 { idle_cycle $con 0 } ] } @@ -414,10 +425,10 @@ set prim [ string range $linea 0 0 ] if { $prim eq "+" } { set idle 1 } \ elseif { $idle == 1 } { idle_cycle $con 1 } \ - else { parse_unseen $linea } + else { parse_search $con $linea } } -proc parse_unseen linea \ +proc parse_search { con linea } \ { variable ::shared::conf variable ::shared::img_up @@ -526,6 +537,7 @@ } read_conf +set_params icon init_tls init