diff options
-rw-r--r-- | omegle_icq.py | 36 |
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 ) |