def init(self): if self.irc_client and self.irc_thread: print 'disconnecting' self.irc_thread.live = False helpers.quit(self.irc_client) self.irc_thread.join(10) self.irc_client = None self.irc_thread = None collab_config = self.window.active_view().settings().get("subliminal_collaborator_config", None) irc_host = collab_config['irc']['host'] irc_port = collab_config['irc']['port'] irc_pwd = collab_config['irc']['pwd'] irc_nick = collab_config['irc']['nick'] self.irc_client = IRCClient(CollabMsgHandler, host=irc_host, port=irc_port, nick=irc_nick, passwd=irc_pwd, blocking=True) self.irc_thread = IRCClientThread(self.irc_client) self.irc_thread.start()
def persist_in_background(): client.started = time.time() self.log.info("idling connection to %s for %d seconds" % (key, IRC.timeout)) while client.started + IRC.timeout > time.time() and conn.next(): time.sleep(0.5) self.log.info("disconnecting from %s" % key) del self.active_connections[key] quit_messages = [ "herpderp", "I want to die peacefully in my sleep, like my grandfather.. Not screaming like the passengers in his car.", "Do not argue with an idiot. He will drag you down to his level and beat you with experience.", "If I agreed with you we'd both be wrong.", "The early bird might get the worm, but the second mouse gets the cheese.", "I thought I wanted a career, turns out I just wanted paychecks.", "I didn't say it was your fault, I said I was blaming you.", ] helpers.quit(client, random.choice(quit_messages))
def __init__(self, nick, room="#minions", description="This minion does not have a description."): Thread.__init__(self) self.nick = nick self.description = description self.room = room self.matches = [] def connect_callback(cli): print "Connected." # helpers.join(cli, "#inforum") self.app = IRCApp() self.client = IRCClient(host="irc.imaginarynet.org.uk", port=6667, nick=nick, connect_cb=connect_callback) self.client.command_handler = MyHandler(self, self.msg_handler, self.room) self.app.addClient(self.client) # Default minion commands self.register("GO AWAY", lambda: helpers.quit(self.client), require.name) self.register("WHO ARE YOU", lambda: self.description, require.name)
def quit_dc(self): helpers.quit(self.cli, _pcVersion + " <3")
def _cmd_QUIT(self, nick, mask, chan, arg): """ADMIN: shut down.""" helpers.quit(self.client, 'Shutting down...')
def stop(self): if not self.running: return self.stopping = True helpers.quit(self.client, "Exited")
def handle(self, message): helpers.quit(message.client, "kthxbye")