diff options
Diffstat (limited to 'icq_roombot_omegle.py')
-rw-r--r-- | icq_roombot_omegle.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/icq_roombot_omegle.py b/icq_roombot_omegle.py index e3fef73..7a838f4 100644 --- a/icq_roombot_omegle.py +++ b/icq_roombot_omegle.py @@ -22,14 +22,15 @@ class OmegleICQChat(OmegleChat): self.user = user self.icqconn = icqconn OmegleChat.__init__(self,name="omegle") + def on_message(self,message): self.send_icqconn( message ) def send_icqconn(self,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") - #von omegle kommt immer unicode - message = unicode(message) #message.decode("utf-8") + #von omegle kommt immer unicode, icq sendet latin1/iso-8859-1 + message = unicode(message) message = message.encode("iso-8859-1","replace") print "Omegle->%s: %s" % (self.user,message.__repr__()) reactor.callFromThread(self.icqconn.sendMessage, self.user, message ) @@ -48,7 +49,7 @@ class OmegleICQChat(OmegleChat): def on_connect(self): print "Omegle->%s: (connected)" % self.user - self.send_icqconn( "== Sup dawg, we heard u need some stranger in ur chatroom, so we put a Stranger in ur chatroom so u can chat with him while u chat with others (until you type %disconnect% without quotes) ==" ) + self.send_icqconn( "== Sup dawg, we heard u need some stranger in ur chatroom, so we put a Stranger in ur chatroom so u can chat with him while u chat with others (until you type %disconnect% anywhere) ==" ) def on_disconnect(self): print "Omegle->%s: (disconnected)" % self.user @@ -57,7 +58,7 @@ class OmegleICQChat(OmegleChat): CAP_TYPING = '\x56\x3f\xc8\x09\x0b\x6f\x41\xbd\x9f\x79\x42\x26\x09\xdf\xa2\xf3' # [4, 20, 0, 0, 2854066430L, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\t222840035\x00\x02'] -class icqBot( oscar.BOSConnection ): +class OmegleICQ( oscar.BOSConnection ): capabilities = [oscar.CAP_CHAT,CAP_TYPING] def __init__(self,s,p,factory,**kwargs): @@ -169,18 +170,12 @@ 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: -# if len(multiparts[0]) == 2: -# print "send to omegle: %s" % message.decode(multiparts[0][1]) -# if multiparts[0][1] == "unicode": -# self.omegleConns[user.name].send(unicode(message)) -# else: - try: -# self.omegleConns[user.name].send(message.decode(multiparts[0][1])) - print "%s->Omegle: %s" % (user.name, message.__repr__()) - self.omegleConns[user.name].send(message) - except Exception,e: - print "icq(%s): Error %s" % (user.name,e) - self.sendMessage(user.name,str(e)) + try: + print "%s->Omegle: %s" % (user.name, message.__repr__()) + self.omegleConns[user.name].send(message) + except Exception,e: + print "icq(%s): Error %s" % (user.name,e) + self.sendMessage(user.name,str(e)) # else: # print "send to omegle: %s" % message # self.omegleConns[user.name].send(message) @@ -207,7 +202,7 @@ class icqBot( oscar.BOSConnection ): class OscarCrap( oscar.OscarAuthenticator ): - BOSClass = icqBot + BOSClass = OmegleICQ # override this to connect our factory to our clients def connectToBOS(self, server, port): c = protocol.ClientCreator(reactor, OscarCrap.BOSClass, |