def handleinput(self, input): """ Nicely handles enqueuing of input events. Also deals with things like CR and LF. Call this method with input that's just been polled from the user. @param input: the raw input from the user @type input: string """ from lyntin import event input = utils.chomp(input) event.InputEvent(input).enqueue()
def _tickfunc(ses): """ Handles executing the command or displaying a message to the user. @param ses: the Session instance @type ses: Session """ am = exported.get_manager("alias") if am: tickaction = am.getAlias(ses, "TICK!!!") if not tickaction: tickaction = am.getAlias(ses, "TICK") if tickaction: event.InputEvent(tickaction, internal=1, ses=ses).enqueue() else: exported.write_message("TICK!!!")
def _tickwarnfunc(ses, warnlen): """ Handles executing the command or displaying a message to the user. @param ses: the Session instance @type ses: Session @param warnlen: the warning length @type warnlen: int """ am = exported.get_manager("alias") if am: tickaction = am.getAlias(ses, "TICKWARN!!!") if not tickaction: tickaction = am.getAlias(ses, "TICKWARN") if tickaction: event.InputEvent(tickaction, internal=1, ses=ses).enqueue() else: exported.write_message("ticker: %d seconds to tick!" % warnlen)