def com_addallinchannel(self): users = self.channels[self.channel].users() for i in users: self.adduser(i) self.config["Users"] = self.userdict iohandler.rewriteconfigfile(self.config, self.configpath) return "Added all of the users in %s" % (self.channel)
def com_removenick(self, nick): result = "" if self.userdict.pop(nick): self.config["Users"] = self.userdict iohandler.rewriteconfigfile(self.config, self.configpath) result = "Removed the nick %s" % (nick) else: result = "Could not find the nick %s" % (nick) return result
def com_adduser(self, user): result = "" if(self.adduser(user)): self.config["Users"][user] = user iohandler.rewriteconfigfile(self.config, self.configpath) result = "Added %s to the registered users" % (user) else: result = "%s is already registered" % (user) return result
def com_addnicktouser(self, nick, user): result = "" if self.addnicktouser(nick, user): self.config["Users"][nick] = user iohandler.rewriteconfigfile(self.config, self.configpath) result = "Added the nick \"%s\" to the user \"%s\"" % (nick, user) else: result = "Could not register \"%s\" to \"%s\"" % (nick, user) return result
def com_removeauthedhost(self, host): result = "" if host in self.authedhosts: self.authedhosts.pop(host) self.config["Auth"] = self.authedhosts iohandler.rewriteconfigfile(self.config, self.configpath) result = "Removed %s from authed hosts" % (host) else: result = "Could not find %s in the list of authed hosts" % (host) return result
def com_addauthedhost(self, host): result = "" if host not in self.authedhosts: self.authedhosts.update({host : ""}) self.config.set("Auth", self.authedhosts) iohandler.rewriteconfigfile(self.config, self.configpath) result = "Added %s to authed hosts" % (host) else: result = "%s is already authed" % (host) return result
def com_unignorehost(self, host): result = "" if host in self.ignoredhosts: self.ignoredhosts.pop(host) self.config["Ignored"] = self.ignoredhosts iohandler.rewriteconfigfile(self.config, self.configpath) result = "Now accepting messages from %s" % (host) else: result = "%s was not found in the list of ignored hosts" % (host) return result
def com_ignorehost(self, host): result = "" if host not in self.ignoredhosts: self.ignoredhosts.update({host : ""}) self.config.set("Ignored", host) iohandler.rewriteconfigfile(self.config, self.configpath) result = "Now ignoring messages from %s" % (host) else: result = "%s is already being ignored" % (host) return result
def com_removeuser(self, user): result = "" if user in self.userdict: self.hostdict = {k: v for k, v in self.hostdict.items() if v != self.userdict.get(user)} self.userdict = {k: v for k, v in self.userdict.items() if v != self.userdict.get(user)} self.config["Users"] = self.userdict self.config["Hosts"] = self.hostdict iohandler.rewriteconfigfile(self.config, self.configpath) result = "Removed %s from the user and host list" % (user) else: result = "Could not find %s" % (user) return result