示例#1
0
        return p

    def __init__(self, botnick, channel):
        self.nick = botnick
        self.channel = channel
 
    def clientConnectionLost(self, connector, reason):
        """If we get disconnected, reconnect to server."""
        connector.connect()

    def clientConnectionFailed(self, connector, reason):
        print "connection failed:", reason
        reactor.stop()

if __name__ == '__main__':
    from twisted.internet.app import Application
    import gzz_mail_parser, msglistener


    mp = gzz_mail_parser.GZZMailParser
    botf = BotFactory('cvsbot', '#fenfire')
    mlf = msglistener.MsgListenerFactory(botf, mp)

    app = Application("cvsbot")

    app.connectTCP("irc.jyu.fi", 6667, botf)
    app.listenTCP(9999, mlf)
    app.run()


示例#2
0
    to_be_sent = [p for p in patches if p not in patches_sent]
    has_sent = []

    for p in to_be_sent:
        if send(proj, p, send_notice): has_sent.append(p)

    f = open(FILE, 'a')
    for p in has_sent:
        f.write(p + '\n')

    return inventory_mtime


if __name__ == '__main__':
    from twisted.internet.app import Application

    import darcsbot

    try:
        channel = sys.argv[1]
    except:
        channel = CHANNEL

    botf = darcsbot.BotFactory(NICK, channel)

    app = Application("darcsbot")

    app.connectTCP(IRC_SERVER, 6667, botf)
    app.run()