summaryrefslogtreecommitdiff
path: root/omegle.py
diff options
context:
space:
mode:
Diffstat (limited to 'omegle.py')
-rw-r--r--omegle.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/omegle.py b/omegle.py
index 62a3892..2a8eae2 100644
--- a/omegle.py
+++ b/omegle.py
@@ -34,6 +34,7 @@ class Timer(Thread):
self.logger.debug("self.running == False")
def stop(self):
+ """ XXX break func() ? """
self.running = False
self.event.set()
@@ -65,9 +66,10 @@ class RESTClient(object):
class OmegleChat(RESTClient):
def __init__(self,poll_interval=0.5,name="",host="omegle.com"):
self.name = name
+ self.poll_interval=poll_interval
RESTClient.__init__(self,host)
- self.timer = Timer(self._events, poll_interval)
+ self.timer = Timer(self._events, poll_interval)
self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__ + name)
self.is_confirmed = False #after getting a connection confirm
self.is_connected = False #after having self.id
@@ -86,8 +88,9 @@ class OmegleChat(RESTClient):
self.id = id[1]
self.logger.info("Connected id=%s" % self.id)
#start /events polling
- self.timer.start()
self.is_connected = True
+ self.timer = Timer(self._events, self.poll_interval)
+ self.timer.start()
else:
self.logger.error("Bad response: %s" % body)
raise Exception("Bad response: %s" % body)