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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Apr 6 05:39:37 MSD 2009


Author: bigote
Date: 2009-04-06 05:39:37 +0400 (Mon, 06 Apr 2009)
New Revision: 198

Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/bldjid.tcl
Log:
Code optimization, some minor fixes, some minor improvements.


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2009-04-05 23:24:05 UTC (rev 197)
+++ trunk/plugins/bldjid/ChangeLog	2009-04-06 01:39:37 UTC (rev 198)
@@ -1,5 +1,14 @@
 2009-04-06  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
+--- Version 0.5.3 of the plugin.
+--- Files modified:
+    bldjid.tcl, ChangeLog.
+
+--- Changes:
+	Code optimization, some minor fixes, some minor improvements.
+
+2009-04-06  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
 --- Version 0.5.2 of the plugin.
 --- Files modified:
     bldjid.tcl, TODO, README, ChangeLog.

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2009-04-05 23:24:05 UTC (rev 197)
+++ trunk/plugins/bldjid/bldjid.tcl	2009-04-06 01:39:37 UTC (rev 198)
@@ -1,4 +1,4 @@
-# "Bldjid" plugin for Tkabber. 2009-04-06 v. 0.5.2
+# "Bldjid" plugin for Tkabber. 2009-04-06 v. 0.5.3
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # See README file for usage.
 
@@ -289,6 +289,7 @@
 				set groupjids [[namespace current]::valid_groups $xlib $which $room]
 				foreach grp $groupjids {
 					foreach item $jids_by_chats($grp) {
+						lappend item $grp
 						lappend user_list $item
 					}
 				}
@@ -328,23 +329,7 @@
 					append header "users matching *$nick* to all rooms:"
 				}
 				set groupjids [[namespace current]::valid_groups $xlib $which {}]
-				foreach grp $groupjids {
-					if {[info exists jids_by_chats($grp)]} {
-						foreach item $jids_by_chats($grp) {
-							if {$options(matching_rules) == "exact"} {
-								if {[string equal [lindex $item 1] $nick]} {
-									lappend item $grp
-									lappend user_list $item
-								}
-							} else {
-								if {[string match -nocase *$nick* [lindex $item 1]]} {
-									lappend item $grp
-									lappend user_list $item
-								}
-							}
-						}
-					}
-				}
+				[namespace current]::prepare_user_list $groupjids $nick
 			} else {
 				if {$options(matching_rules) == "exact"} {
 					append header "$nick to the room $room:"
@@ -360,23 +345,7 @@
 					}
 				}
 				set groupjids [[namespace current]::valid_groups $xlib $which $room]
-				foreach grp $groupjids {
-					if {[info exists jids_by_chats($grp)]} {
-						foreach item $jids_by_chats($grp) {
-							if {$options(matching_rules) == "exact"} {
-								if {[string equal [lindex $item 1] $nick]} {
-									lappend item $grp
-									lappend user_list $item
-								}
-							} else {
-								if {[string match -nocase *$nick* [lindex $item 1]]} {
-									lappend item $grp
-									lappend user_list $item
-								}
-							}
-						}
-					}
-				}
+				[namespace current]::prepare_user_list $groupjids $nick
 			}
 			set msg ""
 			set n 0
@@ -617,17 +586,42 @@
 	set sep "||"
 	set x 0
 	foreach item $msg {
-		if {$item == ""} {
+		if {$item == "" && $x == 0} {
 			set item " "
+		} elseif {$item == ""} {
+			set item " $sep *NO JID* "
+		} elseif {$x == 0} {
+			set item $item
+		} else {
+			set item " $sep $item"
 		}
-			if {$x == 0} {
-				set item $item
-			} else {
-				set item "\ $sep\ $item"
-			}
-			append newmsg $item
-			incr x
+		append newmsg $item
+		incr x
 	}
 	set NEWmsg [join [linsert $newmsg 0 "\n$n:\t"]]
 	return $NEWmsg
 }
+
+proc bldjid::prepare_user_list {grpjds nick} {
+	variable options
+	variable user_list
+	global jids_by_chats
+
+	foreach grp $grpjds {
+		if {[info exists jids_by_chats($grp)]} {
+			foreach item $jids_by_chats($grp) {
+				if {$options(matching_rules) == "exact"} {
+					if {[string equal [lindex $item 1] $nick]} {
+						lappend item $grp
+						lappend user_list $item
+					}
+				} else {
+					if {[string match -nocase *$nick* [lindex $item 1]]} {
+						lappend item $grp
+						lappend user_list $item
+					}
+				}
+			}
+		}
+	}
+}



More information about the Tkabber-dev mailing list