summaryrefslogtreecommitdiff
path: root/omegle_icq.py
diff options
context:
space:
mode:
Diffstat (limited to 'omegle_icq.py')
-rw-r--r--omegle_icq.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/omegle_icq.py b/omegle_icq.py
index bd38526..82c8c04 100644
--- a/omegle_icq.py
+++ b/omegle_icq.py
@@ -21,17 +21,18 @@ class OmegleICQChat(OmegleChat):
self.icqconn = icqconn
OmegleChat.__init__(self,name="("+user.name+")")
def on_message(self,message):
- print "got message %s" % message
+ print "%s: got message %s" % (self.user.name,message)
self.send_icqconn( message )
def send_icqconn(self,message):
+ print "%s: send %s" % (self.user.name,message)
reactor.callFromThread(self.icqconn.sendMessage, self.user.name, str(message) )
def on_connect(self):
- print "connected"
+ print "%s: connected" % self.user.name
self.send_icqconn( "== Stranger CONNECTED (type disconnect to disconnect) ==" )
def on_disconnect(self):
- print "disconnecteed"
+ print "%s: disconnecteed" % self.user.name
self.send_icqconn( "==Stranger Disconnected ==" )
@@ -65,6 +66,12 @@ class icqBot( oscar.BOSConnection ):
def receiveMessage( self, user, multiparts, flags ):
print "receiveMessage(%s,%s,%s)" % (user,multiparts,flags)
+ if "auto" in flags:
+ print "'auto' message, abort"
+ return
+
+ self.sendAuthorizationResponse(user.name, True, '')
+
if not self.omegleConns.has_key(user.name):
self.omegleConns[user.name] = OmegleICQChat(self,user)
@@ -76,13 +83,15 @@ class icqBot( oscar.BOSConnection ):
self.sendMessage(user.name, "Connecting you to omegle")
else:
self.sendMessage(user.name, "Not connected, type >connect<")
+ elif self.omegleConns[user.name].is_connected and message == "disconnect":
+ try:
+ self.omegleConns[user.name].disconnect()
+ except Exception,e:
+ self.sendMessage(user.name, str(e))
+ self.sendMessage(user.name, "Disconnecting")
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")
- elif self.omegleConns[user.name].is_confirmed and message == "disconnect":
- self.omegleConns[user.name].disconnect()
- self.sendMessage(user.name, "Disconnecting")
else:
- print "Send: %s" % message
self.omegleConns[user.name].send(message)
except Exception,e:
print "error: %s %s\n%s" % (user,multiparts,e)
@@ -90,10 +99,6 @@ class icqBot( oscar.BOSConnection ):
def chatReceiveMessage( self, chat, user, message ):
self.receiveMessage( self, user, message, 0 )
- def receiveSendFileRequest(self, *args):
-# def receiveSendFileRequest(self, user, file, description, cookie):
- print args
-
def sendAuthorizationResponse(self, uin, success, responsString):
packet = struct.pack("b", len(uin)) + uin
if success:
@@ -102,6 +107,10 @@ class icqBot( oscar.BOSConnection ):
packet += struct.pack("b", 0)
packet += struct.pack(">H", len(responsString)) + responsString
self.sendSNACnr(0x13, 0x1a, packet)
+ def connectionLost(self,reason):
+ oscar.BOSConnection.connectionLost(self,reason)
+ print reason
+ self.connect()
class OscarCrap( oscar.OscarAuthenticator ):