summaryrefslogtreecommitdiff
path: root/omegle_icq.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-07-07 16:22:07 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-07-07 16:22:07 +0000
commit318fe180e481c259d69bd474c6e228f4ad7e1835 (patch)
treeb26ecd436f67644c2885f7a19fa23ab2217db1c3 /omegle_icq.py
parent1416a9338ffaf161cefe95dc3965a76a6c03a6cb (diff)
downloadomegle-318fe180e481c259d69bd474c6e228f4ad7e1835.tar.gz
omegle-318fe180e481c259d69bd474c6e228f4ad7e1835.zip
icq
git-svn-id: http://xapek.org/svn/common/omegle@1194 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'omegle_icq.py')
-rw-r--r--omegle_icq.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/omegle_icq.py b/omegle_icq.py
index 4c4c257..1ec7f7c 100644
--- a/omegle_icq.py
+++ b/omegle_icq.py
@@ -19,15 +19,18 @@ class OmegleICQChat(OmegleChat):
def __init__(self,icqconn,user):
self.user = user
self.icqconn = icqconn
- OmegleChat.__init__(self,name="("+user.name+")")
+ OmegleChat.__init__(self,name="("+user+")")
def on_message(self,message):
- print "%s: omegle got message %s" % (self.user.name,message)
+ print "%s: omegle got message %s" % (self.user,message)
self.send_icqconn( message )
def send_icqconn(self,message):
- print "%s: send to icq %s" % (self.user.name,message)
- reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user.name))+self.user.name+"\x00\x00")
- reactor.callFromThread(self.icqconn.sendMessage, self.user.name, message.decode('utf8').encode('iso-8859-1') )
+ print "%s: send to icq %s" % (self.user,message)
+ #send stopped typing snac
+ reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x00")
+ message = message.decode("utf-8")
+ message = message.encode("iso-8859-1")
+ reactor.callFromThread(self.icqconn.sendMessage, self.user, message )
def on_typing(self):
"""
@@ -35,17 +38,17 @@ class OmegleICQChat(OmegleChat):
0x01 idle
0x00 finish
"""
- reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user.name))+self.user.name+"\x00\x02")
+ reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x02")
print "begin typing"
def on_stopped_typing(self):
- reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user.name))+self.user.name+"\x00\x01")
+ reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x01")
def on_connect(self):
- print "%s: omegle connected" % self.user.name
- self.send_icqconn( "== Stranger CONNECTED (type disconnect to disconnect) ==" )
+ print "%s: omegle connected" % self.user
+ self.send_icqconn( "== Sup dawg, we heard u like to meet strangers so we put a Stranger in ur chat so u can chat while u chat (until you type \"disconnect\" without quotes) ==" )
def on_disconnect(self):
- print "%s: omegle disconnecteed" % self.user.name
+ print "%s: omegle disconnecteed" % self.user
self.send_icqconn( "==Stranger Disconnected ==" )
CAP_TYPING = '\x56\x3f\xc8\x09\x0b\x6f\x41\xbd\x9f\x79\x42\x26\x09\xdf\xa2\xf3'
@@ -113,14 +116,14 @@ class icqBot( oscar.BOSConnection ):
self.sendAuthorizationResponse(user.name, True, '')
if not self.omegleConns.has_key(user.name):
- self.omegleConns[user.name] = OmegleICQChat(self,user)
+ self.omegleConns[user.name] = OmegleICQChat(self,user.name)
try:
message = str(multiparts[0][0])
if not self.omegleConns[user.name].is_connected:
if message == "connect":
self.omegleConns[user.name].start()
- self.sendMessage(user.name, "Connecting you to omegle")
+ self.sendMessage(user.name, "Please stand by.....")
else:
self.sendMessage(user.name, "Not connected, type >connect<")
elif self.omegleConns[user.name].is_connected and message == "disconnect":
@@ -132,9 +135,14 @@ class icqBot( oscar.BOSConnection ):
elif self.omegleConns[user.name].is_connected and not self.omegleConns[user.name].is_confirmed:
self.sendMessage(user.name, "Wait for connection confirm from omegle")
else:
- self.omegleConns[user.name].send(message.decode(multiparts[0][1]))
+ if len(multiparts[0]) == 2:
+ print "send to omegle: %s" % message.decode(multiparts[0][1])
+ self.omegleConns[user.name].send(message.decode(multiparts[0][1]))
+ else:
+ print "send to omegle: %s" % message
+ self.omegleConns[user.name].send(message)
except Exception,e:
- print "error: %s %s\n%s" % (user,multiparts,e)
+ print "error: %s %s -> %s" % (user,multiparts,e)
def chatReceiveMessage( self, chat, user, message ):
self.receiveMessage( self, user, message, 0 )