[Tkabber-dev] r203 - trunk/plugins/bldjid

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Apr 7 03:35:02 MSD 2009


Author: bigote
Date: 2009-04-07 03:35:01 +0400 (Tue, 07 Apr 2009)
New Revision: 203

Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/README
   trunk/plugins/bldjid/bldjid.tcl
Log:
Some fixes in log length limit processing.
Thanks to Konstantin Khomoutov <xmpp:kostix at 007spb.ru>


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2009-04-06 22:00:39 UTC (rev 202)
+++ trunk/plugins/bldjid/ChangeLog	2009-04-06 23:35:01 UTC (rev 203)
@@ -1,3 +1,13 @@
+2009-04-07  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
+--- Version 0.5.8 of the plugin.
+--- Files modified:
+    bldjid.tcl, README, ChangeLog.
+
+--- Changes:
+	Some fixes in log length limit processing.
+	Thanks to Konstantin Khomoutov <xmpp:kostix at 007spb.ru>
+
 2009-04-06  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
 --- Version 0.5.7 of the plugin.

Modified: trunk/plugins/bldjid/README
===================================================================
--- trunk/plugins/bldjid/README	2009-04-06 22:00:39 UTC (rev 202)
+++ trunk/plugins/bldjid/README	2009-04-06 23:35:01 UTC (rev 203)
@@ -111,15 +111,16 @@
 	Custom field separator for /visit* commands. Default value is "||".
 
 --- ::plugins::bldjid::options(log_length)
-	Sets log length limit for each room. Default value is empty string
-	that means no limit. If you want to enable log limiting enter some value
-	(1000 should be enough for logging during several days in a highly populated
-	room with Minimum verbosity level enabled). If you plan logging with Maximum
+	Sets log length limit for each room. Default value is 0 that means no limit.
+	If you want to enable log limiting enter some value (1000 should be enough
+	for logging during several days in a highly populated room
+	with Minimum verbosity level enabled). If you plan logging with Maximum
 	verbosity level you might probably want to set a bigger value.
 	If you change this setting to a smaller value after some time of use,
 	logs which length is higher than a new value will be trimmed down
-	losing the oldest records (after a new user enters the affected room).
-	Please note that any non-integer value is considered an empty string.
+	losing the oldest records (after a new user enters the affected room,
+	which triggers adding a new element to log).
+	Please note that any non-integer or negative value is considered as 0.
 
 ================
 ####  MISC  ####

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2009-04-06 22:00:39 UTC (rev 202)
+++ trunk/plugins/bldjid/bldjid.tcl	2009-04-06 23:35:01 UTC (rev 203)
@@ -1,4 +1,4 @@
-# "Bldjid" plugin for Tkabber. 2009-04-06 v. 0.5.7
+# "Bldjid" plugin for Tkabber. 2009-04-07 v. 0.5.8
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # See README file for usage.
 
@@ -56,7 +56,7 @@
 			-type string -group Bldjid
 
 
-		custom::defvar options(log_length) "" \
+		custom::defvar options(log_length) 0 \
 			[::msgcat::mc "Max length of your JID list for each room. \
 			Empty field means unlimited. See README for details."] \
 			-type integer -group Bldjid
@@ -115,11 +115,12 @@
 				}
 			} else {
 				if {$options(log_length) != "" \
-				&& [string is integer $options(log_length)] \
+				&& [[namespace current]::is_any_integer $options(log_length)] \
+				&& $options(log_length) > 0 \
 				&& [info exists jids_by_chats($group)]\
 				&& [llength $jids_by_chats($group)] >= $options(log_length)} {
 					set jids_by_chats($group) [lrange $jids_by_chats($group) \
-					[expr [llength $jids_by_chats($group)] \
+					[expr {[llength $jids_by_chats($group)]} \
 					- $options(log_length) + 1 ] end]
 				}
 				lappend jids_by_chats($group) [list $ts $nick $real_jid]
@@ -639,3 +640,8 @@
 		}
 	}
 }
+
+# Thanks to Konstantin Khomoutov (kostix at 007spb.ru)
+proc bldjid::is_any_integer a {
+	regexp \\d+ [string trim $a]
+}



More information about the Tkabber-dev mailing list