def newServerConnection(self, host, username): account = IRCAccount( "IRC", True, username, "", host, 6667, "") def cbLogOn(client): self.client = client self.addOutputMessage("== Connection to %s established." % (host,)) def ebLogOn(err): self.addOutputMessage("== %s failed: %s" % (host, err.getErrorMessage())) account.logOn(self.ui).addCallbacks(cbLogOn, ebLogOn)
def addaccount(self, ae): gwselection = self.gwlist.getSelectedItem() gw = self.gateways[gwselection] name = gw["ident"].text passwd = gw["passwd"].text host = gw["host"].text port = int(gw["port"].text) autologin = self.autologin.isSelected() acctname = self.acctname.text if gwselection == "Twisted": sname = gw["service"].text perspective = gw["persp"].text self.am.addAccount( PBAccount(acctname, autologin, name, passwd, host, port, [[stype, sname, perspective]])) elif gwselection == "AIM": self.am.addAccount( TOCAccount(acctname, autologin, name, passwd, host, port)) elif gwselection == "IRC": channels = gw["channels"].text self.am.addAccount( IRCAccount(acctname, autologin, name, passwd, host, port, channels)) self.amgui.update() print "Added new account" self.mainframe.dispose()
def create(self, accountName, autoLogin): return IRCAccount( accountName, autoLogin, self.xml.get_widget("ircNick").get_text(), self.xml.get_widget("ircPassword").get_text(), self.xml.get_widget("ircServer").get_text(), int(self.xml.get_widget("ircPort").get_text()), self.xml.get_widget("ircChannels").get_text(), )
def setUp(self): self.account = IRCAccount("Some account", False, "alice", None, "example.com", 6667) self.proto = IRCProto(self.account, StubChatUI(), None) self.transport = StringTransport()