[Tkabber-dev] r904 - in trunk/tkabber: . plugins/filetransfer

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Feb 7 23:58:16 MSK 2007


Author: sergei
Date: 2007-02-07 23:58:13 +0300 (Wed, 07 Feb 2007)
New Revision: 904

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/filetransfer/si.tcl
Log:
	* plugins/filetransfer/si.tcl: Close SOCKS5 connection upon receiving
	  announced number of bytes (helps to avoid infinite waiting if the
	  other side does not close the socket). Also, fixed cancelling of
	  incoming file transfer.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-02-07 19:31:31 UTC (rev 903)
+++ trunk/tkabber/ChangeLog	2007-02-07 20:58:13 UTC (rev 904)
@@ -19,6 +19,11 @@
 	* plugins/richtext/urls.tcl: Fixed duplicate URL processing in case of
 	  nonstandard URL's (thanks to Konstantin Khomoutov).
 
+	* plugins/filetransfer/si.tcl: Close SOCKS5 connection upon receiving
+	  announced number of bytes (helps to avoid infinite waiting if the
+	  other side does not close the socket). Also, fixed cancelling of
+	  incoming file transfer.
+
 2007-02-01  Sergei Golovan  <sgolovan at nes.ru>
 
 	* utils.tcl: Optiimized jid_to_tag (thanks to Konstantin Khomoutov).

Modified: trunk/tkabber/plugins/filetransfer/si.tcl
===================================================================
--- trunk/tkabber/plugins/filetransfer/si.tcl	2007-02-07 19:31:31 UTC (rev 903)
+++ trunk/tkabber/plugins/filetransfer/si.tcl	2007-02-07 20:58:13 UTC (rev 904)
@@ -136,6 +136,8 @@
 
     set state(f) $f
 
+    set state(size) $size
+
     set state(dir) $dir
     set state(name) $name
     set state(filename) [file join $dir $name]
@@ -205,9 +207,13 @@
 proc si::recv_file_cancel {token} {
     upvar #0 $token state
 
-    set state(result) [list 1 [list error cancel not-allowed \
-					  -text [::trans::trans $state(lang) \
-						     "File transfer is refused"]]]
+    if {![info exists state(result)]} {
+	set state(result) [list 1 [list error cancel not-allowed \
+					-text [::trans::trans $state(lang) \
+						   "File transfer is refused"]]]
+    } elseif {[info exists state(w)] && [winfo exists $state(w)]} {
+	destroy $state(w)
+    }
 }
 
 ###############################################################################
@@ -266,6 +272,11 @@
 
     puts -nonewline $fd $data
     set state(progress) [tell $fd]
+
+    if {$state(progress) >= $state(size)} {
+	closed $token $stream
+    }
+
     return 1
 }
 



More information about the Tkabber-dev mailing list