patch f60229b708e75d0875fccec0e71aa2867c3872c7
Author: Enrique D. Bosch <presidev@AT@gmail.com>
Date: Sun May 29 11:22:47 CEST 2016
* Extract unseen parse code to a new function
hunk ./idlebiff 346
- fileevent $con readable { parse_idle $con }
+ fileevent $con readable { parse_idle_check $con }
hunk ./idlebiff 403
-proc parse_idle { con } \
+proc parse_idle_check { con } \
hunk ./idlebiff 406
- variable ::shared::msgs
+
+ set linea [ read_line $con ]
+ set prim [ string range $linea 0 0 ]
+ if { $prim eq "+" } { set idle 1 } \
+ elseif { $idle==1 } { idle_cycle $con 1 } \
+ else { parse_unseen $linea }
+}
+
+proc parse_unseen { linea } \
+{
hunk ./idlebiff 421
- set linea [ read_line $con ]
- set prim [ string range $linea 0 0 ]
- if { $prim eq "+" } { set idle 1 } \
- elseif { $idle==1 } { idle_cycle $con 1 } \
- else \
+ append statusexp {^\*\s+status\s+} {"*} $conf(mailbox) {"*} {\s+\(unseen\s+(\d+)\).*$}
+ if [ regexp -lineanchor -nocase $statusexp $linea -> new_messages ] \
hunk ./idlebiff 424
- append statusexp {^\*\s+status\s+} {"*} $conf(mailbox) {"*} {\s+\(unseen\s+(\d+)\).*$}
- if [ regexp -lineanchor -nocase $statusexp $linea -> new_messages ] \
- {
- if { $new_messages > 0 } \
- { set current $img_up } \
- else { set current $img_down }
- update_img $current
- }
- }
+ if { $new_messages > 0 } \
+ { set current $img_up } \
+ else { set current $img_down }
+ update_img $current
+ } [_$_]