def command(self, tag, dst, txt): if '%' in txt: self.timestamp = 1 self.timeformat = txt self.user.session.INFO(">> set timestamp format to '%s'" % txt) else: if not hasattr(self, 'inited') and txt == '': pass else: self.timestamp = boolean_from_input(self.timestamp, txt) self.user.session.INFO('>> timestamp display %s' % ("disabled","enabled with format '%s'" % self.timeformat)[self.timestamp]) self.inited = 1
def cmd_SET(self, tag, ctxt, args): opt, val = self.unpack2(args) opt = opt.lower() if len(opt) == 0: opts = list(OPTIONS) opts.sort() for opt in opts: val = getattr(self, opt) if opt in BOOLEAN_OPTIONS: self.INFO("'%s' is %s" % (opt, ('unset', 'set')[val])) else: self.INFO("%s = '%s'" % (opt, val)) elif opt in STRING_OPTIONS: setattr(self, opt, val) self.INFO("Set '%s' to '%s'" % (opt, val)) elif opt in BOOLEAN_OPTIONS: setattr(self, opt, boolean_from_input(getattr(self, opt), val)) self.INFO("%s '%s'" % (('unset', 'set')[val], opt)) else: self.ERROR(ctxt, "Cannot set '%s'" % opt)