[Tkabber-dev] r1125 - in trunk/tkabber: . ifacetk plugins/chat plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Apr 29 15:52:39 MSD 2007


Author: sergei
Date: 2007-04-29 15:52:38 +0400 (Sun, 29 Apr 2007)
New Revision: 1125

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ifacetk/buttonbar.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/general/autoaway.tcl
Log:
	* plugins/chat/logger.tcl: Fixed displaying announcement log messages
	  in groupchat logs (thanks to Konstantin Khomoutov).

	* plugins/general/autoaway.tcl: Added support for tkinactive package
	  from TIP 245 (see http://wiki.tcl.tk/14765) in Windows (thanks to
	  Konstantin Khomoutov).

	* ifacetk/buttonbar.tcl: Cleanup in redraw buttonbar code.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-04-24 06:09:43 UTC (rev 1124)
+++ trunk/tkabber/ChangeLog	2007-04-29 11:52:38 UTC (rev 1125)
@@ -1,3 +1,14 @@
+2007-04-29  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/chat/logger.tcl: Fixed displaying announcement log messages
+	  in groupchat logs (thanks to Konstantin Khomoutov).
+
+	* plugins/general/autoaway.tcl: Added support for tkinactive package
+	  from TIP 245 (see http://wiki.tcl.tk/14765) in Windows (thanks to
+	  Konstantin Khomoutov).
+
+	* ifacetk/buttonbar.tcl: Cleanup in redraw buttonbar code.
+
 2007-04-24  Sergei Golovan  <sgolovan at nes.ru>
 
 	* ifacetk/buttonbar.tcl: Fixed raising tab page if this page is

Modified: trunk/tkabber/ifacetk/buttonbar.tcl
===================================================================
--- trunk/tkabber/ifacetk/buttonbar.tcl	2007-04-24 06:09:43 UTC (rev 1124)
+++ trunk/tkabber/ifacetk/buttonbar.tcl	2007-04-29 11:52:38 UTC (rev 1125)
@@ -328,10 +328,8 @@
 
     array unset data configured,*
 
-    set num [llength $data(buttons)]
+    $path:cmd configure -width 0
 
-    if {$num == 0} return
-
     grid forget $path.spacer
 
     set cols [lindex [grid size $path] 0]
@@ -345,14 +343,16 @@
 	catch {grid rowconfigure $path $r -uniform {}}
     }
 
+    set num [llength $data(buttons)]
+
+    if {$num == 0} return
+
     set min [Widget::getoption $path -minwidth]
     set max [Widget::getoption $path -maxwidth]
     if {$min > $max} {
 	set max $min
     }
 
-    $path:cmd configure -width $max
-
     if {[string equal [Widget::getoption $path -orient] "horizontal"]} {
 	set w [winfo width $path]
 

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2007-04-24 06:09:43 UTC (rev 1124)
+++ trunk/tkabber/plugins/chat/logger.tcl	2007-04-29 11:52:38 UTC (rev 1125)
@@ -406,6 +406,16 @@
 
 #############################################################################
 
+proc ::logger::exists_and_empty {what} {
+    upvar 1 $what var
+    expr {[info exists var] && $var == ""}
+}
+
+proc ::logger::exists_and_nonempty {what} {
+    upvar 1 $what var
+    expr {[info exists var] && $var != ""}
+}
+
 proc ::logger::add_messages {l hist mynick} {
     $l configure -state normal
 
@@ -417,34 +427,30 @@
 	    $l insert end \[[formatxmppts $tmp(timestamp)]\] \
 		[list TS-$tmp(timestamp)]
 	}
-	if {[info exists tmp(jid)] && $tmp(jid) == ""} {
+	if {[exists_and_empty tmp(jid)]} {
 	    # synthesized message
 	    $l insert end "---" server_lab
 	    set servertag server
-	} elseif {([info exists tmp(nick)] && $tmp(nick) != "") || \
-			([info exists tmp(jid)] && $tmp(jid) != "")} {
-	    if {[info exists tmp(nick)] && $tmp(nick) != ""} {
+	} else {
+	    if {[exists_and_empty tmp(nick)]} {
+		# message from the server:
+		$l insert end "---" server_lab
+		set servertag server
+	    } else {
 		set nick $tmp(nick)
-	    } elseif {[node_from_jid $tmp(jid)] != ""} {
-		set nick [node_from_jid $tmp(jid)]
-	    } else {
-		set nick $tmp(jid)
+		if {[string equal $nick $mynick]} {
+		    set tag me
+		} else {
+		    set tag they
+		}
+		if {[info exists tmp(body)] && [regsub {^/me } $tmp(body) {} body]} {
+		    $l insert end "*$nick $body" $tag
+		    unset tmp(body)
+		} else {
+		    $l insert end "<$nick>" $tag
+		}
+		set servertag ""
 	    }
-	    if {[string equal $nick $mynick]} {
-		set tag me
-	    } else {
-		set tag they
-	    }
-	    if {[info exists tmp(body)] && [regsub {^/me } $tmp(body) {} body]} {
-		$l insert end "*$nick $body" $tag
-		unset tmp(body)
-	    } else {
-		$l insert end "<$nick>" $tag
-	    }
-	    set servertag ""
-	} else {
-	    $l insert end "---" server_lab
-	    set servertag server
 	}
 	if {[info exists tmp(body)]} {
 	    $l insert end " $tmp(body)" $servertag

Modified: trunk/tkabber/plugins/general/autoaway.tcl
===================================================================
--- trunk/tkabber/plugins/general/autoaway.tcl	2007-04-24 06:09:43 UTC (rev 1124)
+++ trunk/tkabber/plugins/general/autoaway.tcl	2007-04-29 11:52:38 UTC (rev 1125)
@@ -28,10 +28,13 @@
 		}
 	    }
 	    windows {
-		if {[catch { package require tclWinidle }]} {
+		if {![catch { package require tkinactive }]} {
+		    set idle_command tkinactive
+		} elseif {![catch { package require tclWinidle }]} {
+		    set idle_command tclWinidle::idletime
+		} else {
 		    return
 		}
-		set idle_command tclWinidle::idletime
 	    }
 	    default {
 		return
@@ -192,3 +195,4 @@
 
 autoaway::load
 
+# vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list