[Tkabber-dev] r1177 - in trunk/tkabber: . jabberlib-tclxml

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Aug 8 19:27:10 MSD 2007


Author: sergei
Date: 2007-08-08 19:27:09 +0400 (Wed, 08 Aug 2007)
New Revision: 1177

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/jabberlib-tclxml/socks4.tcl
   trunk/tkabber/login.tcl
Log:
	* jabberlib-tclxml/socks4.tcl: Fixed checking SOCKS server response.

	* login.tcl: Added readable connect error messages.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-08-07 18:02:04 UTC (rev 1176)
+++ trunk/tkabber/ChangeLog	2007-08-08 15:27:09 UTC (rev 1177)
@@ -1,3 +1,9 @@
+2007-08-08  Sergei Golovan  <sgolovan at nes.ru>
+
+	* jabberlib-tclxml/socks4.tcl: Fixed checking SOCKS server response.
+
+	* login.tcl: Added readable connect error messages.
+
 2007-08-07  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/general/rawxml.tcl: Removed redundant xmlns attributes from

Modified: trunk/tkabber/jabberlib-tclxml/socks4.tcl
===================================================================
--- trunk/tkabber/jabberlib-tclxml/socks4.tcl	2007-08-07 18:02:04 UTC (rev 1176)
+++ trunk/tkabber/jabberlib-tclxml/socks4.tcl	2007-08-08 15:27:09 UTC (rev 1177)
@@ -174,15 +174,14 @@
 	Finish $token err_version
 	return
     }
-    if {![string equal $status $const(rsp_granted)]} {
-	if {[info exists iconst($status)]} {
-	    Finish $token $iconst($status)
-	} else {
-	    Finish $token error
-	}
+    if {![info exists iconst($status)]} {
+	Finish $token err_unknown
 	return
+    } elseif {![string equal $iconst($status) rsp_granted]} {
+	Finish $token $iconst($status)
+	return
     }
-
+	
     # Read and parse port (2 bytes) and ip (4 bytes).
     if {[catch {read $sock 6} data] || [eof $sock]} {
 	Finish $token network-failure

Modified: trunk/tkabber/login.tcl
===================================================================
--- trunk/tkabber/login.tcl	2007-08-07 18:02:04 UTC (rev 1176)
+++ trunk/tkabber/login.tcl	2007-08-08 15:27:09 UTC (rev 1177)
@@ -179,7 +179,33 @@
 	-group Hidden
 
 ######################################################################
+
+# connect errors mapping
+
+array set connect_error [list \
+	err_unknown 			[::msgcat::mc "Unknown error"] \
+	timeout				[::msgcat::mc "Timeout"] \
+	network-failure			[::msgcat::mc "Network failure"] \
+	err_authorization_required	[::msgcat::mc "Proxy authentication required"] \
+	err_version			[::msgcat::mc "Incorrect SOCKS version"] \
+	err_unsupported_method		[::msgcat::mc "Unsupported SOCKS method"] \
+	err_authentication_unsupported	[::msgcat::mc "Unsupported SOCKS authentication method"] \
+	err_authorization		[::msgcat::mc "SOCKS authentication failed"] \
+	rsp_failure			[::msgcat::mc "SOCKS request failed"] \
+	rsp_errconnect			[::msgcat::mc "SOCKS server cannot identify username"] \
+	rsp_erruserid			[::msgcat::mc "SOCKS server username identification failed"] \
+	rsp_notallowed			[::msgcat::mc "SOCKS connection not allowed by ruleset"] \
+	rsp_netunreachable		[::msgcat::mc "Network unreachable"] \
+	rsp_hostunreachable		[::msgcat::mc "Host unreachable"] \
+	rsp_refused			[::msgcat::mc "Connection refused by destination host"] \
+	rsp_expired			[::msgcat::mc "TTL expired"] \
+	rsp_cmdunsupported		[::msgcat::mc "SOCKS command not supported"] \
+	rsp_addrunsupported		[::msgcat::mc "Address type not supported by SOCKS proxy"] \
+	err_unknown_address_type	[::msgcat::mc "Unknown address type"]]
+
+######################################################################
 proc login {logindata} {
+    global connect_error
     global login_after_time
     global login_after_id
 
@@ -199,8 +225,13 @@
 	    if {[winfo exists .connect_err]} {
 		destroy .connect_err
 	    }
+	    if {[info exists connect_error($connid)]} {
+		set msg $connect_error($connid)
+	    } else {
+		set msg $connid
+	    }
 	    set res [MessageDlg .connect_err -width 600 -icon error \
-		-message [format [::msgcat::mc "Failed to connect: %s"] $connid] \
+		-message [format [::msgcat::mc "Failed to connect: %s"] $msg] \
 		-type user -buttons [list abort [::msgcat::mc "Keep trying"]] \
 		-default 0 -cancel 0]
 	    if {$res} {



More information about the Tkabber-dev mailing list