diff options
-rw-r--r-- | icq_roombot.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/icq_roombot.py b/icq_roombot.py index 1cba8f9..7dc3da9 100644 --- a/icq_roombot.py +++ b/icq_roombot.py @@ -1,10 +1,11 @@ #!/usr/bin/python -import struct,sys +import sys +import struct +from random import randint from twisted.python import log from twisted.words.protocols import oscar from twisted.internet import reactor, protocol -from random import randint uin = '370496181' password = 'megahal123' @@ -93,6 +94,7 @@ class icqBot( oscar.BOSConnection ): def sendMessage(self, user, messageUtf8): message = messageUtf8.encode('latin1','replace') oscar.BOSConnection.sendMessage(self,user,message) + def receiveMessage( self, user, multiparts, flags ): try: try: @@ -146,7 +148,6 @@ class icqBot( oscar.BOSConnection ): for otherMember in self.room.members: i += 1 reactor.callLater(i, self.sendMessage, otherMember.id, "===== %s/%s joined" % (member.name,member.id)) -# self.sendMessage(otherMember.id, "===== %s/%s joined" % (member.name,member.id)) else: if randint(0,5) == 3: self.sendMessage(user.name, "Use '/join Nickname' or ' /join Nickname'") @@ -157,11 +158,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 @@ -199,9 +195,6 @@ class ReconnectingOSCARFactory(protocol.ClientFactory): class OscarCrap( oscar.OscarAuthenticator ): BOSClass = icqBot connectfactory = ReconnectingOSCARFactory - def connectToBOS(self, server, port): - f = self.connectfactory(self.username, self.cookie) - return reactor.connectTCP(server, int(port), f) class ReconnectingOSCARLoginFactory(protocol.ReconnectingClientFactory): protocol = OscarCrap @@ -212,7 +205,7 @@ class ReconnectingOSCARLoginFactory(protocol.ReconnectingClientFactory): p = self.protocol(self.sn, self.pass_, icq=1) p.factory = self return p - ## only reconnect on *failures* + """only reconnect on *failure*""" def clientConnectionLost(self, con, reason): pass |