[Tkabber-dev] r1618 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Nov 26 17:40:16 MSK 2008


Author: sergei
Date: 2008-11-26 17:40:16 +0300 (Wed, 26 Nov 2008)
New Revision: 1618

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/login.tcl
Log:
	* login.tcl: Refixed bug with incorrect disconnecting from the server
	  if authentication failed.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2008-11-25 21:07:14 UTC (rev 1617)
+++ trunk/tkabber/ChangeLog	2008-11-26 14:40:16 UTC (rev 1618)
@@ -1,3 +1,8 @@
+2008-11-26  Sergei Golovan  <sgolovan at nes.ru>
+
+	* login.tcl: Refixed bug with incorrect disconnecting from the server
+	  if authentication failed.
+
 2008-11-25  Sergei Golovan  <sgolovan at nes.ru>
 
 	* login.tcl: Fixed bug with incorrect disconnecting from the server

Modified: trunk/tkabber/login.tcl
===================================================================
--- trunk/tkabber/login.tcl	2008-11-25 21:07:14 UTC (rev 1617)
+++ trunk/tkabber/login.tcl	2008-11-26 14:40:16 UTC (rev 1618)
@@ -369,6 +369,7 @@
     debugmsg login "Scheduling connect retry for $jid in ${login_after_time}ms"
     if {[info exists login_after_id($jid)]} {
 	after cancel $login_after_id($jid)
+	unset login_after_id($jid)
     }
     login_retry1 $login_after_time $jid $logindata
 }
@@ -743,14 +744,8 @@
 
 # TODO
 proc disconnected {xlib} {
-    global login_after_id
+    remove_from_login_after_id $xlib
 
-    set jid [::xmpp::jid::normalize [connection_requested_jid $xlib]]
-    if {[info exists login_after_id($jid)]} {
-	after cancel $login_after_id($jid)
-	unset login_after_id($jid)
-    }
-
     if {[lsearch -exact [connections] $xlib] < 0} return
 
     hook::run disconnected_hook $xlib
@@ -762,6 +757,16 @@
     hook::run log_hook $xlib $dir $type $msg
 }
 
+proc remove_from_login_after_id {xlib} {
+    global login_after_id
+
+    set jid [::xmpp::jid::normalize [connection_requested_jid $xlib]]
+    if {[info exists login_after_id($jid)]} {
+	after cancel $login_after_id($jid)
+	unset login_after_id($jid)
+    }
+}
+
 proc recv_auth_result {xlib logindata res xml} {
     global connjid
 
@@ -798,21 +803,22 @@
 	}
 	# Connection isn't authenticated here, so disconnecting without
 	# a logout.
+	remove_from_login_after_id $xlib
 	::xmpp::disconnect $xlib
     }
 }
 
 proc recv_register_result {xlib logindata res xml} {
-    puts "$xlib $res $xml"
+    remove_from_login_after_id $xlib
+    ::xmpp::disconnect $xlib
+
     if {$res == "ok"} {
-	::xmpp::disconnect $xlib
 	login $logindata
     } else {
 	MessageDlg [epath] -aspect 50000 -icon error \
 	    -message [::msgcat::mc "Registration failed: %s" \
 				   [error_to_string $xml]] \
 	    -type user -buttons ok -default 0 -cancel 0
-	logout $xlib
     }
 }
 



More information about the Tkabber-dev mailing list