[Tkabber-dev] r406 - trunk/plugins/clienticons

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Sep 27 22:26:16 MSD 2010


Author: ancestor
Date: 2010-09-27 22:26:16 +0400 (Mon, 27 Sep 2010)
New Revision: 406

Modified:
   trunk/plugins/clienticons/clienticons.tcl
Log:
1) Fixed "can't find image" bug in clienticons.tcl.
2) Added checking if tkImg exists.


Modified: trunk/plugins/clienticons/clienticons.tcl
===================================================================
--- trunk/plugins/clienticons/clienticons.tcl	2010-09-27 15:09:06 UTC (rev 405)
+++ trunk/plugins/clienticons/clienticons.tcl	2010-09-27 18:26:16 UTC (rev 406)
@@ -3,6 +3,8 @@
 # This plugin contains some portions of Psi+ <http://psi-dev.googlecode.com>
 # and Gajim <http://gajim.org> free jabber clients.
 
+if {[catch {package require Img}]} return
+
 namespace eval clienticons {
 	variable jidnodes
 	variable icondir
@@ -111,7 +113,6 @@
 		"*vkontakte.ru transport*" -
 		*pyvk-t*							{set icon clients/pyvk-t}
 		*process-one.net*					{set icon clients/oneteamiphone}
-		*qip*								{set icon clients/qipinfium}
 		*qutim*								{set icon clients/qutim}
 		"*siemens native jabber client*" -
 		*siejc*								{set icon clients/siejc}
@@ -143,10 +144,10 @@
 		*apps.radio-t.com*					{set icon clients/radio-t}
 		*pda.qip.ru* -
 		"*qip pda*"							{set icon clients/qippda}
+        *qip*								{set icon clients/qipinfium}
 		"*google talk user account*"		{set icon clients/android}
 		*aqq*								{set icon clients/aqq}
 		*asterisk*							{set icon clients/asterisk}
-		#"*\[bombus\*" -
 		*avalon*							{set icon clients/bombus-avalon}
 		*klub54.wen.ru* -
 		*bombusklub*						{set icon clients/bombus-klub}
@@ -246,11 +247,15 @@
                             }
                         }
                         
-                        $c create image [expr $x - 17] $y -image $affi \
+                        $c create image [expr $x - 17] $y -image afficons/$affi \
                             -anchor e \
                             -tag [list jid$tag group$grouptag meta$metatag $type icon afficon]
                     }
-                    
+                        
+                    if {[lsearch [image names] $icon] == -1} {
+                        set icon clients/unknown
+                    }
+                       
 					$c create image $x $y -image $icon \
 						-anchor e \
 						-tags [list jid$tag group$grouptag meta$metatag $type icon clienticon]
@@ -285,11 +290,14 @@
 			object	{set filename "$icondir/[::xmpp::xml::getCdata $s]"}	
 		}	
 	}
-	image create photo $iconame -file $filename
 
+    if {[file exists "$filename"]} {
+        image create photo $iconame -file $filename
+    }
+
     foreach ai {visitor none member moderator owner} {
         set affi "$aicsdir/${ai}.png"
-        image create photo $ai -file $affi
+        image create photo afficons/$ai -file $affi
     }
 }
 



More information about the Tkabber-dev mailing list