示例#1
0
 def run(self):
     opt.parse_options(sys.argv[1:])
     while (True):
         self.print_text_display()
         chan_list = map(lambda x: x.soc, self.tabs)
         # klog("doing select...")
         (rs, _, _) = select.select(chan_list + [sys.stdin], [], [])
         # klog("after select...")
         if len(rs) > 0:
             chan_to_read = rs[0]
             if chan_to_read == sys.stdin:
                 c = sys.stdin.read(1)
                 self.process_input_char(c)
             else:
                 p = self.find_process_from_chan(chan_to_read)
                 m = p.read_message()
                 p.process_message(m)
示例#2
0
 def run(self):
     opt.parse_options(sys.argv[1:])
     while (True):
         self.print_text_display()
         chan_list = map(lambda x: x.soc, self.tabs)
         # klog("doing select...")
         (rs, _, _ ) = select.select(chan_list + [sys.stdin], [], [])
         # klog("after select...")
         if len(rs) > 0:
             chan_to_read = rs[0]
             if chan_to_read == sys.stdin:
                 c = sys.stdin.read(1)
                 self.process_input_char(c)
             else:
                 p = self.find_process_from_chan(chan_to_read)
                 m = p.read_message()
                 p.process_message(m)
示例#3
0
文件: cookie.py 项目: raoariel/quark
    def run(self):
        self.soc = socket.fromfd(int(sys.argv[1]), msg.FAMILY, msg.TYPE)
        self.name = sys.argv[2]

        opt.parse_options(sys.argv[3:])

        try:
            f = open("cookies/" + self.name)
            self.cookie_db = pickle.load(f)
            f.close
        except:
            clog("cookie file loading failed")
            self.cookie_db = {}

        signal.signal(signal.SIGINT, signal_handler)
        while (True):
            m = self.read_message()
            self.process_message(m)
示例#4
0
    def run(self):
        self.soc = socket.fromfd(int(sys.argv[1]), msg.FAMILY, msg.TYPE)
        self.name = sys.argv[2]

        opt.parse_options(sys.argv[3:])

        try:
            f = open("cookies/" + self.name)
            self.cookie_db = pickle.load(f)
            f.close
        except : 
            clog("cookie file loading failed")
            self.cookie_db = {}

        signal.signal(signal.SIGINT, signal_handler)
        while (True):
            m = self.read_message()
            self.process_message(m)