Set some defaults for missing config options
patch 564fe5aa95af90b3fb9e3d522c114fecd249b914
Author: Enrique D. Bosch <presidev@AT@gmail.com>
Date: Fri Aug 31 00:48:30 CEST 2018
* Set some defaults for missing config options
diff -rN -u old-idlebiff/idlebiff new-idlebiff/idlebiff
--- old-idlebiff/idlebiff 2024-11-22 16:24:01.296539895 +0100
+++ new-idlebiff/idlebiff 2024-11-22 16:24:01.300539888 +0100
@@ -30,6 +30,13 @@
proc or args { foreach x $args { if { $x } { return 1 } }; return 0 }
proc and args { foreach x $args { if { $x } continue { return 0 } }; return 1 }
+proc check_conf_and_set_default { opt default } \
+{
+ variable ::shared::conf
+
+ if {![ info exists conf($opt) ]} { set conf($opt) $default }
+}
+
namespace eval static \
{
variable tag 1
@@ -53,7 +60,6 @@
variable search
variable rexp_chk
variable rexpsearch
- variable criteria
variable sock
variable conf
array set conf {}
@@ -181,12 +187,15 @@
proc set_params {} \
{
- variable ::shared::conf
- variable ::shared::criteria
variable ::shared::rexp_chk
- if {[ info exists conf(criteria) ]} { if {[ ne $conf(criteria) {} ]} { set criteria $conf(criteria) } } \
- else { set criteria UNSEEN }
+ check_conf_and_set_default criteria UNSEEN
+ check_conf_and_set_default nodecor 1
+ check_conf_and_set_default tip 0
+ check_conf_and_set_default tls 0
+ check_conf_and_set_default tls_validate_cert 1
+ check_conf_and_set_default initial_noop 0
+ check_conf_and_set_default imap_trace 0
set rexp_chk {(?: |\[)capability }
}
@@ -195,16 +204,16 @@
variable ::shared::cap
variable ::shared::search
variable ::shared::rexpsearch
- variable ::shared::criteria
+ variable ::shared::conf
if { $cap(esearch) } \
{
- set search "SEARCH RETURN (COUNT) $criteria"
+ set search "SEARCH RETURN (COUNT) $conf(criteria)"
set rexpsearch {^\* esearch \(tag [^)]*\) count (.*)$}
} \
else \
{
- set search "SEARCH $criteria"
+ set search "SEARCH $conf(criteria)"
set rexpsearch {^\* search((?: .*|$))}
}
}
@@ -597,7 +606,7 @@
-command tls_cb"
} \
else { set sock socket }
-}
+}
proc init {} \
{