def Main(): conf = None queue = None email = None user = None id = None # retrieve the argument. if len(sys.argv) != 2: Usage() # set the id. id = sys.argv[1] # retrieve a configuration object. conf = ems.Configuration(id) if conf.Load() == ems.StatusError: ems.Misc.Log("[ems::error] unable to load the configuration file '" + id + "'") sys.exit(0) # retrive the queue object. queue = ems.Queue(id) if queue.Load() == ems.StatusError: ems.Misc.Log("[ems::error] unable to load the queue file '" + id + "'") sys.exit(0) # retrieve the email. email = ems.Email() if email.Catch() == ems.StatusError: ems.Misc.Log("[ems::error] unable to catch the incoming email") sys.exit(0) # try to confirm an action. Confirm(conf, queue, email) # update both the configuration and the queue. if queue.Store() == ems.StatusError: ems.Misc.Log( "[ems::error] an error occured while storing the queue file") sys.exit(0) if conf.Store() == ems.StatusError: ems.Misc.Log( "[ems::error] an error occured while storing the queue file") sys.exit(0)
def Main(): conf = None file = None id = None emails = None # retrieve the argument. if len(sys.argv) != 3: Usage() id = sys.argv[1] file = sys.argv[2] # check if the mailing-list already exist and create it if not. if os.path.exists(ems.ListsLocation + id) == False: sys.stderr.write( "[ems::error] the mailing-list does not seem to exist\n") sys.exit(1) # create a configuration object. conf = ems.Configuration(id) # load the configuration object. if conf.Load() == ems.StatusError: sys.stderr.write( "[ems::error] an error occured while loading the conf file\n") sys.exit(1) # extract the emails from the given file. emails = Extract(file) # insert the emails. Insert(conf, emails) # finally store the modifications applied on to the configuration. if conf.Store() == ems.StatusError: ems.Misc.Log( "[ems::error] an error occured while storing the queue file") sys.exit(0)