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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jul 31 13:30:25 MSD 2007


Author: sergei
Date: 2007-07-31 13:30:24 +0400 (Tue, 31 Jul 2007)
New Revision: 1168

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/login.tcl
   trunk/tkabber/plugins/filetransfer/http.tcl
   trunk/tkabber/plugins/unix/icon.tcl
   trunk/tkabber/si.tcl
Log:
	* login.tcl: Fixed 'Logout with reason' dialog. It incorrectly reused
	  existing .logout window.
	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=341)

	* plugins/unix/icon.tcl: Do not load static icon if WindowMaker dock
	  is used.
	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=342)

	* si.tcl: Fixed an application error message in case of cancelled file
	  transfer.
	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=358)

	* plugins/filetransfer/http.tcl: Report an error message in case of
	  unsuccessful HTTP reply.
	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=361)


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-07-31 05:47:12 UTC (rev 1167)
+++ trunk/tkabber/ChangeLog	2007-07-31 09:30:24 UTC (rev 1168)
@@ -4,6 +4,22 @@
 	  match CDATA XML declaration (this bug was introduced at
 	  2005-04-07 when parsing unescaped > in tag attributes was fixed).
 
+	* login.tcl: Fixed 'Logout with reason' dialog. It incorrectly reused
+	  existing .logout window.
+	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=341)
+
+	* plugins/unix/icon.tcl: Do not load static icon if WindowMaker dock
+	  is used.
+	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=342)
+
+	* si.tcl: Fixed an application error message in case of cancelled file
+	  transfer.
+	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=358)
+
+	* plugins/filetransfer/http.tcl: Report an error message in case of
+	  unsuccessful HTTP reply.
+	  (Closes http://www.jabber.ru/bugzilla/show_bug.cgi?id=361)
+
 2007-07-26  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/chat/logger.tcl: Added ~ to symbols which are escaped

Modified: trunk/tkabber/login.tcl
===================================================================
--- trunk/tkabber/login.tcl	2007-07-31 05:47:12 UTC (rev 1167)
+++ trunk/tkabber/login.tcl	2007-07-31 09:30:24 UTC (rev 1168)
@@ -646,31 +646,31 @@
 
     set lw .logout
 
-    if {![winfo exists $lw]} {
-        Dialog $lw -title [::msgcat::mc "Logout with reason"] \
+    if {[winfo exists $lw]} {
+	destroy $lw
+    }
+
+    Dialog $lw -title [::msgcat::mc "Logout with reason"] \
 	    -separator 1 -anchor e -default 0 -cancel 1
 
-        set lf [$lw getframe]
-        grid columnconfigure $lf 1 -weight 1
+    set lf [$lw getframe]
+    grid columnconfigure $lf 1 -weight 1
 
-	if {[llength $reasonlist]} {set reason [lindex $reasonlist 0]}
+    if {[llength $reasonlist]} {set reason [lindex $reasonlist 0]}
 
-        label $lf.lreason   -text    [::msgcat::mc "Reason:"]
-        ecursor_entry [ComboBox $lf.reason -textvariable reason \
-		-values $reasonlist -width 35].e
-        label $lf.lpriority -text    [::msgcat::mc "Priority:"]
-        ecursor_entry [entry $lf.priority -textvariable loginconf(priority)]
+    label $lf.lreason   -text    [::msgcat::mc "Reason:"]
+    ecursor_entry [ComboBox $lf.reason -textvariable reason \
+	    -values $reasonlist -width 35].e
+    label $lf.lpriority -text    [::msgcat::mc "Priority:"]
+    ecursor_entry [entry $lf.priority -textvariable loginconf(priority)]
 
-        grid $lf.lreason   -row 0 -column 0 -sticky e
-        grid $lf.reason    -row 0 -column 1 -sticky ew
-        grid $lf.lpriority -row 1 -column 0 -sticky e
-        grid $lf.priority  -row 1 -column 1 -sticky ew
+    grid $lf.lreason   -row 0 -column 0 -sticky e
+    grid $lf.reason    -row 0 -column 1 -sticky ew
+    grid $lf.lpriority -row 1 -column 0 -sticky e
+    grid $lf.priority  -row 1 -column 1 -sticky ew
 
-        $lw add -text [::msgcat::mc "Log out"] -command logout_reason
-        $lw add -text [::msgcat::mc "Cancel"] -command "$lw withdraw"
-    } else {
-        set lf [$lw getframe]
-    }
+    $lw add -text [::msgcat::mc "Log out"] -command logout_reason
+    $lw add -text [::msgcat::mc "Cancel"] -command "$lw withdraw"
 
     $lw draw $lf.reason
 }
@@ -681,7 +681,9 @@
     set reasonlist [update_combo_list $reasonlist $reason 10]
 
     set lw .logout
-    $lw withdraw
+    if {[winfo exists $lw]} {
+	destroy $lw
+    }
 
     # TODO
     set logoutpriority $::loginconf(priority)
@@ -689,7 +691,5 @@
     set logoutuserstatus unavailable
 
     logout
-
-    destroy $lw
 }
 

Modified: trunk/tkabber/plugins/filetransfer/http.tcl
===================================================================
--- trunk/tkabber/plugins/filetransfer/http.tcl	2007-07-31 05:47:12 UTC (rev 1167)
+++ trunk/tkabber/plugins/filetransfer/http.tcl	2007-07-31 09:30:24 UTC (rev 1168)
@@ -261,7 +261,7 @@
 	[list ::http::geturl $url -channel $fd \
 	      -blocksize $chunk_size \
 	      -progress [list [namespace current]::recv_file_progress $f.pb] \
-	      -command [list [namespace current]::recv_file_finish $winid]]
+	      -command [list [namespace current]::recv_file_finish $winid $lang]]
 
     if {[package vcompare 2.3.3 [package require http]] <= 0} {
 	lappend geturl -binary 1
@@ -296,7 +296,7 @@
     set progress$pb $current
 }
 
-proc http::recv_file_finish {winid token} {
+proc http::recv_file_finish {winid lang token} {
     variable result
     variable fds
 
@@ -306,11 +306,28 @@
     }
 
     upvar #0 $token state
-    debugmsg filetransfer "transfer $state(status)"
+    debugmsg filetransfer "transfer $state(status) $state(http)"
 
     bind .ftrfd$winid <Destroy> {}
     destroy .ftrfd$winid
-    set result($winid) {result {}}
+
+    if {[::http::ncode $token] == 200} {
+	set result($winid) {result {}}
+    } else {
+	# TODO: More precise error messages?
+	set result($winid) \
+	    [list error cancel item-not-found \
+		  -text [::trans::trans $lang "File not found"]]
+	after idle [list MessageDlg .ftrecv_error$winid \
+			 -aspect 50000 \
+			 -icon error \
+			 -message [::msgcat::mc \
+				       "Can't receive file: %s" [::http::code $token]] \
+			 -type user \
+			 -buttons ok \
+			 -default 0 \
+			 -cancel 0]
+    }
 }
 
 proc http::recv_file_cancel {winid lang {token ""}} {

Modified: trunk/tkabber/plugins/unix/icon.tcl
===================================================================
--- trunk/tkabber/plugins/unix/icon.tcl	2007-07-31 05:47:12 UTC (rev 1167)
+++ trunk/tkabber/plugins/unix/icon.tcl	2007-07-31 09:30:24 UTC (rev 1168)
@@ -10,6 +10,11 @@
 ##########################################################################
 
 proc icon::win_icons {} {
+    # Do not load static icon if a WindowMaker dock is used.
+    if {[info exists ::wmaker_dock] && $::wmaker_dock} {
+	return
+    }
+
     if {[catch {wm iconphoto . roster/user/unavailable}]} return
 
     trace variable ::curuserstatus w [namespace code update_icon]

Modified: trunk/tkabber/si.tcl
===================================================================
--- trunk/tkabber/si.tcl	2007-07-31 05:47:12 UTC (rev 1167)
+++ trunk/tkabber/si.tcl	2007-07-31 09:30:24 UTC (rev 1168)
@@ -153,6 +153,13 @@
     variable transport
     upvar #0 $stream state
 
+    if {![info exists state(id)]} {
+	# TODO: It would be good to send some error message to a receiver
+	# (but it is not supported by the protocol).
+	uplevel #0 $command [list [list 0 [::msgcat::mc "File transfer aborted"]]]
+	return
+    }
+
     if {$res != "OK"} {
 	uplevel #0 $command [list [list 0 [error_to_string $child]]]
 	return



More information about the Tkabber-dev mailing list