[Tkabber-dev] r1576 - in trunk/tkabber: . ifacetk plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Oct 23 22:49:58 MSD 2008


Author: sergei
Date: 2008-10-23 22:49:58 +0400 (Thu, 23 Oct 2008)
New Revision: 1576

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/ifacetk/iroster.tcl
   trunk/tkabber/login.tcl
   trunk/tkabber/plugins/general/sound.tcl
   trunk/tkabber/presence.tcl
   trunk/tkabber/roster.tcl
Log:
	* chats.tcl, ifacetk/iroster.tcl, login.tcl,
	  plugins/general/sound.tcl, presence.tcl, roster.tcl: Removed
	  predisconnected_hook and moved all procedures from it to
	  dosconnected_hook.

	* login.tcl: Don't actually logout if a connection isn't in active
	  connections list.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/ChangeLog	2008-10-23 18:49:58 UTC (rev 1576)
@@ -1,3 +1,13 @@
+2008-10-23  Sergei Golovan  <sgolovan at nes.ru>
+
+	* chats.tcl, ifacetk/iroster.tcl, login.tcl,
+	  plugins/general/sound.tcl, presence.tcl, roster.tcl: Removed
+	  predisconnected_hook and moved all procedures from it to
+	  dosconnected_hook.
+
+	* login.tcl: Don't actually logout if a connection isn't in active
+	  connections list.
+
 2008-10-22  Sergei Golovan  <sgolovan at nes.ru>
 
 	* datagathering.tcl: Fixed typo.

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/chats.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -374,7 +374,7 @@
     }
 }
 
-hook::add predisconnected_hook [namespace current]::chat::disconnect_groupchats 99
+hook::add disconnected_hook [namespace current]::chat::disconnect_groupchats
 
 proc chat::open_window {chatid type args} {
     global chat_width chat_height

Modified: trunk/tkabber/ifacetk/iroster.tcl
===================================================================
--- trunk/tkabber/ifacetk/iroster.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/ifacetk/iroster.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -225,7 +225,7 @@
     set show_offline_group_list $_show_offline_group_list
 }
 
-hook::add predisconnected_hook [namespace current]::roster::set_group_lists
+hook::add disconnected_hook [namespace current]::roster::set_group_lists 40
 
 proc roster::process_item {xlib jid name groups subsc ask} {
     after cancel [namespace parent]::update_chat_titles

Modified: trunk/tkabber/login.tcl
===================================================================
--- trunk/tkabber/login.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/login.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -251,7 +251,7 @@
     set connections [lreplace $connections $idx $idx]
 }
 
-hook::add predisconnected_hook remove_from_connection 1000
+hook::add disconnected_hook remove_from_connection 90
 
 proc connection_jid {xlib} {
     global connjid
@@ -750,22 +750,13 @@
 	unset login_after_id($jid)
     }
 
-    hook::run predisconnected_hook $xlib
+    if {[lsearch -exact [connections] $xlib] < 0} return
 
-    ::xmpp::disconnect $xlib
-    roster::clean $xlib
-
-    if {[connections] == {}} {
-	set_status "Disconnected"
-
-	set curuserstatus unavailable
-	set userstatusdesc [::msgcat::mc "Not logged in"]
-	hook::run change_our_presence_post_hook unavailable
-    }
-
     hook::run disconnected_hook $xlib
 }
 
+hook::add disconnected_hook ::xmpp::disconnect 10
+
 proc recv_auth_result {xlib logindata res xml} {
     global connjid
 

Modified: trunk/tkabber/plugins/general/sound.tcl
===================================================================
--- trunk/tkabber/plugins/general/sound.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/plugins/general/sound.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -111,7 +111,7 @@
 	[namespace current]::presence_notify 100
     hook::add change_our_presence_post_hook [namespace current]::mute_setup 100
     hook::add connected_hook [namespace current]::connected_notify 100
-    hook::add predisconnected_hook [namespace current]::disconnected_notify 100
+    hook::add disconnected_hook [namespace current]::disconnected_notify
     hook::add postload_hook [namespace current]::sound_setup 100
     hook::add draw_message_hook [namespace current]::chat_message_notify 19
 }

Modified: trunk/tkabber/presence.tcl
===================================================================
--- trunk/tkabber/presence.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/presence.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -343,6 +343,20 @@
 
 ###############################################################################
 
+proc change_presence_on_disconnect {xlib} {
+    if {[connections] == {}} {
+	set_status "Disconnected"
+
+	set curuserstatus unavailable
+	set userstatusdesc [::msgcat::mc "Not logged in"]
+	hook::run change_our_presence_post_hook unavailable
+    }
+}
+
+hook::add disconnected_hook change_presence_on_disconnect 100
+
+###############################################################################
+
 trace variable userstatus w change_our_presence
 trace variable logoutuserstatus w change_our_presence
 

Modified: trunk/tkabber/roster.tcl
===================================================================
--- trunk/tkabber/roster.tcl	2008-10-23 01:10:14 UTC (rev 1575)
+++ trunk/tkabber/roster.tcl	2008-10-23 18:49:58 UTC (rev 1576)
@@ -89,6 +89,28 @@
 
 hook::add connected_hook [namespace current]::roster::request_roster 15
 
+proc roster::clean {xlib} {
+    variable roster
+
+    if {[info exists roster(token,$xlib)]} {
+	::xmpp::roster::free $roster(token,$xlib)
+    }
+
+    array unset roster token,$xlib
+    array unset roster jids,$xlib
+    array unset roster group,$xlib,*
+    array unset roster name,$xlib,*
+    array unset roster subsc,$xlib,*
+    array unset roster ask,$xlib,*
+    array unset roster subtype,$xlib,*
+    array unset roster cached_category_and_subtype,$xlib,*
+    array unset roster overridden_category_and_subtype,$xlib,*
+
+    ::redraw_roster
+}
+
+hook::add disconnected_hook [namespace current]::roster::clean
+
 proc roster::get_group_jids {xlib group args} {
     variable roster
     variable undef_group_name
@@ -463,26 +485,6 @@
     return {user client}
 }
 
-proc roster::clean {xlib} {
-    variable roster
-
-    if {[info exists roster(token,$xlib)]} {
-	::xmpp::roster::free $roster(token,$xlib)
-    }
-
-    array unset roster token,$xlib
-    array unset roster jids,$xlib
-    array unset roster group,$xlib,*
-    array unset roster name,$xlib,*
-    array unset roster subsc,$xlib,*
-    array unset roster ask,$xlib,*
-    array unset roster subtype,$xlib,*
-    array unset roster cached_category_and_subtype,$xlib,*
-    array unset roster overridden_category_and_subtype,$xlib,*
-
-    ::redraw_roster
-}
-
 ###############################################################################
 
 proc roster::item_to_xml {xlib jid} {



More information about the Tkabber-dev mailing list