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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Apr 7 02:00:40 MSD 2009


Author: bigote
Date: 2009-04-07 02:00:39 +0400 (Tue, 07 Apr 2009)
New Revision: 202

Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/README
   trunk/plugins/bldjid/TODO
   trunk/plugins/bldjid/bldjid.tcl
Log:
Added log length limit option (unlimited by default).


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2009-04-06 20:03:27 UTC (rev 201)
+++ trunk/plugins/bldjid/ChangeLog	2009-04-06 22:00:39 UTC (rev 202)
@@ -1,5 +1,14 @@
 2009-04-06  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
+--- Version 0.5.7 of the plugin.
+--- Files modified:
+    bldjid.tcl, README, TODO, ChangeLog.
+
+--- Changes:
+	Added log length limit option (unlimited by default).
+
+2009-04-06  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
 --- Version 0.5.6 of the plugin.
 --- Files modified:
     bldjid.tcl, README, TODO, ChangeLog.

Modified: trunk/plugins/bldjid/README
===================================================================
--- trunk/plugins/bldjid/README	2009-04-06 20:03:27 UTC (rev 201)
+++ trunk/plugins/bldjid/README	2009-04-06 22:00:39 UTC (rev 202)
@@ -76,7 +76,6 @@
 
 There are Customize options for this plugin at
 Tkabber -> Customize -> Plugins -> Bldjid
-At the moment only few of them are enabled, which are the following:
 
 --- ::plugins::bldjid::options(enabled)
 	Turns on JIDs gathering.
@@ -111,6 +110,17 @@
 --- ::plugins::bldjid::options(custom_separator)
 	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
+	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.
+
 ================
 ####  MISC  ####
 ================

Modified: trunk/plugins/bldjid/TODO
===================================================================
--- trunk/plugins/bldjid/TODO	2009-04-06 20:03:27 UTC (rev 201)
+++ trunk/plugins/bldjid/TODO	2009-04-06 22:00:39 UTC (rev 202)
@@ -1,10 +1,3 @@
-=== Plugin should be tested, new Customize options should be uncommented
-	and implemented, as the following:
---- options(log_length) means limit for the list for /visitors and /visited commands.
-    How much? I have about 12 rooms and a couple of them are quite populated.
-    So the list grows some 700 records a day. I think 3000 by default would be OK.
-	However, this parameter will be customizable.
-
 === Add autocompletion for JIDs when using /bldjid-like commands
 	after user list publishing. (Now Tkabber tries to insert present nicks).
 

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2009-04-06 20:03:27 UTC (rev 201)
+++ trunk/plugins/bldjid/bldjid.tcl	2009-04-06 22:00:39 UTC (rev 202)
@@ -1,4 +1,4 @@
-# "Bldjid" plugin for Tkabber. 2009-04-06 v. 0.5.5
+# "Bldjid" plugin for Tkabber. 2009-04-06 v. 0.5.7
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # See README file for usage.
 
@@ -56,9 +56,10 @@
 			-type string -group Bldjid
 
 
-#    custom::defvar options(log_length) 3000 \
-#        [::msgcat::mc "Max length of your JID list. Empty field means unlimited."] \
-#        -type integer -group Bldjid
+		custom::defvar options(log_length) "" \
+			[::msgcat::mc "Max length of your JID list for each room. \
+			Empty field means unlimited. See README for details."] \
+			-type integer -group Bldjid
 
 }
 
@@ -110,9 +111,17 @@
 			if {0 && $options(filter_admin_rooms)} {
 				set iam [lindex [whoami $xlib $group] 1]
 				if {($iam == "admin" || $iam == "owner")} {
-					lappend jids_by_chats($group) [list $ts $nick $real_jid]
+						lappend jids_by_chats($group) [list $ts $nick $real_jid]
 				}
 			} else {
+				if {$options(log_length) != "" \
+				&& [string is integer $options(log_length)] \
+				&& [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)] \
+					- $options(log_length) + 1 ] end]
+				}
 				lappend jids_by_chats($group) [list $ts $nick $real_jid]
 			}
 			if {$options(send_chat_messages) && $options(verbosity_level) == "min"} {



More information about the Tkabber-dev mailing list