[Tkabber-dev] r311 - trunk/plugins/highlightex

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Mar 1 01:51:19 MSK 2010


Author: ancestor
Date: 2010-03-01 01:51:18 +0300 (Mon, 01 Mar 2010)
New Revision: 311

Modified:
   trunk/plugins/highlightex/highlightex.tcl
Log:
1) Fixed some bugs in highlightex.tcl.

Modified: trunk/plugins/highlightex/highlightex.tcl
===================================================================
--- trunk/plugins/highlightex/highlightex.tcl	2010-02-23 08:22:27 UTC (rev 310)
+++ trunk/plugins/highlightex/highlightex.tcl	2010-02-28 22:51:18 UTC (rev 311)
@@ -1,5 +1,5 @@
 # Copyright (c) 2010 ancestor <xmpp: ancestor at jabber.org>
-# Extended Highlight plugin v0.5
+# Extended Highlight plugin v0.6
 # Special thanks to teo.
 
 namespace eval highlightex {
@@ -27,15 +27,17 @@
 ########################################################################################
 
 proc highlightex::process_highlights_ex {atLevel accVar} {
-    upvar #$atLevel $accVar chunks
+	upvar #$atLevel $accVar chunks
 	
-    variable options
+	variable options
 
-    set out {}
+	puts $chunks
+
+	set out {}
 	set allstr ""
 	set fnick 0
 	set nick ""
-	
+
 	foreach {s type tags} $chunks {
 		if {$allstr == ""} {
 			set allstr $s	
@@ -54,7 +56,7 @@
 	}
 	
     	foreach {s type tags} $chunks {
-		if {$type != "text" || $tags == "server" || $s == " "} {
+		if {$tags == "server" || $tags == "highlight" || $s == " "} {
 			# pass through
 			lappend out $s $type $tags
 			continue
@@ -116,11 +118,13 @@
 
 ########################################################################################
 
-proc highlightex::load {} {
-	::richtext::register_entity highlightex \
-		-parser [namespace current]::process_highlights_ex \
-		-parser-priority 60
-	
+proc highlightex::load {} {	
+	if {[lsearch $::richtext::registered highlightex] == -1} {
+		::richtext::register_entity highlightex \
+			-parser [namespace current]::process_highlights_ex \
+			-parser-priority 60
+	}
+
 	hook::add chat_win_popup_menu_hook [namespace current]::add_chat_win_popup_highlightex_menu 10
 
 	::richtext::entity_state highlightex 1
@@ -128,6 +132,7 @@
 
 proc highlightex::unload {} {
 	::richtext::entity_state highlightex 0
+
 	option add *Chat.highlightforeground red3
 
 	hook::remove chat_win_popup_menu_hook [namespace current]::add_chat_win_popup_highlightex_menu 10



More information about the Tkabber-dev mailing list