[Tkabber-dev] [tclxmpp] r154 committed - * xmpp/muc.tcl: Fixed race condition when reporting MUC joininig...

tclxmpp at googlecode.com tclxmpp at googlecode.com
Sun May 2 15:47:54 MSD 2010


Revision: 154
Author: sgolovan
Date: Sun May  2 04:47:02 2010
Log: 	* xmpp/muc.tcl: Fixed race condition when reporting MUC joininig
	  result back to a caller.

http://code.google.com/p/tclxmpp/source/detail?r=154

Modified:
  /trunk/ChangeLog
  /trunk/xmpp/muc.tcl

=======================================
--- /trunk/ChangeLog	Thu Apr 29 23:20:33 2010
+++ /trunk/ChangeLog	Sun May  2 04:47:02 2010
@@ -1,3 +1,8 @@
+2010-05-02  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/muc.tcl: Fixed race condition when reporting MUC joininig
+	  result back to a caller.
+
  2010-04-30  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/privacy.tcl: Fixed registering jabber:iq:privacy namespace
=======================================
--- /trunk/xmpp/muc.tcl	Mon Feb 15 07:02:30 2010
+++ /trunk/xmpp/muc.tcl	Sun May  2 04:47:02 2010
@@ -229,16 +229,17 @@

      set state(status) disconnected
      set state(args) {}
+    set commands $state(commands)
+    set state(commands) {}

      if {[info exists state(id)]} {
          unset state(id)
-        CallBack $state(commands) error \
+        CallBack $commands error \
                   [::xmpp::xml::create error \
                          -cdata [::msgcat::mc "Leaving room"]]
      }

      set id [::xmpp::packetID $xlib]
-    set state(commands) {}

      eval [list ::xmpp::sendPresence $xlib \
                          -type unavailable \
@@ -432,8 +433,9 @@
                          }
                      }

-                    CallBack $state(commands) error $error
+                    set commands $state(commands)
                      set state(commands) {}
+                    CallBack $commands error $error
                      return
                  }
              }
@@ -466,15 +468,15 @@
                  # TODO: Check for $state(requestedNick)?
                  set state(status) disconnected
                  set state(args)   {}
+                set commands $state(commands)
+                set state(commands) {}

                  if {[info exists state(id)]} {
                      unset state(id)
-                    CallBack $state(commands) error \
+                    CallBack $commands error \
                          [::xmpp::xml::create error \
                              -cdata [::msgcat::mc "Disconnected from the  
room"]]
                  }
-
-                set state(commands) {}

                  uplevel #0 $state(-eventcommand) [list disconnect $nick]  
$args
              }
@@ -511,9 +513,10 @@
                      unset state(id)
                      set state(status) connected
                      set state(nick) $nick
-
-                    CallBack $state(commands) ok $nick
+                    set commands $state(commands)
                      set state(commands) {}
+
+                    CallBack $commands ok $nick
                  }
              }

@@ -675,9 +678,10 @@
                              connecting {
                                  catch {unset state(id)}
                                  set state(status) connected
-
-                                CallBack $state(commands) ok $nick
+                                set commands $state(commands)
                                  set state(commands) {}
+
+                                CallBack $commands ok $nick
                              }
                          }
                      }
@@ -734,9 +738,10 @@
                                  # It's our nickname change
                                  catch {unset state(id)}
                                  set state(nick) $new_nick
-
-                                CallBack $state(commands) ok $new_nick
+                                set commands $state(commands)
                                  set state(commands) {}
+
+                                CallBack $commands ok $new_nick
                              }

                              set args [list -nick $new_nick]


More information about the Tkabber-dev mailing list