Changeset 2

Show
Ignore:
Timestamp:
05/17/07 10:38:55 (2 years ago)
Author:
devja..@anarkystic.com
Message:

more or less alive

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • jibot2/jibot/clee.py

    r1 r2  
    8787   things I wrote""" 
    8888 
     89import logging 
     90 
    8991try: 
    9092    from jibot.sprinkles import ISprinkle, implements, fromPackage 
  • jibot2/jibot/core.py

    r1 r2  
    55from twisted.words.protocols import irc 
    66from twisted.internet import reactor, protocol 
    7 import clee 
     7import jibot.clee as clee 
    88import jibot.sprinkles as sprinkles 
    99import jibot.command as command 
     
    416416class CommandLine(clee.SprinkledClee): 
    417417    standard_option_list = [] 
     418    # these three are to deal with twisted stuff, will have to rewrite this 
     419    # to make use of the twisted options stuff 
     420    opt_dummy_n = clee.make_option("-n", "--dummyn", dest="dummyn") 
     421    opt_dummy_o = clee.make_option("-o", "--dummyo", dest="dummyo") 
     422    opt_dummy_y = clee.make_option("-y", "--dummyy", dest="dummyy") 
     423 
    418424    opt_config = clee.make_option("-c", "--config", action="store", 
    419425                                  dest="config",default="jibot.cfg") 
     
    532538 
    533539if __name__ == '__builtin__': 
     540    # this won't work, bad command-line stuff, will have to fix 
    534541    from twisted.application import service, internet 
    535542    application = service.Application('jibot') 
    536543     
    537544    cli = CommandLine(package="jibot.modules", 
    538                              add_help_option=False) 
    539     options, args = cli.parse_args([]) 
    540      
    541     config = JibotConfig(options.config) 
    542     config.loadOptions(cli) 
    543  
    544  
     545                      add_help_option=False) 
     546    options, args = cli.parse_args() 
     547     
     548    config = Config(options.config) 
     549 
     550    for k, defaultValue in cli.defaults.iteritems(): 
     551        parsedValue = getattr(options, k) 
     552        if parsedValue != defaultValue or not hasattr(config, k): 
     553            setattr(config, k, parsedValue) 
     554        #elif parsedValue == defaultValue and hasattr(config, k) and getattr(config, k) != parsedValue: 
     555        #    setattr(config, k, parsedValue) 
     556 
     557     
    545558    # Create factory protocol and application 
    546     f = JibotFactory(config, args) 
    547  
    548     internet.TCPClient(config.host, int(config.port), 
    549                        f).setServiceParent(application) 
     559    f = ClientFactory(config, args) 
     560     
     561    #print options.enable 
     562    #enabled = options.enable or [] 
     563    #for m in enabled: 
     564     
     565    #for m in dir(f): 
     566    #    print m, getattr(f, m) 
     567     
     568    ## connect the factory to the server 
     569    #reactor.connectTCP("irc.freenode.net",6667, f) 
     570    #reactor.connectTCP(config.host, int(config.port), f) 
     571    i = internet.TCPClient(config.host, int(config.port), f) 
     572    i.setServiceParent(application)