Beispiel #1
0
void PhoneWidget::submit() {
	if (_sentRequest || isHidden()) return;

	if (!App::isValidPhone(fullNumber())) {
		showPhoneError(langFactory(lng_bad_phone));
		_phone->setFocus();
		return;
	}

	hidePhoneError();

	_checkRequest->start(1000);

	_sentPhone = fullNumber();
	Messenger::Instance().mtp()->setUserPhone(_sentPhone);
	//_sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(_sentPhone)), rpcDone(&PhoneWidget::phoneCheckDone), rpcFail(&PhoneWidget::phoneSubmitFail));
	_sentRequest = MTP::send(
		MTPauth_SendCode(
			MTP_flags(0),
			MTP_string(_sentPhone),
			MTPBool(),
			MTP_int(ApiId),
			MTP_string(ApiHash)),
		rpcDone(&PhoneWidget::phoneSubmitDone),
		rpcFail(&PhoneWidget::phoneSubmitFail));
}
Beispiel #2
0
void PhoneWidget::submit() {
	if (_sentRequest || isHidden()) return;

	const auto phone = fullNumber();
	if (!AllowPhoneAttempt(phone)) {
		showPhoneError(langFactory(lng_bad_phone));
		_phone->setFocus();
		return;
	}

	hidePhoneError();

	_checkRequest->start(1000);

	_sentPhone = phone;
	Core::App().mtp()->setUserPhone(_sentPhone);
	//_sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(_sentPhone)), rpcDone(&PhoneWidget::phoneCheckDone), rpcFail(&PhoneWidget::phoneSubmitFail));
	_sentRequest = MTP::send(
		MTPauth_SendCode(
			MTP_string(_sentPhone),
			MTP_int(ApiId),
			MTP_string(ApiHash),
			MTP_codeSettings(
				MTP_flags(0),
				MTPstring())),
		rpcDone(&PhoneWidget::phoneSubmitDone),
		rpcFail(&PhoneWidget::phoneSubmitFail));
}
Beispiel #3
0
void PhoneWidget::submit() {
	if (_sentRequest || isHidden()) return;

	if (!App::isValidPhone(fullNumber())) {
		showPhoneError(langFactory(lng_bad_phone));
		_phone->setFocus();
		return;
	}

	hidePhoneError();

	_checkRequest->start(1000);

	_sentPhone = fullNumber();
	_sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(_sentPhone)), rpcDone(&PhoneWidget::phoneCheckDone), rpcFail(&PhoneWidget::phoneSubmitFail));
}
Beispiel #4
0
void IntroPhone::onSubmitPhone() {
	if (sentRequest || isHidden()) return;

	if (!App::isValidPhone(fullNumber())) {
		showError(lang(lng_bad_phone));
		phone.setFocus();
		return;
	}

	disableAll();
	showError(QString());

	checkRequest.start(1000);

	sentPhone = fullNumber();
	sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(sentPhone)), rpcDone(&IntroPhone::phoneCheckDone), rpcFail(&IntroPhone::phoneSubmitFail));
}