summaryrefslogtreecommitdiff
path: root/proxy.py
blob: 02569ee417874dc7c9213aa1f5a76f2aed99c299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from omegle import OmegleChat
import sys, logging


class OmegleProxyChat(OmegleChat):
	def __init__(self,name):
		OmegleChat.__init__(self)
		self.name = name

	def set_partner(self,partner):
		self.partner = partner

	def on_message(self,message):
		print "[MSG] %s: %s" %(self.name, message)
		self.partner.send(message)
	def on_connect(self):
		print "[EVT] %s Connection confirmed" % self.name
	def on_typing(self):
		print "[EVT] %s is typing" % self.name
		self.partner.typing()
	def on_stopped_typing(self):
		print "[EVT] %s stopped typing" % self.name
		self.partner.stopped_typing()
	def on_disconnect(self):
		print "[EVT] %s disconnect" % self.name
		self.partner.disconnect()

logging.basicConfig(level=logging.DEBUG)

A=OmegleProxyChat("A")
B=OmegleProxyChat("B")

A.set_partner(B)
B.set_partner(A)

A.start()
B.start()

print "press enter to abort"
sys.stdin.readline()

A.disconnect()
B.disconnect()