[Tkabber-dev] r1948 - in trunk/tkabber: . plugins/chat

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Oct 29 02:49:20 MSD 2010


Author: kostix
Date: 2010-10-29 02:49:20 +0400 (Fri, 29 Oct 2010)
New Revision: 1948

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/chat/histool.tcl
Log:
When scanning log file hierarchy, skip year and month directories
with invalid names.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2010-10-25 16:10:54 UTC (rev 1947)
+++ trunk/tkabber/ChangeLog	2010-10-28 22:49:20 UTC (rev 1948)
@@ -1,3 +1,10 @@
+2010-10-29  Konstantin Khomoutov  <flatworm at users.sourceforge.net>
+
+	* plugins/chat/histool.tcl: When scanning log file hierarchy,
+	  skip year and month directories with invalid names.
+	  This prevents problems when such a name is later attempted
+	  to be interpreted according to its meaning.
+
 2010-10-25  Sergei Golovan  <sgolovan at nes.ru>
 
 	* iq.tcl: Added client_iq_hook for all incoming IQ stanzas.

Modified: trunk/tkabber/plugins/chat/histool.tcl
===================================================================
--- trunk/tkabber/plugins/chat/histool.tcl	2010-10-25 16:10:54 UTC (rev 1947)
+++ trunk/tkabber/plugins/chat/histool.tcl	2010-10-28 22:49:20 UTC (rev 1948)
@@ -662,16 +662,18 @@
 
     set LA {}
     foreach dyear [glob -nocomplain -type d -directory $options(logdir) *] {
+	set year [file tail $dyear]
+	if {![regexp {^\d{4}$} $year]} continue
 	set LB {}
 	foreach dmonth [glob -nocomplain -type d -directory $dyear *] {
+	    set month [file tail $dmonth]
+	    if {![regexp {^0[1-9]$|^1[1-2]$} $month]} continue
 	    set LC {}
 	    foreach file [glob -nocomplain -type f -directory $dmonth *] {
 		lappend LC [::logger::filename_to_jid [file tail $file]]
 	    }
-	    set month [lindex [file split $dmonth] end]
 	    lappend LB [list $month $LC]
 	}
-	set year [lindex [file split $dyear] end]
 	lappend LA [list $year $LB]
     }
 



More information about the Tkabber-dev mailing list