Beispiel #1
0
 def startshell(self, connect=True):
     """ start the console bot. """
     self.start(False)
     while not self.stopped:
         try:
             input = console.raw_input("\n> ")
             if self.stopped: return
             event = ConsoleEvent()
             event.parse(self, input, console)
             event.nooutput = True
             event.nodispatch = False
             e = self.put(event)
             res = e.wait()
             if res:
                 for r in res:
                     txt = self.makeresponse(r, dot="<br>")
                     self.out(e.userhost, txt, plugorigin=e.plugorigin)
             mainhandler.handle_one()
         except IOError:
             break
         except NoInput:
             continue
         except (KeyboardInterrupt, EOFError):
             break
         except Exception, ex:
             handle_exception()
Beispiel #2
0
def mainloop():
    """ function to be used as mainloop. """
    while 1:
        try:
            time.sleep(1)
            mainhandler.handle_one()
        except KeyboardInterrupt: break
        except Exception, ex:
            handle_exception()
            break
Beispiel #3
0
def mainloop():
    """ function to be used as mainloop. """
    while 1:
        try:
            time.sleep(1)
            mainhandler.handle_one()
        except KeyboardInterrupt:
            break
        except Exception, ex:
            handle_exception()
            break
Beispiel #4
0
 def startshell(self, connect=True):
     """ start the console bot. """
     self.start(False)
     while not self.stopped: 
         try: 
             input = console.raw_input("\n> ")
             if self.stopped: return
             event = ConsoleEvent()
             event.parse(self, input, console)
             event.nooutput = True
             event.nodispatch = False
             e = self.put(event)
             res = e.wait()
             if res:
                 for r in res: print self.normalize(r)
             mainhandler.handle_one()
         except NoInput: continue
         except (KeyboardInterrupt, EOFError): break
         except Exception, ex: handle_exception()
     console.save_history()
Beispiel #5
0
 def startshell(self, connect=True):
     """ start the console bot. """
     self.start(False)
     while not self.stopped: 
         try: 
             input = console.raw_input("\n> ")
             if self.stopped: return
             event = ConsoleEvent()
             event.parse(self, input, console)
             event.nooutput = True
             event.nodispatch = False
             e = self.put(event)
             res = e.wait()
             if res:
                 for r in res:
                     txt = self.makeresponse(r, dot="<br>")
                     self.out(e.userhost, txt, plugorigin=e.plugorigin)
             mainhandler.handle_one()
         except IOError: break
         except NoInput: continue
         except (KeyboardInterrupt, EOFError): break
         except Exception, ex: handle_exception()
     console.save_history()
Beispiel #6
0
 def startshell(self, connect=True):
     """ start the console bot. """
     self.start(False)
     while not self.stopped: 
         try: 
             input = console.raw_input("%s -=- %s%s< %s" % (time.strftime(self.datefmt), self.BOLD, self.YELLOW, self.ENDC))
             if self.stopped: return
             event = ConsoleEvent()
             event.parse(self, input, console)
             event.nooutput = True
             event.nodispatch = False
             e = self.put(event)
             res = e.wait()
             if res:
                 for r in res:
                     txt = self.makeresponse(r, dot="<br>")
                     txt = self.normalize(txt)
                     self.out(e.userhost, txt, plugorigin=e.plugorigin)
             mainhandler.handle_one()
         except IOError: break
         except NoInput: continue
         except (KeyboardInterrupt, EOFError): break
         except Exception, ex: handle_exception()
     console.save_history()