[Tkabber-dev] r1716 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Mar 12 21:18:42 MSK 2009


Author: sergei
Date: 2009-03-12 21:18:41 +0300 (Thu, 12 Mar 2009)
New Revision: 1716

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/datagathering.tcl
Log:
	* datagathering.tcl: Added preliminary support for URI which reference
	  to bits-of-binary data (only for included in the same stanza yet).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-03-12 18:16:55 UTC (rev 1715)
+++ trunk/tkabber/ChangeLog	2009-03-12 18:18:41 UTC (rev 1716)
@@ -5,6 +5,9 @@
 
 	* msgs/de.msg: Updated German translation (thanks to Roger Sondermann).
 
+	* datagathering.tcl: Added preliminary support for URI which reference
+	  to bits-of-binary data (only for included in the same stanza yet).
+
 2009-03-11  Sergei Golovan  <sgolovan at nes.ru>
 
 	* custom.tcl: Fixed duplicates in customization groups. This is useful

Modified: trunk/tkabber/datagathering.tcl
===================================================================
--- trunk/tkabber/datagathering.tcl	2009-03-12 18:16:55 UTC (rev 1715)
+++ trunk/tkabber/datagathering.tcl	2009-03-12 18:18:41 UTC (rev 1716)
@@ -122,12 +122,37 @@
 	    ::xmpp::xml::split $subel stag sxmlns sattrs scdata ssubels
 	    switch -- $stag {
 		uri {
-		    render_url $g.mediauri$row $scdata $scdata -bg [get_conf $g -bg]
-		    grid $g.mediauri$row -row $row -column 1 -sticky ew
-		    set unsupported 0
-		    incr row
+		    if {[string first cid: $scdata] == 0} {
+			set type [::xmpp::xml::getAttr $sattrs type]
+			switch -glob -- $type {
+			    image/* {
+				# TODO: Request BOB data if it isn't present
+				set tdata [::xmpp::bob::get $cid]
+				if {[llength $tdata] < 2} {
+				    continue
+				}
+				lassign $tdata type data
+				if {![catch {image create photo -data $data} img]} {
+				    label $g.mediaimg$row -image $img
+				    bind $g.mediaimg$row <Destroy> [list image delete $img]
+				    grid $g.mediaimg$row -row $row -column 1 -sticky ew
+				    set unsupported 0
+				    incr row
+				}
+			    }
+			    default {
+				# TODO
+			    }
+			}
+		    } else {
+			render_url $g.mediauri$row $scdata $scdata -bg [get_conf $g -bg]
+			grid $g.mediauri$row -row $row -column 1 -sticky ew
+			set unsupported 0
+			incr row
+		    }
 		}
 		data {
+		    # Old-style data element
 		    set type [::xmpp::xml::getAttr $sattrs type]
 		    switch -glob -- $type {
 			image/* {



More information about the Tkabber-dev mailing list