[Tkabber-dev] r1842 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Oct 26 21:50:14 MSK 2009


Author: sergei
Date: 2009-10-26 21:50:13 +0300 (Mon, 26 Oct 2009)
New Revision: 1842

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/muc.tcl
Log:
	* muc.tcl: Fixed processing errors when joining to a MUC room.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-10-04 11:27:20 UTC (rev 1841)
+++ trunk/tkabber/ChangeLog	2009-10-26 18:50:13 UTC (rev 1842)
@@ -1,3 +1,7 @@
+2009-10-26  Sergei Golovan  <sgolovan at nes.ru>
+
+	* muc.tcl: Fixed processing errors when joining to a MUC room.
+
 2009-10-04  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/iq/version.tcl: Added reporting Windows 7.

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2009-10-04 11:27:20 UTC (rev 1841)
+++ trunk/tkabber/muc.tcl	2009-10-26 18:50:13 UTC (rev 1842)
@@ -1635,6 +1635,7 @@
     variable options
     variable timestamps
     variable muc_password
+    variable joinIds
 
     set group [::xmpp::jid::normalize $group]
     set chatid [chat::chatid $xlib $group]
@@ -1683,14 +1684,48 @@
 
     set tstatus $textstatus
 
+    set id [::xmpp::packetID $xlib]
+    set joinIds($xlib,$id) $chatid
+
     send_presence $xlib $status \
 		  -to $group/$nick \
 		  -status $tstatus \
 		  -xlist [list [::xmpp::xml::create x \
 				    -xmlns $::NS(muc) \
-				    -subelements $x_subtags]]
+				    -subelements $x_subtags]] \
+		  -id $id
 }
 
+proc muc::process_join {xlib from type x args} {
+    variable joinIds
+
+    set status ""
+    set error [::msgcat::mc "Error"]
+    foreach {key val} $args {
+	switch -- $key {
+	    -id     {set id $val}
+	    -status {set status $val}
+	    -error  {set error [::xmpp::stanzaerror::message $val]}
+	}
+    }
+
+    if {![info exists id] || ![info exists joinIds($xlib,$id)]} {
+	return
+    }
+
+    set chatid $joinIds($xlib,$id)
+    unset joinIds($xlib,$id)
+
+    if {![string equal $type error]} {
+	return
+    }
+
+    chat::add_message $chatid [::xmpp::jid::stripResource $from] error $error {}
+    return stop
+}
+
+hook::add client_presence_hook muc::process_join 10
+
 ###############################################################################
 
 proc muc::leave_group {xlib group nick status} {



More information about the Tkabber-dev mailing list