[Tkabber-dev] r1277 - in trunk/tkabber: . plugins/richtext

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Oct 21 11:50:03 MSD 2007


Author: sergei
Date: 2007-10-21 11:50:02 +0400 (Sun, 21 Oct 2007)
New Revision: 1277

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/richtext/emoticons.tcl
Log:
	* plugins/richtext/emoticons.tcl: Added support for JISP emoticon
	  sets (requires vfs::zip and Memchan Tcl extensions).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-10-18 08:34:22 UTC (rev 1276)
+++ trunk/tkabber/ChangeLog	2007-10-21 07:50:02 UTC (rev 1277)
@@ -1,3 +1,8 @@
+2007-10-21  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/richtext/emoticons.tcl: Added support for JISP emoticon
+	  sets (requires vfs::zip and Memchan Tcl extensions).
+
 2007-10-18  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/windows/taskbar.tcl: Added window icons to all Tkabber

Modified: trunk/tkabber/plugins/richtext/emoticons.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/emoticons.tcl	2007-10-18 08:34:22 UTC (rev 1276)
+++ trunk/tkabber/plugins/richtext/emoticons.tcl	2007-10-21 07:50:02 UTC (rev 1277)
@@ -1,5 +1,7 @@
 # $Id$
 
+catch {package require vfs::zip}
+
 namespace eval emoticons {
     variable themes
     variable emoticons   ;# mapping from text mnemonics to images
@@ -530,14 +532,24 @@
 proc emoticons::enumerate_theme {varName dir} {
     set icondef_path [file join $dir icondef.xml]
 
-    if {![file isfile $icondef_path]} return
+    if {[file isfile $icondef_path]} {
+	set thdir $dir
+    } elseif {![catch {::vfs::zip::Mount $dir $dir} mount_fd] && \
+	![catch {lindex [glob $dir/*/icondef.xml] 0} icondef_path]} {
+	set thdir [file dirname $icondef_path]
+    } else {
+	return
+    }
+    if {![catch {open $icondef_path} f]} {
+	set icondef [read $f]
+	close $f
+    } else {
+	catch {::vfs::zip::Unmount $mount_fd $dir}
+	return
+    }
 
-    set f [open $icondef_path]
-    set icondef [read $f]
-    close $f
-
     set parser [jlib::wrapper:new "#" "#" \
-		    [list [namespace current]::get_theme_name $varName $dir]]
+		    [list [namespace current]::get_theme_name $varName $thdir]]
     jlib::wrapper:elementstart $parser stream:stream {} {}
     jlib::wrapper:parser $parser parse $icondef
     jlib::wrapper:parser $parser configure -final 0



More information about the Tkabber-dev mailing list