summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-28 13:49:12 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-28 13:49:12 +0000
commit9dbaa1b392358fb8bca67060431c737c30ac8edb (patch)
tree9773c2be165ba7d64fa4b23494dc5b57cbbee7fc
parentc101bbc442950560a17b27bc45cde714ac2c81c7 (diff)
downloadomegle-9dbaa1b392358fb8bca67060431c737c30ac8edb.tar.gz
omegle-9dbaa1b392358fb8bca67060431c737c30ac8edb.zip
git-svn-id: http://xapek.org/svn/common/omegle@1026 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r--omegle.py8
-rw-r--r--proxy.py3
2 files changed, 7 insertions, 4 deletions
diff --git a/omegle.py b/omegle.py
index ab3c2d0..a3294e0 100644
--- a/omegle.py
+++ b/omegle.py
@@ -33,7 +33,7 @@ class OmegleChat(object):
"Accept": "application/json"
}
- def __init__(self,poll_interval=0.5):
+ def __init__(self,name="",poll_interval=0.5):
self.conn = httplib.HTTPConnection('www.omegle.com')
# self.conn.set_debuglevel(1)
@@ -41,7 +41,7 @@ class OmegleChat(object):
self.timer = Timer(self.events, poll_interval)
- self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__)
+ self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__ + name)
self.is_connected = False
def start(self):
@@ -62,6 +62,7 @@ class OmegleChat(object):
def disconnect(self):
self.logger.debug("/disconnect")
+ self.is_connected = False
self.timer.stop()
self.conn_lock.acquire()
self.conn.request("POST",
@@ -73,8 +74,9 @@ class OmegleChat(object):
body = r.read()
self.logger.debug("/disconnect sent. Read: %s" % body)
if body == "win":
- self.is_connected = False
+ pass
else:
+ self.is_connected = True #disconnect failed
raise Exception("/disconnect; Bad response: %s" % body)
def events(self):
diff --git a/proxy.py b/proxy.py
index a5b0803..438d753 100644
--- a/proxy.py
+++ b/proxy.py
@@ -11,7 +11,7 @@ chat_lock = Lock()
class OmegleProxyChat(OmegleChat):
def __init__(self,name,color=0):
- OmegleChat.__init__(self)
+ OmegleChat.__init__(self,name="(" + name + ")")
self.name = name
self.color = color
def c(self,str,bold=False):
@@ -61,6 +61,7 @@ try:
while True:
if chat_lock.acquire(0):
print "One part disconnected, exiting"
+ break
else:
time.sleep(0.5)
except KeyboardInterrupt: