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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Mar 30 07:06:03 MSD 2009


Author: bigote
Date: 2009-03-30 07:06:03 +0400 (Mon, 30 Mar 2009)
New Revision: 187

Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/README
   trunk/plugins/bldjid/TODO
   trunk/plugins/bldjid/bldjid.tcl
Log:
Option options(verbosity_level) has also Maximum level now.
Added tabulated separation between item number and item body
in user list given by /visit*


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2009-03-29 23:34:11 UTC (rev 186)
+++ trunk/plugins/bldjid/ChangeLog	2009-03-30 03:06:03 UTC (rev 187)
@@ -1,3 +1,15 @@
+2009-03-30  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
+--- Version 0.4b1 of the plugin.
+--- Files modified:
+    bldjid.tcl, README, TODO, ChangeLog.
+
+--- Changes:
+	Option options(verbosity_level) now also has Maximum level. 
+	See README for details.
+	Added tabulated separation between item number and item body
+	in user list given by /visit*
+
 2009-03-30	Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
 --- Version 0.4a6 of the plugin.

Modified: trunk/plugins/bldjid/README
===================================================================
--- trunk/plugins/bldjid/README	2009-03-29 23:34:11 UTC (rev 186)
+++ trunk/plugins/bldjid/README	2009-03-30 03:06:03 UTC (rev 187)
@@ -51,7 +51,7 @@
 /visited nick
 room
 
-An enumerated list styled as 'info' will be shown in the current chat window.
+--- An enumerated list styled as 'info' will be shown in the current chat window.
 In order to choose a line from it use commands explained above:
 /banjid ?n?
 reason
@@ -83,10 +83,10 @@
 	Commands /banjid, /bldjid, /unbldjid, /amnesty don't need it, however.
 
 --- ::plugins::bldjid::options(verbosity_level)
-	At the moment only Minimum level is available which means that
-	there will be no repeated JIDs in each room list and no timestamps.
-	Maximum level, when implemented, will mean that every entrance
-	of every user will be logged, with a corresponding timestamp.
+	Minimum level means that there will be no repeated JIDs 
+	in each room list and no timestamps.
+	Maximum level means that every entrance	of every user 
+	will be logged, with a corresponding timestamp.
 
 --- ::plugins::bldjid::options(send_chat_messages)
 	Besides of logging user entrances, chat system messages are published.
@@ -98,7 +98,7 @@
 If ::muc::options(gen_enter_exit_msgs) is enabled again, 
 no new entries are added to the existing list. However, 
 it's still kept alive to be consulted at any time. 
-The option above only affect gathering new entries:
+The option above only affects gathering new entries:
 they are put either to the list or to chat windows.
 
 ================

Modified: trunk/plugins/bldjid/TODO
===================================================================
--- trunk/plugins/bldjid/TODO	2009-03-29 23:34:11 UTC (rev 186)
+++ trunk/plugins/bldjid/TODO	2009-03-30 03:06:03 UTC (rev 187)
@@ -1,17 +1,21 @@
----	Add some 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 5000 would be OK.
-	However, I'd betted add an option into Customize.
-=== There's a parameter named "entered" that is passed to
-	muc::report_available by chat::change_presence. It helped a lot 
-	when I used patched version of muc.tcl. Now this functionality 
-	must be implemented in the plugin itself since the procedure 
-	bldjid::smart_enter_exit_message tries to log every single status change 
-	of every single user which is very annoying. Because of this 
-	only Minimum verbosity level is allowed at the moment.
---- Plugin should be tested, new Customize options should be uncommented
-	and implemented.
+=== Plugin should be tested, new Customize options should be uncommented
+	and implemented, as the following:
+--- options(filter_admin_rooms) is enabled now and it means
+	that you can only log user entrances in the rooms where you have
+	admin privileges. However, one might need to log all available rooms
+	although no JIDs will be available.
+--- 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.
+--- options(separator) will give a possibility to adapt	the look
+	of user list to your feelings. Now the separator is '||'
+	and it is set within plugin's code.
 
----	Add "Bldjid" menu item with all commands to room MUC menu.
+=== Add matching rules for /visit* commands to be able processing
+	not only exact room and nick names.
+
+===	Add "Bldjid" menu item with all commands to room MUC menu.
 	Note that a list of rooms must be done for these commands to work.
----	Add "Antiflood & Autokick" functionality.
+
+===	Add "Antiflood & Autokick" functionality.

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2009-03-29 23:34:11 UTC (rev 186)
+++ trunk/plugins/bldjid/bldjid.tcl	2009-03-30 03:06:03 UTC (rev 187)
@@ -1,4 +1,4 @@
-# "Bldjid" plugin for Tkabber. 2009-03-30 v. 0.4a6
+# "Bldjid" plugin for Tkabber. 2009-03-30 v. 0.4b1
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # See README file for usage.
 
@@ -18,9 +18,9 @@
 		set verbosity [list \
 		min [::msgcat::mc "Minimum:\
 		Log each entrance of a user\
-		only once per room (less memory used)."]]
-#					max [::msgcat::mc "Maximum: Also log timestamps\
-#                    (all entrances of each user will be logged)."]]
+		only once per room (less memory used)."]\
+		max [::msgcat::mc "Maximum: Also log timestamps\
+		(all entrances of each user will be logged)."]]
 
 		custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber
 
@@ -55,14 +55,22 @@
 ## and Rakhmanin Ruslan <rakhmaninr at gmail.com>
 ## Adapted to bldjid's necessities by Serge Yudin
 proc bldjid::smart_enter_exit_message {xlib jid type x args} {
+	global grouproster
 	variable options
-		if {!($options(enabled) && !$::muc::options(gen_enter_exit_msgs))} {
-			return stop
+	puts $jid
+	if {!($options(enabled) && !$::muc::options(gen_enter_exit_msgs))} {
+		return stop
+	}
+	set group [::xmpp::jid::stripResource $jid]
+	set chatid [::chat::chatid $xlib $group]
+	if {[chat::is_groupchat $chatid]} {
+		set user_already_here [lcontain $grouproster(users,$chatid) $jid]
+		if {$type != "available" || $user_already_here} {
+			return
 		}
-	if {$type != "available"} {
+	} else {
 		return stop
 	}
-	set group [::xmpp::jid::stripResource $jid]
 # TODO: Add check if the current group is valid 
 # in case options(filter_admin_rooms) is enabled
 #puts $xlib
@@ -79,7 +87,6 @@
 #	if {$iam == "" || !($iam == "admin" || $iam == "owner")} {
 #		return
 #	}
-	set chatid [::chat::chatid $xlib $group]
 	if {[::chat::is_opened $chatid]} {
 		if {[::chat::is_groupchat $chatid]} {
 			if {[::xmpp::jid::resource $jid] == ""} {
@@ -89,7 +96,7 @@
 			set ts ""
 			if {$options(verbosity_level) != "min"} {
 				set ts [clock format [clock seconds] \
-					-format $::plugins::options(timestamp_format)]
+				-format $::plugins::options(timestamp_format)]
 			}
 			set real_jid [::xmpp::jid::stripResource \
 				[::muc::get_real_jid $xlib $group/$nick]]
@@ -99,14 +106,15 @@
 			variable jids_by_chats
 
 			if {[info exists jids_by_chats($group)]} {
-				set tmp_user_list $jids_by_chats($group)
-				foreach item $tmp_user_list {
-					if {$options(verbosity_level) == "min"} {
+				if {$options(verbosity_level) == "min"} {
+					set tmp_user_list $jids_by_chats($group)
+					foreach item $tmp_user_list {
 						if {[lsearch -exact [lindex $item 2] $real_jid] >= 0} {
 							unset tmp_user_list
 							return stop
 						}
 					}
+					unset tmp_user_list
 				}
 			}
 			lappend jids_by_chats($group) [list $ts $nick $real_jid]
@@ -119,7 +127,7 @@
 	}
 }
 hook::add client_presence_hook \
-		[namespace current]::bldjid::smart_enter_exit_message 98
+		[namespace current]::bldjid::smart_enter_exit_message 69
 
 proc bldjid::command_comps {chatid compsvar wordstart line} {
 	upvar 0 $compsvar comps
@@ -483,16 +491,17 @@
 #		if {$jid != ""} {
 #			set ci [chat::input_win $chatid]
 #			after idle [list $ci insert end $cmd $jid\n]
+#		}
 	}
 }
 
 proc bldjid::format_msg {msg n} {
-	set sep "\|\|"
+	set sep "||"
 	set x 0
 	foreach item $msg {
 		if {$item != ""} {
 			if {$x == 0} {
-				set item "\ $item"
+				set item $item
 			} else {
 				set item "\ $sep\ $item"
 			}
@@ -500,7 +509,7 @@
 			incr x
 		}
 	}
-	set NEWmsg [join [linsert $newmsg 0 "\n$n:"]]
+	set NEWmsg [join [linsert $newmsg 0 "\n$n:\t"]]
 	return $NEWmsg
 }
 



More information about the Tkabber-dev mailing list