Example #1
0
 def handle_input (self, line_num, names, names_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         for n in names:
             names_dict[n].append ("1\n")
         del names[self.name]
     else:
         self.handle_wrong_input (line_num, names, names_dict)
Example #2
0
 def handle_input (self, line_num, names, names_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         names_dict[self.name].append ("{}\n".format (3 * len (names.keys ())))
         for n in names:
             names_dict[n].append ("S {}\n".format (line_num))
     else:
         self.handle_wrong_input (line_num, names, names_dict)
Example #3
0
 def handle_input (self, line_num, names, names_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         name_list = [n for n in names.keys ()]
         for n in name_list:
             names_dict[n].append ("1\n")
             del names[n]
     else:
         self.handle_wrong_input (line_num, names, names_dict)
Example #4
0
 def handle_command (self, names, file_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         name_list = [n for n in names.keys ()]
         for n in name_list:
             file_dict[n].write ("{}Server has disconnected\n".format (prefix))
             del names[n]
     else:
         self.handle_wrong_args (file_dict)
Example #5
0
 def handle_command (self, names, file_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         actual_name = names[self.name].name
         del names[self.name]
         for n in names.keys():
             file_dict[n].write ("{}{} has left\n{}".format (prefix, actual_name, suffix))
         file_dict[self.name].write ("{}You have left\n".format (prefix))
     else:
         self.handle_wrong_args (file_dict)
Example #6
0
 def handle_command (self, names, file_dict):
     arg_match = no_args.match (self.args)
     if arg_match:
         names_dict = {value.name : name for name, value in names.items ()}
         names_list = list (names_dict.keys ())
         names_list.sort ()
         for new_name in names_list:
             self.output_status_info (file_dict, names_dict[new_name], names)
     else:
         self.handle_wrong_args (file_dict)