summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-27 22:10:56 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-27 22:10:56 +0000
commit423fe90162a1c097b02bb8add604cdb9d95a04d0 (patch)
tree4accab8e4b9110b247a6049881aaa45ec90671fc
parentc689f6e875a9a6997f2c475eb995ec931c238498 (diff)
downloadomegle-423fe90162a1c097b02bb8add604cdb9d95a04d0.tar.gz
omegle-423fe90162a1c097b02bb8add604cdb9d95a04d0.zip
blah!
git-svn-id: http://xapek.org/svn/common/omegle@1021 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r--omegle.py2
-rw-r--r--proxy.py14
2 files changed, 11 insertions, 5 deletions
diff --git a/omegle.py b/omegle.py
index 2f70e21..85d87c3 100644
--- a/omegle.py
+++ b/omegle.py
@@ -83,7 +83,7 @@ class OmegleChat(object):
conn.close()
def send(self,msg):
- msg = unicode(msg)
+ msg = unicode(msg).encode("utf8")
self.conn_lock.acquire()
self.conn.request("POST",
"/send",
diff --git a/proxy.py b/proxy.py
index 3501e72..28d7d16 100644
--- a/proxy.py
+++ b/proxy.py
@@ -11,14 +11,17 @@ class OmegleProxyChat(OmegleChat):
OmegleChat.__init__(self)
self.name = name
self.color = color
- def c(self,str):
- return "\033[%sm\033[1m%s\033[0m\033[0m" %(self.color, str)
+ def c(self,str,bold=False):
+ if bold:
+ return "\033[1m\033[%sm%s\033[0m\033[0m" %(self.color, str)
+ else:
+ return "\033[%sm%s\033[0m" %(self.color, str)
def set_partner(self,partner):
self.partner = partner
def on_message(self,message):
- print self.c("[MSG] %s: %s" %(self.name, message))
+ print self.c("[MSG] %s: %s" %(self.name, message),bold=True)
self.partner.send(message)
def on_connect(self):
print self.c("[EVT] %s Connection confirmed" % self.name)
@@ -44,7 +47,10 @@ A.start()
B.start()
print "press enter to abort"
-sys.stdin.readline()
+try:
+ sys.stdin.readline()
+except KeyboardInterrupt:
+ pass
A.disconnect()
B.disconnect()