diff options
-rw-r--r-- | omegle/icq.py | 13 | ||||
-rwxr-xr-x | twistd.sh | 21 |
2 files changed, 32 insertions, 2 deletions
diff --git a/omegle/icq.py b/omegle/icq.py index aa271cc..37c5db7 100644 --- a/omegle/icq.py +++ b/omegle/icq.py @@ -107,16 +107,25 @@ class ExtendedBOSConnection( oscar.BOSConnection ): message = messageUtf8.encode('latin1','replace') oscar.BOSConnection.sendMessage(self,user,message) - def connectionLost(self,*args,**kwargs): + def connectionLost(self,reason): print "Connection lost" oscar.BOSConnection.connectionLost(self,*args,**kwargs) + self.transport.loseConnection() + self.authenticator.connectionLost(reason) class Authenticator( oscar.OscarAuthenticator ): -# BOSClass = ExtendedBOSConnection def connectionLost(self,reason): oscar.OscarAuthenticator.connectionLost(self,reason) self.factory.connectionLost(reason) + def connectToBOS(self, server, port): + c = protocol.ClientCreator(reactor, self.BOSClass, + self.username, self.cookie) + c.authenticator = self + return c.connectTCP(server, port) + + + class ReconnectOscarFactory(ClientFactory): def __init__(self, BOSClass, uid, password,icq=1): self.BOSClass = BOSClass diff --git a/twistd.sh b/twistd.sh new file mode 100755 index 0000000..0247476 --- /dev/null +++ b/twistd.sh @@ -0,0 +1,21 @@ +#!/bin/sh +export PATH=$PATH:~/svn/trunk/bin +export PYTHONPATH=~/svn/trunk + +action=$1 +shift 1 +case $action in + start) + name=$1 + shift 1 + twistd -y $name.tac --pidfile $name.pid --logfile $name.log $* + ;; + stop) + name=$1 + shift 1 + kill `cat $name.pid` + ;; + *) + echo "twistd.sh [start|stop] NAME" + ;; +esac |