--- dispatcher.py.orig	2005-05-13 14:03:32.000000000 +0200
+++ dispatcher.py	2005-07-04 03:15:01.000000000 +0200
@@ -21,7 +21,7 @@
 Dispatcher.SendAndWaitForResponce method will wait for reply stanza before giving up.
 """
 
-import simplexml,time
+import simplexml,time,sys
 from protocol import *
 from client import PlugIn
 
@@ -37,6 +37,7 @@
         self.handlers={}
         self._expected={}
         self._defaultHandler=None
+        self._pendingException=None
         self._eventHandler=None
         self._cycleHandlers=[]
         self._exported_methods=[self.Process,self.RegisterHandler,self.RegisterDefaultHandler,\
@@ -116,6 +117,10 @@
             try: data=self._owner.Connection.receive()
             except IOError: return
             self.Stream.Parse(data)
+            if self._pendingException != None:
+                _pendingException = self._pendingException
+                self._pendingException = None
+                raise _pendingException[0], _pendingException[1], _pendingException[2]
             if data: return len(data)
         return '0'      # It means that nothing is received but link is alive.
         
@@ -277,7 +282,10 @@
                 try:
                     handler['func'](session,stanza)
                 except Exception, typ:
-                    if typ.__class__.__name__<>'NodeProcessed': raise
+                    if typ.__class__.__name__<>'NodeProcessed':
+                        if self._pendingException == None:
+                            self._pendingException = sys.exc_info()
+                        return
                     user=0
         if user and self._defaultHandler: self._defaultHandler(session,stanza)
 
