patch b0cebeb0d05720d8b145fc479b09238a463a26cf
Author: Enrique D. Bosch <presidev@AT@gmail.com>
Date: Sat Jun 4 17:05:02 CEST 2016
* Improve capabilities parse routine
hunk ./idlebiff 34
- variable idlecap 0
- variable logindiscap 0
- variable esearchcap 0
+ array set cap \
+ {
+ idle 0
+ logindisabled 0
+ esearch 0
+ }
hunk ./idlebiff 254
- variable ::shared::logindiscap
-
- if $logindiscap { error logindisabled }
+ variable ::shared::cap
+
+ if $cap(logindisabled) { error logindisabled }
hunk ./idlebiff 307
- variable ::shared::esearchcap
-
- if $esearchcap { imap_command_tagged $con "SEARCH RETURN (COUNT) UNSEEN" } \
- else { imap_command_tagged $con "SEARCH UNSEEN" }
+ variable ::shared::cap
+
+ if $cap(esearch) { imap_command_tagged $con "SEARCH RETURN (COUNT) UNSEEN" } \
+ else { imap_command_tagged $con "SEARCH UNSEEN" }
hunk ./idlebiff 313
-proc check_cap_logindis { linea } \
+proc check_cap { linea capname } \
hunk ./idlebiff 315
- variable ::shared::logindiscap
-
- if !$logindiscap { set logindiscap [ regexp -nocase -lineanchor {.*capability .*logindisabled(?: .*|].*|$)} $linea ] }
+ variable ::shared::cap
+
+ if !$cap($capname) \
+ {
+ set rexp ".*capability .*${capname}(?: .*|].*|$)"
+ set cap($capname) [ regexp -nocase -lineanchor $rexp $linea ]
+ }
hunk ./idlebiff 324
-proc check_cap_idle { linea } \
-{
- variable ::shared::idlecap
-
- if !$idlecap { set idlecap [ regexp -nocase -lineanchor {.*capability .*idle(?: .*|].*|$)} $linea ] }
-}
-
-proc check_cap_esearch { linea } \
-{
- variable ::shared::esearchcap
-
- if !$esearchcap { set esearchcap [ regexp -nocase -lineanchor {.*capability .*esearch(?: .*|].*|$)} $linea ] }
-}
-
hunk ./idlebiff 353
- check_cap_logindis $linea
+ check_cap $linea logindisabled
hunk ./idlebiff 359
-
hunk ./idlebiff 360
- check_cap_logindis $linea
+ check_cap $linea logindisabled
hunk ./idlebiff 370
- variable ::shared::idlecap
+ variable ::shared::cap
hunk ./idlebiff 373
- check_cap_idle $linea
- check_cap_esearch $linea
+ check_cap $linea idle
+ check_cap $linea esearch
hunk ./idlebiff 377
- if $idlecap { init_idle $con } \
+ if $cap(idle) { init_idle $con } \
hunk ./idlebiff 389
- variable ::shared::idlecap
+ variable ::shared::cap
hunk ./idlebiff 392
- check_cap_idle $linea
- check_cap_esearch $linea
+ check_cap $linea idle
+ check_cap $linea esearch
hunk ./idlebiff 396
- if $idlecap { init_idle $con } \
+ if $cap(idle) { init_idle $con } \
hunk ./idlebiff 418
- variable ::shared::esearchcap
-
- if $esearchcap { set rexpr {^\*\s+esearch\s+\(tag\s*[^)]*\)\s+count\s+(.*)$} } \
- else { set rexpr {^\*\s+search\s+(.*)$} }
+ variable ::shared::cap
+
+ if $cap(esearch) { set rexpr {^\*\s+esearch\s+\(tag\s*[^)]*\)\s+count\s+(.*)$} } \
+ else { set rexpr {^\*\s+search\s+(.*)$} }
hunk ./idlebiff 424
- if !$esearchcap { set res [ llength $res ] }
+ if !$cap(esearch) { set res [ llength $res ] }