summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-06-06 23:19:07 -0400
committerLance Stout <lancestout@gmail.com>2010-06-06 23:19:07 -0400
commit3c939313d2381accf4fe449dd569df2be6fe3c55 (patch)
tree08733d1d0a7dccf7db9ef9291b81210f1c96ccd1
parent9962f1a664cfe72b88d78d8541f269f290de8643 (diff)
downloadslixmpp-3c939313d2381accf4fe449dd569df2be6fe3c55.tar.gz
slixmpp-3c939313d2381accf4fe449dd569df2be6fe3c55.tar.bz2
slixmpp-3c939313d2381accf4fe449dd569df2be6fe3c55.tar.xz
slixmpp-3c939313d2381accf4fe449dd569df2be6fe3c55.zip
Modified basexmpp.event() to pass a copy of the event data to each handler.
-rw-r--r--sleekxmpp/basexmpp.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index d2dd3fb4..9728c3f4 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -27,6 +27,7 @@ from . stanza.error import Error
import logging
import threading
+import copy
import sys
@@ -205,12 +206,13 @@ class basexmpp(object):
def event(self, name, eventdata = {}): # called on an event
for handler in self.event_handlers.get(name, []):
+ handlerdata = copy.copy(eventdata)
if handler[1]: #if threaded
#thread.start_new(handler[0], (eventdata,))
- x = threading.Thread(name="Event_%s" % str(handler[0]), target=handler[0], args=(eventdata,))
+ x = threading.Thread(name="Event_%s" % str(handler[0]), target=handler[0], args=(handlerdata,))
x.start()
else:
- handler[0](eventdata)
+ handler[0](handlerdata)
if handler[2]: #disposable
with self.lock:
self.event_handlers[name].pop(self.event_handlers[name].index(handler))