[Tkabber-dev] r1811 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Jun 18 22:39:05 MSD 2009


Author: sergei
Date: 2009-06-18 11:10:18 +0400 (ÞÔ, 18 ÉÀÎ 2009)
New Revision: 1811

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/muc.tcl
Log:
	* muc.tcl: Changed the order of status codes processing in MUC presence
	  packets. This prevents conflicts between code 110 (our own presence)
	  and 303 (changing nicknames).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-06-08 05:11:45 UTC (rev 1810)
+++ trunk/tkabber/ChangeLog	2009-06-18 07:10:18 UTC (rev 1811)
@@ -1,3 +1,9 @@
+2009-06-18  Sergei Golovan  <sgolovan at nes.ru>
+
+	* muc.tcl: Changed the order of status codes processing in MUC presence
+	  packets. This prevents conflicts between code 110 (our own presence)
+	  and 303 (changing nicknames).
+
 2009-06-08  Sergei Golovan  <sgolovan at nes.ru>
 
 	* ifacetk/iface.tcl: Fixed sending announce messages.

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2009-06-08 05:11:45 UTC (rev 1810)
+++ trunk/tkabber/muc.tcl	2009-06-18 07:10:18 UTC (rev 1811)
@@ -1032,6 +1032,10 @@
     variable users
     variable options
 
+    set nick [chat::get_nick $xlib $user groupchat]
+    set group [::xmpp::jid::stripResource $user]
+    set chatid [chat::chatid $xlib $group]
+
     foreach child $children {
 	::xmpp::xml::split $child tag xmlns attrs cdata subels
 	switch -- $tag {
@@ -1057,8 +1061,6 @@
 		}
 	    }
 	    destroy {
-		set group [::xmpp::jid::stripResource $user]
-		set chatid [chat::chatid $xlib $group]
 		set msg [::msgcat::mc "Room is destroyed"]
 		foreach ch $subels {
 		    ::xmpp::xml::split $ch stag sxmlns sattrs scdata ssubels
@@ -1075,11 +1077,32 @@
 			$chatid $group groupchat $msg {}
 		}
 	    }
+	}
+    }
+
+    foreach child $children {
+	::xmpp::xml::split $child tag xmlns attrs cdata subels
+	switch -- $tag {
 	    status {
 		set code [::xmpp::xml::getAttr $attrs code]
-		set group [::xmpp::jid::stripResource $user]
-		set chatid [chat::chatid $xlib $group]
 		switch -- $code {
+		    110 -
+		    210 {
+			# 110: This present packet is our own
+			# 210: The service has changed our nickname
+			set_our_groupchat_nick $chatid $nick
+		    }
+		}
+	    }
+	}
+    }
+
+    foreach child $children {
+	::xmpp::xml::split $child tag xmlns attrs cdata subels
+	switch -- $tag {
+	    status {
+		set code [::xmpp::xml::getAttr $attrs code]
+		switch -- $code {
 		    201 {
 			chat::add_message \
 			    $chatid $group groupchat \
@@ -1093,20 +1116,12 @@
 			    request_instant_room $chatid
 			}
 		    }
-		    110 -
-		    210 {
-			# 110: This present packet is our own
-			# 210: The service has changed our nickname
-			set nick [chat::get_nick $xlib $user groupchat]
-			set_our_groupchat_nick $chatid $nick
-		    }
 		    301 -
 		    307 -
 		    321 -
 		    322 {
 			# 301: ban, 307: kick, 321: loosing membership
 			# 322: room becomes members-only
-			set nick [chat::get_nick $xlib $user groupchat]
 			set real_jid [get_real_jid $xlib $group/$nick]
 			if {$real_jid != ""} {
 			    set real_jid " ($real_jid)"
@@ -1146,7 +1161,6 @@
 		    }
 		    303 {
 			# 303: nickname change
-			set nick [chat::get_nick $xlib $user groupchat]
 			if {[info exists new_nick] && $new_nick != ""} {
 			    if {$nick == [get_our_groupchat_nick $chatid]} {
 				set_our_groupchat_nick $chatid $new_nick



More information about the Tkabber-dev mailing list