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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Mar 29 06:50:37 MSD 2009


Author: bigote
Date: 2009-03-29 06:50:37 +0400 (Sun, 29 Mar 2009)
New Revision: 182

Removed:
   trunk/plugins/bldjid/muc_save_entrance_message.diff
Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/README
   trunk/plugins/bldjid/TODO
   trunk/plugins/bldjid/bldjid.tcl
Log:
/pickup command is removed. Now commands /bldjid and /banjid
handle visitor lists in their usual way. See README file for details.

Patch for muc.tcl is removed for it's not required anymore.


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2009-03-28 22:49:29 UTC (rev 181)
+++ trunk/plugins/bldjid/ChangeLog	2009-03-29 02:50:37 UTC (rev 182)
@@ -1,3 +1,16 @@
+2009-03-29  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
+--- Version 0.4a4 of the plugin.
+--- Files modified:
+    bldjid.tcl, README, TODO, ChangeLog.
+--- Files removed:
+	muc_save_entrance_message.diff
+
+--- Changes:
+	/pickup command is removed.	Now commands /bldjid and /banjid 
+	handle visitor lists in their usual way. See README file for details.
+	Patch for muc.tcl is removed for it's not required anymore.
+
 2009-03-28  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
 --- Version 0.4a3 of the plugin.
@@ -2,3 +15,3 @@
 ---	Files modified:
-	bldjid.tcl, ChangLog.
+	bldjid.tcl, ChangeLog.
 

Modified: trunk/plugins/bldjid/README
===================================================================
--- trunk/plugins/bldjid/README	2009-03-28 22:49:29 UTC (rev 181)
+++ trunk/plugins/bldjid/README	2009-03-29 02:50:37 UTC (rev 182)
@@ -4,6 +4,10 @@
 in all conferences where you have corresponding privileges.
 Let them waste as least of your time as possible!
 
+====================
+####  COMMANDS  ####
+====================
+
 Usage:
 ---	To show short usage help of the plugin's commands:
 /bldhelp
@@ -33,14 +37,6 @@
 
 New commands added that could be helpful 
 when ::muc::options(gen_enter_exit_msgs) is disabled.
-=================================================
-= At the moment muc.tcl must be patched         =
-= so that these commands could work.            =
-= The patch is placed in the plugin's directory =
-= If the patch cannot be applied because of     =
-= muc.tcl recent updates, please add necessary  =
-= lines manually depending on the context.      =
-=================================================
 
 ---	Show all visitors of the current room
 /visitors
@@ -59,26 +55,59 @@
 room
 
 An enumerated list styled as 'info' will be shown in the current chat window.
-In order to choose a line from it use the following command
-/pickup ?n?
+In order to choose a line from it use commands explained above:
+/banjid ?n?
+reason
 
+and
+
+/bldjid ?n?
+reason
+
 where ?n? is an integer between 0 and the last item number.
 
+--- At the moment /visit* commands do not follow match rules.
+	Instead, they make an exact search for a full room's JID
+	or a given nick. It will be fixed someday :)
+
+--- Autocompletion works for all these commands: write a couple 
+	of the first letters of a command and hit TAB one of more times.
+
+=====================
+####  CUSTOMIZE  ####
+=====================
+
+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. ::muc::options(gen_enter_exit_msgs) must be disabled.
+	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.
+
+--- ::plugins::bldjid::options(send_chat_messages)
+	Besides of logging user entrances, chat system messages are published.
+	Unlike usual messages that are sent by ::muc::options(gen_enter_exit_msgs)
+	these only appear once per JID. That's why it only works 
+	if Minimum verbosity level is chosen. If not, if would be almost the same
+	as ::muc::options(gen_enter_exit_msgs) messages (without exit messages).
+
 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:
 they are put either to the list or to chat windows.
 
-ATTENTION: At the moment the whole chosen line is printed as an error message.
-It should be analized and a JID from it (if any) should be inserted 
-into the current edit box, the cursor is to be moved to the beginning of the line.
-This way you can start typing a new bldjid command 
-that could be autocompleted as well.
+================
+####  MISC  ####
+================
 
-Autocompletion works for all these commands: write a couple 
-of the first letters of a command and hit TAB one of more times.
-
 Plugin's name takes its origin from a Russian word "bldjad" and "JID."
 It also could be taken as an acronim: "Ban Lousy Dorks (by) JID."
 Most part of its code is stolen^W taken from "Urlcmd" plugin and muc.tcl module.

Modified: trunk/plugins/bldjid/TODO
===================================================================
--- trunk/plugins/bldjid/TODO	2009-03-28 22:49:29 UTC (rev 181)
+++ trunk/plugins/bldjid/TODO	2009-03-29 02:50:37 UTC (rev 182)
@@ -1,17 +1,17 @@
----	At the moment the whole chosen line is printed as an error message.
-	(Just for test sake.)
-	It should be analized and a JID from it (if any) should be inserted
-	into the current edit box, the cursor is to be moved to the beginning 
-	of the line. This way you can start typing a new bldjid command
-	that could be autocompleted as well.
----	Add /blcommands command that shows a short usage example list.
 ---	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.
 
 ---	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 options to Customize (for visites list limit, visites list clearing,
-	"Antiflood & Autokick" options).

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2009-03-28 22:49:29 UTC (rev 181)
+++ trunk/plugins/bldjid/bldjid.tcl	2009-03-29 02:50:37 UTC (rev 182)
@@ -126,11 +126,12 @@
 
     if {!$wordstart} {
         lappend comps {/bldjid } {/unbldjid } {/banjid } {/amnesty } \
-		{/visitors } {/visited } {/pickup } {/bldhelp }
+		{/visitors } {/visited } {/bldhelp }
     }
 }
 
 proc bldjid::handle_commands {chatid user body type} {
+	variable jids
     # Detect the command.
     if {[string match {/bldjid*} $body]} {
         set cmd /bldjid
@@ -144,8 +145,6 @@
 		set cmd /visitors
 	} elseif {[string match {/visited*} $body]} {
         set cmd /visited
-	} elseif {[string match {/pickup*} $body]} {
-        set cmd /pickup
 	} elseif {[string match {/bldhelp*} $body]} {
 	    set cmd /bldhelp
     } else return
@@ -175,8 +174,6 @@
         if {[string index $body 8] == " " && [string length $body] > 9} {
 			lassign [muc::parse_nick_reason $body 9] nick room
         }
-	} elseif {[string equal [string range $body 0 7] "/pickup "]} {
-		set index [muc::parse_nick $body 8]
 	} elseif {[string equal [string range $body 0 7] "/bldhelp"]} {
 	} else {
     	return stop
@@ -190,14 +187,26 @@
 		}
 
 		/bldjid {
-		    foreach group $groupjids {
-				[namespace current]::send_ban_request $xlib $group $params $jid $reason
+			if {[string is integer $jid] && [info exists jids]} {
+				set jid [[namespace current]::pickup $jid $chatid]
 			}
+			if {$jid != ""} {
+				foreach group $groupjids {
+					[namespace current]::send_ban_request \
+						$xlib $group $params $jid $reason
+				}
+			}
 		}
 
 		/banjid {
-			set group [chat::get_jid $chatid]
-            [namespace current]::send_ban_request $xlib $group $params $jid $reason
+            if {[string is integer $jid] && [info exists jids]} {
+                set jid [[namespace current]::pickup $jid $chatid]
+            }
+			if {$jid != ""} {
+				set group [chat::get_jid $chatid]
+    	    	[namespace current]::send_ban_request \
+					$xlib $group $params $jid $reason
+			}
 		}
 		
 		/amnesty {
@@ -296,29 +305,6 @@
 	        }
         }
 
-		/pickup {
-	        variable jids
-    	    set group [chat::get_jid $chatid]
-	    	set maxindex [expr {[llength $jids] - 1}]
-		    if {$maxindex < 0} {
-    	   		# Nothing to show: list is empty.
-	    	    chat::add_message $chatid $group error "The list is empty." {}
-	        	return stop
-		    } elseif {$index > $maxindex || $index < 0} {
-				chat::add_message $chatid $group error "Index out of range." {}
-				return stop
-			} elseif {![string is integer $index]} {
-				chat::add_message $chatid $group error "Index must be integer." {}
-				return stop
-			} else {
-				set jid [lindex [lindex $jids $index] 2]
-				if {$jid != ""} {
-					set ci [chat::input_win $chatid]
-					after idle [list $ci insert end $jid]
-				}
-			}
-		}
-
 		/bldhelp {
 			set group [chat::get_jid $chatid]
 			chat::add_message $chatid $group error \
@@ -353,9 +339,15 @@
 			"Shows visits made by *nick*, to the rooms that match *room*:\
 			\n/visited nick\
 			\nroom" {}
-			chat::add_message $chatid $group info \
-			"Choose a JID from the list given by /visit* commands:\
-			\n/pickup ?n?" {}
+            chat::add_message $chatid $group info \
+            "Ban in all rooms where you have admin privileges:\
+			\n?n? means an item number from a list given by a /visit* command.\
+            \n/bldjid ?n?\
+            \nSome reason for banning (optional)." {}
+            chat::add_message $chatid $group info \
+            "Ban in the current room by a number from a list given by a /visit* command.\
+            \n/banjid JID\
+            \nSome reason for banning (optional)." {}
 		}
 	}
     return stop
@@ -493,3 +485,24 @@
 	return $grpjids
 }
 
+proc bldjid::pickup {index chatid} {
+	variable jids
+    set group [chat::get_jid $chatid]
+   	set maxindex [expr {[llength $jids] - 1}]
+    if {$maxindex < 0} {
+   		# Nothing to show: list is empty. There's a check for it up there, however.
+   	    chat::add_message $chatid $group error "The list is empty." {}
+       	return stop
+    } elseif {$index > $maxindex || $index < 0} {
+		chat::add_message $chatid $group error "Index out of range." {}
+		return stop
+	} else {
+		set jid [lindex [lindex $jids $index] 2]
+		return $jid
+#		if {$jid != ""} {
+#			set ci [chat::input_win $chatid]
+#			after idle [list $ci insert end $cmd $jid\n]
+		}
+	}
+}
+

Deleted: trunk/plugins/bldjid/muc_save_entrance_message.diff
===================================================================
--- trunk/plugins/bldjid/muc_save_entrance_message.diff	2009-03-28 22:49:29 UTC (rev 181)
+++ trunk/plugins/bldjid/muc_save_entrance_message.diff	2009-03-29 02:50:37 UTC (rev 182)
@@ -1,56 +0,0 @@
-Index: muc.tcl
-===================================================================
---- muc.tcl	(revisión: 1737)
-+++ muc.tcl	(copia de trabajo)
-@@ -40,6 +40,8 @@
- 	[::msgcat::mc "Report the list of current MUC rooms on\
- 		       disco#items query."] \
- 	-type boolean -group IQ
-+
-+	variable hid_grp_msg
- }
- 
- # MUC affiliations (for translation):
-@@ -1061,7 +1063,7 @@
- 		if {$options(gen_enter_exit_msgs)} {
- 		    chat::add_message \
- 			$chatid $group groupchat $msg {}
--		}
-+		} 
- 	    }
- 	    status {
- 		set code [::xmpp::xml::getAttr $attrs code]
-@@ -1203,6 +1205,7 @@
-     variable options
-     variable users
-     variable ignore_available
-+    variable hid_grp_msg
- 
-     set xlib [::chat::get_xlib $chatid]
-     set group [::chat::get_jid $chatid]
-@@ -1213,8 +1216,8 @@
- 
-     set msg ""
- 
--    set report_entered [expr {$entered && $options(gen_enter_exit_msgs) \
--	&& (![info exists ignore_available] || $ignore_available != $nick)}]
-+    set report_entered [expr {$entered \
-+        && (![info exists ignore_available] || $ignore_available != $nick)}]
- 
-     if {$report_entered} {
- 	set real_jid [get_real_jid $xlib $jid]
-@@ -1246,7 +1249,13 @@
- 	}
-     }
- 
--    ::chat::add_message $chatid $group groupchat $msg {}
-+    if {$options(gen_enter_exit_msgs)} {
-+	::chat::add_message $chatid $group groupchat $msg {}
-+    } elseif {$msg != ""} {
-+	lappend my_msg $group \
-+	[clock format [clock seconds] -format $::plugins::options(timestamp_format)] $msg
-+	lappend hid_grp_msg $my_msg
-+    }
- }
- 
- proc muc::track_room_position {xlib jid role affiliation} {



More information about the Tkabber-dev mailing list