def send_group_sms(MyPager, RECEIVERS=False, CONTACT_CSV_FILE=False, MESSAGE=False): if not MyPager.config()['Login_status']: print '+++++++++++++++++++++++++' print '+| Please login first |+' print '+++++++++++++++++++++++++' return False 'Its like group sms: Send a message to "comma seperated numbers" OR "all contacts in a csv file"' if not CONTACT_CSV_FILE and not RECEIVERS: print """ +---+------+------+------+------+------+------+------+-----+ | Group SMS option: | | m - manually enter some comma seperated receiver numbers | | c - csv file name containing list of contacts | +---+------+------+------+------+------+------+------+-----+ """ option = raw_input('Select your option: ') if option == 'm': RECEIVERS = raw_input("Receivers numbers(comma seperated): ") RECEIVERS = RECEIVERS.split(',') elif option == 'c': CONTACT_CSV_FILE = raw_input("Contact csv file name: ") RECEIVERS = [ contact.split(',')[1] for contact in open(CONTACT_CSV_FILE, 'r') ] elif RECEIVERS: RECEIVERS = RECEIVERS.split(',') elif CONTACT_CSV_FILE: RECEIVERS = [ contact.split(',')[1] for contact in open(CONTACT_CSV_FILE, 'r') ] if not MESSAGE: MESSAGE = raw_input("Your msg: ") length, parts, final_msg = MyPager.check_message_size(MESSAGE) if get_conformation( length, parts, final_msg, SPLIT_OR_TRUNCATE=MyPager.config()['SPLIT_OR_TRUNCATE']) == 'n': print "! sending process stopped.." return False for RECEIVER in RECEIVERS: MyPager.send(RECEIVER, MESSAGE, CONFIRM_BEFORE_SENDING=False) return True
def send_group_sms(MyPager, RECEIVERS=False, CONTACT_CSV_FILE=False, MESSAGE=False): if not MyPager.config()['Login_status']: print '+++++++++++++++++++++++++' print '+| Please login first |+' print '+++++++++++++++++++++++++' return False 'Its like group sms: Send a message to "comma seperated numbers" OR "all contacts in a csv file"' if not CONTACT_CSV_FILE and not RECEIVERS: print """ +---+------+------+------+------+------+------+------+-----+ | Group SMS option: | | m - manually enter some comma seperated receiver numbers | | c - csv file name containing list of contacts | +---+------+------+------+------+------+------+------+-----+ """ option = raw_input('Select your option: ') if option == 'm': RECEIVERS = raw_input("Receivers numbers(comma seperated): ") RECEIVERS = RECEIVERS.split(',') elif option == 'c': CONTACT_CSV_FILE = raw_input("Contact csv file name: ") RECEIVERS = [ contact.split(',')[1] for contact in open(os.path.join(DATA_DIR,CONTACT_CSV_FILE)) ] elif RECEIVERS: RECEIVERS = RECEIVERS.split(',') elif CONTACT_CSV_FILE: RECEIVERS = [ contact.split(',')[1] for contact in open(CONTACT_CSV_FILE,'r') ] if not MESSAGE: MESSAGE = multiline_input("Your msg: ") MyPager.check_message_size(MESSAGE) if get_conformation() == 'n': print "! sending process stopped.." return False for RECEIVER in RECEIVERS: MyPager.send(RECEIVER,MESSAGE,CONFIRM_BEFORE_SENDING = False) #notify_me("Woa!!","Cool.. You did a great job..\n~ Rajiv-Py-Sms") return True
def send_group_sms(MyPager, RECEIVERS=False, CONTACT_CSV_FILE=False, MESSAGE=False): if not MyPager.config()['Login_status']: print '+++++++++++++++++++++++++' print '+| Please login first |+' print '+++++++++++++++++++++++++' return False 'Its like group sms: Send a message to "comma seperated numbers" OR "all contacts in a csv file"' if not CONTACT_CSV_FILE and not RECEIVERS: print """ +---+------+------+------+------+------+------+------+-----+ | Group SMS option: | | m - manually enter some comma seperated receiver numbers | | c - csv file name containing list of contacts | +---+------+------+------+------+------+------+------+-----+ """ option = raw_input('Select your option: ') if option == 'm': RECEIVERS = raw_input("Receivers numbers(comma seperated): ") RECEIVERS = RECEIVERS.split(',') elif option == 'c': CONTACT_CSV_FILE = raw_input("Contact csv file name: ") RECEIVERS = [ contact.split(',')[1] for contact in open(CONTACT_CSV_FILE,'r') ] elif RECEIVERS: RECEIVERS = RECEIVERS.split(',') elif CONTACT_CSV_FILE: RECEIVERS = [ contact.split(',')[1] for contact in open(CONTACT_CSV_FILE,'r') ] if not MESSAGE: MESSAGE = raw_input("Your msg: ") length,parts,final_msg = MyPager.check_message_size(MESSAGE) if get_conformation(length, parts, final_msg,SPLIT_OR_TRUNCATE = MyPager.config()['SPLIT_OR_TRUNCATE'] ) == 'n': print "! sending process stopped.." return False for RECEIVER in RECEIVERS: MyPager.send(RECEIVER,MESSAGE,CONFIRM_BEFORE_SENDING = False) return True