summaryrefslogtreecommitdiff
path: root/proxy.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-28 10:48:00 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-28 10:48:00 +0000
commitc8bb25bf151c95ec4d7254f939d788b84a39cbd2 (patch)
treedabec4a7670c973f422a7975687b585972535d05 /proxy.py
parentb89463084b239985268edf7d3ff08a08f99987bd (diff)
downloadomegle-c8bb25bf151c95ec4d7254f939d788b84a39cbd2.tar.gz
omegle-c8bb25bf151c95ec4d7254f939d788b84a39cbd2.zip
blah
git-svn-id: http://xapek.org/svn/common/omegle@1024 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'proxy.py')
-rw-r--r--proxy.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/proxy.py b/proxy.py
index c995e51..1711198 100644
--- a/proxy.py
+++ b/proxy.py
@@ -1,11 +1,14 @@
from omegle import OmegleChat
import sys, logging, time
-
+from threading import Lock
colors = {"default":0, "black":30, "red":31, "green":32, "yellow":33,
"blue":34,"magenta":35, "cyan":36, "white":37, "black":38,
"black":39} #33[%colors%m
# color_string = "\033[%dm\033[1m" % colors[color]
+
+chat_lock = Lock()
+
class OmegleProxyChat(OmegleChat):
def __init__(self,name,color=0):
OmegleChat.__init__(self)
@@ -34,9 +37,11 @@ class OmegleProxyChat(OmegleChat):
self.partner.stopped_typing()
def on_disconnect(self):
print self.c("%s [EVT] %s disconnect" % (time.strftime("%H:%M:%S"), self.name))
+ chat_lock.release()
logging.basicConfig(level=logging.DEBUG)
+print "press ctrl-c to abort"
A=OmegleProxyChat("A",colors['red'])
B=OmegleProxyChat("B",colors['blue'])
@@ -46,9 +51,13 @@ B.set_partner(A)
A.start()
B.start()
-print "press enter to abort"
+chat_lock.acquire()
try:
- sys.stdin.readline()
+ while True:
+ if chat_lock.acquire(0):
+ break
+ else:
+ time.sleep(0.5)
except KeyboardInterrupt:
pass