def meta_new(self, source, data): """ create a new (extra) connection """ # don't init host/port host = data[0] if len(data) > 1: port = data[1] else: port = 6667 from controller import ircController c = ircController(host) c.run(self.nick, self.ircname, host, port) c.set_handler(self) self.controllers.append(c)
def run(self): # load config? # load scripts? global_cfg = "../rc/mostrc" if os.environ.has_key('MOSTRC'): global_cfg = os.environ['MOSTRC'] config = getCfg() try: config.load(global_cfg) except IOError: print "Failed to load global configuration file." print "Please set the MOSTRC environment variable appropriately." sys.exit() try: config.load_home(".mostrc") except IOError: print "Failed to load user configurationfile." if os.environ.has_key("IRCNICK"): self.nick = os.environ["IRCNICK"] if os.environ.has_key("IRCNAME"): self.ircname = os.environ["IRCNAME"] if os.environ.has_key("IRCSERVER"): server = os.environ["IRCSERVER"] items = string.split(server, ":") self.ircserver=items[0] if len(items) > 1: self.ircport = string.atoi(items[1]) if len(sys.argv) > 1: self.nick = sys.argv[1] if len(sys.argv) > 2: server = sys.argv[2] items = string.split(server, ":") self.ircserver=items[0] if len(items) > 1: self.ircport = string.atoi(items[1]) # create main view. Importing must be done after initial loading of config from view import ircView from controller import ircController, msnController ircView.parse_config() self.view = ircView.getIrcView() self.view.set_handler(self) c1 = ircController(self.ircserver) c1.run(config.globals['servers'].nick, self.ircname, self.ircserver, self.ircport) c1.set_handler(self) self.controllers.append(c1) handle = config('msn.handle', None) password = config('msn.password', None) if handle and password: m1 = msnController(handle, password) m1.run() self.view.mainloop()