summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-27 21:52:27 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-27 21:52:27 +0000
commitc689f6e875a9a6997f2c475eb995ec931c238498 (patch)
tree212a11525f57fbf3a492843aabca41e27669bcff
parent16e8fcc9980a24f9bf77a0d3144deacd8e1f61df (diff)
downloadomegle-c689f6e875a9a6997f2c475eb995ec931c238498.tar.gz
omegle-c689f6e875a9a6997f2c475eb995ec931c238498.zip
colors
git-svn-id: http://xapek.org/svn/common/omegle@1020 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r--proxy.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/proxy.py b/proxy.py
index 02569ee..3501e72 100644
--- a/proxy.py
+++ b/proxy.py
@@ -1,34 +1,41 @@
from omegle import OmegleChat
import sys, logging
+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]
class OmegleProxyChat(OmegleChat):
- def __init__(self,name):
+ def __init__(self,name,color=0):
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 set_partner(self,partner):
self.partner = partner
def on_message(self,message):
- print "[MSG] %s: %s" %(self.name, message)
+ print self.c("[MSG] %s: %s" %(self.name, message))
self.partner.send(message)
def on_connect(self):
- print "[EVT] %s Connection confirmed" % self.name
+ print self.c("[EVT] %s Connection confirmed" % self.name)
def on_typing(self):
- print "[EVT] %s is typing" % self.name
+ print self.c("[EVT] %s is typing" % self.name)
self.partner.typing()
def on_stopped_typing(self):
- print "[EVT] %s stopped typing" % self.name
+ print self.c("[EVT] %s stopped typing" % self.name)
self.partner.stopped_typing()
def on_disconnect(self):
- print "[EVT] %s disconnect" % self.name
+ print self.c("[EVT] %s disconnect" % self.name)
self.partner.disconnect()
logging.basicConfig(level=logging.DEBUG)
-A=OmegleProxyChat("A")
-B=OmegleProxyChat("B")
+A=OmegleProxyChat("A",colors['red'])
+B=OmegleProxyChat("B",colors['blue'])
A.set_partner(B)
B.set_partner(A)