# Path: karmabot/core/client.py
# class KarmaBotFactory(ReconnectingClientFactory):
#     protocol = KarmaBot
# 
#     def __init__(self, filename, nick, channels, trusted, password=None,
#                  extensions=[]):
#         self.nick = nick
#         self.channels = channels
#         self.filename = filename
#         self.trusted = trusted
#         self.password = password
#         self.extensions = extensions
# 
#     def buildProtocol(self, addr):
#         # Reset the ReconnectingClientFactory reconnect delay because we don't
#         # want the next disconnect to force karmabot to delay forever.
#         self.resetDelay()
#         return ReconnectingClientFactory.buildProtocol(self, addr)
# 
#     def clientConnectionLost(self, connector, reason):
#         ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
# 
#     def clientConnectionFailed(self, connector, reason):
#         reactor.stop()


import sys
from twisted.internet import reactor, ssl
from twisted.python import log
from karmabot.core.client import KarmaBotFactory
    from optparse import OptionParser
    # Bot options
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False,
                      help="enable verbose output")
    parser.add_option("-d", "--data",
                      action="store", dest="filename", default="karma.json",
                      help="karma data file name")
    parser.add_option("-t", "--trust",
                      action="append", dest="trusted", default=[],
                      help="trusted hostmasks")
    parser.add_option("-f", "--facets",
                      action="append", dest="facets", default=[],
                      help="additional facets to load")

    (options, channels) = parser.parse_args()

    if not channels:
        parser.error("You must supply some channels to join.")
    else:
        log.msg("Channels to join: %s" % channels)

    if options.verbose:
        log.startLogging(sys.stdout)

    if not options.port:
        options.port = 6667 if not options.ssl else 9999

    factory = KarmaBotFactory(options.filename, options.nick,
                              channels, options.trusted, options.password,
                              options.facets)

# Path: karmabot/core/client.py
# class KarmaBotFactory(ReconnectingClientFactory):
#     protocol = KarmaBot
# 
#     def __init__(self, filename, nick, channels, trusted, password=None,
#                  extensions=[]):
#         self.nick = nick
#         self.channels = channels
#         self.filename = filename
#         self.trusted = trusted
#         self.password = password
#         self.extensions = extensions
# 
#     def buildProtocol(self, addr):
#         # Reset the ReconnectingClientFactory reconnect delay because we don't
#         # want the next disconnect to force karmabot to delay forever.
#         self.resetDelay()
#         return ReconnectingClientFactory.buildProtocol(self, addr)
# 
#     def clientConnectionLost(self, connector, reason):
#         ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
# 
#     def clientConnectionFailed(self, connector, reason):
#         reactor.stop()


# Path: karmabot/scripts/runserver.py
import sys
from twisted.internet import reactor, ssl
from twisted.python import log
from karmabot.core.client import KarmaBotFactory
    from optparse import OptionParser

    # Bot options
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False,
                      help="enable verbose output")
    parser.add_option("-d", "--data",
                      action="store", dest="filename", default="karma.json",
                      help="karma data file name")
    parser.add_option("-t", "--trust",
                      action="append", dest="trusted", default=[],
                      help="trusted hostmasks")
    parser.add_option("-f", "--facets",
                      action="append", dest="facets", default=[],
                      help="additional facets to load")

    (options, channels) = parser.parse_args()

    if not channels:
        parser.error("You must supply some channels to join.")
    else:
        log.msg("Channels to join: %s" % channels)

    if options.verbose:
        log.startLogging(sys.stdout)

    if not options.port:
        options.port = 6667 if not options.ssl else 9999

    factory = KarmaBotFactory(options.filename, options.nick,
                              channels, options.trusted, options.password,
                              options.facets)

    if not options.ssl: