Ticket #4083: 4083.patch

File 4083.patch, 2.6 KB (added by Poincare, 4 years ago)

reivew

  • twisted/scripts/tap2rpm.py

     
    225225    description = config['description'] or ('A TCP server for %(protocol)s' % 
    226226                                            vars()) 
    227227    long_description = (config['long_description'] 
    228                         or 'Automatically created by tap2deb') 
     228                        or "Automatically created by tap2deb") 
    229229    twistd_option = type_dict[config['type']] 
    230230    date = time.strftime('%a %b %d %Y', time.localtime(time.time())) 
    231231    directory = rpm_file + '-' + version 
  • doc/words/examples/aimbot.py

     
    1 #!/usr/bin/env python 
    2  
    3 # Copyright (c) 2009 Twisted Matrix Laboratories. 
    4 # See LICENSE for details. 
    5  
    6 """ 
    7 AIM echo bot. 
    8 """ 
    9  
    10 from twisted.words.protocols import toc 
    11 from twisted.internet import reactor, protocol 
    12 import twisted.words.im.tocsupport as ts 
    13  
    14 # account info 
    15 screenname = 'username' 
    16 password = 'password' 
    17  
    18 class aimBot(toc.TOCClient): 
    19     """AOL Instant Messenger echo bot""" 
    20  
    21     def gotConfig(self, mode, buddylist, permit, deny): 
    22         """called when the server sends us config info""" 
    23         global screename 
    24  
    25         # add someone to our deny list? 
    26         self.add_deny([]) 
    27  
    28         # add ourself to our buddy list 
    29         self.add_buddy([screenname]) 
    30  
    31         # finish up the signon procedure 
    32         self.signon() 
    33  
    34     def updateBuddy(self,username,online,evilness,signontime,idletime,userclass,away): 
    35         """called when a buddy changes state""" 
    36         print "status changed for",username 
    37  
    38     def hearWarning(self, warnlvl, screenname): 
    39         """called when someone warns us""" 
    40         print screenname,"warned us" 
    41  
    42     def hearError(self, errcode, *args): 
    43         """called when server sends error""" 
    44         print "recieved error:",errcode 
    45  
    46     def hearMessage(self, username, message, autoreply): 
    47         """called when a message is recieved""" 
    48  
    49         # remove the incoming message' html 
    50         msg = ts.dehtml(message) 
    51          
    52         print "got message:",msg 
    53          
    54         # construct the reply, and turn it into html 
    55         reply = ts.html("echo: %s" % msg) 
    56  
    57         self.say(username, reply) 
    58  
    59 cc = protocol.ClientCreator(reactor, aimBot, screenname, password) 
    60 cc.connectTCP("toc.oscar.aol.com", 9898) 
    61  
    62 reactor.run()