Ejemplo n.º 1
0
def process_conf_sms_xdata(xdata):
	ret_code = False
	fields = validate_conf_sms_xdata(xdata)
	for n in fields:
		if not utils.is_valid_sms_number(n):
			result = i18n.INCORRECT_SMS_NUMBER
			return (False, result)
	return (True, fields)
Ejemplo n.º 2
0
def process_send_sms_xdata(xdata):
	ret_code = False
	fields = validate_send_sms_xdata(xdata)
	if not fields:
		result = i18n.BAD_XDATA
	else:
		number = fields['number']
		text = fields['text']
		translit = fields['translit']
		if utils.is_valid_sms_number(number):
			enc_text = utils.str2win(text)
			if translit=='1':
				enc_text = utils.translit(enc_text)
			if utils.is_valid_sms_text(enc_text):
				ret_code = True
				result = [number, enc_text]
			else:
				result = i18n.TOO_BIG_SMS_TEXT
		else:
			result = i18n.INCORRECT_SMS_NUMBER
	return (ret_code, result)