当前位置: 首页>>代码示例>>C++>>正文


C++ MTP_string函数代码示例

本文整理汇总了C++中MTP_string函数的典型用法代码示例。如果您正苦于以下问题:C++ MTP_string函数的具体用法?C++ MTP_string怎么用?C++ MTP_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MTP_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fullNumber

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));
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:28,代码来源:introphone.cpp

示例2: ApplyArchivedResultFake

// For testing: Just apply random subset or your sticker sets as archived.
bool ApplyArchivedResultFake() {
	auto sets = QVector<MTPStickerSetCovered>();
	for (auto &set : Auth().data().stickerSetsRef()) {
		if ((set.flags & MTPDstickerSet::Flag::f_installed_date)
			&& !(set.flags & MTPDstickerSet_ClientFlag::f_special)) {
			if (rand_value<uint32>() % 128 < 64) {
				const auto data = MTP_stickerSet(
					MTP_flags(set.flags | MTPDstickerSet::Flag::f_archived),
					MTP_int(set.installDate),
					MTP_long(set.id),
					MTP_long(set.access),
					MTP_string(set.title),
					MTP_string(set.shortName),
					MTP_photoSizeEmpty(MTP_string(QString())),
					MTP_int(0),
					MTP_int(set.count),
					MTP_int(set.hash));
				sets.push_back(MTP_stickerSetCovered(
					data,
					MTP_documentEmpty(MTP_long(0))));
			}
		}
	}
	if (sets.size() > 3) {
		sets = sets.mid(0, 3);
	}
	auto fakeResult = MTP_messages_stickerSetInstallResultArchive(
		MTP_vector<MTPStickerSetCovered>(sets));
	ApplyArchivedResult(fakeResult.c_messages_stickerSetInstallResultArchive());
	return true;
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:32,代码来源:stickers.cpp

示例3: showPhoneError

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));
}
开发者ID:aykutalparslan,项目名称:tdesktop,代码行数:26,代码来源:introphone.cpp

示例4: MTP_fileLocationUnavailable

void Application::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId) {
	PreparedPhotoThumbs photoThumbs;
	QVector<MTPPhotoSize> photoSizes;

	QPixmap thumb = QPixmap::fromImage(tosend.scaled(160, 160, Qt::KeepAspectRatio, Qt::SmoothTransformation));
	photoThumbs.insert('a', thumb);
	photoSizes.push_back(MTP_photoSize(MTP_string("a"), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(thumb.width()), MTP_int(thumb.height()), MTP_int(0)));

	QPixmap full = QPixmap::fromImage(tosend);
	photoThumbs.insert('c', full);
	photoSizes.push_back(MTP_photoSize(MTP_string("c"), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)));

	QByteArray jpeg;
	QBuffer jpegBuffer(&jpeg);
	full.save(&jpegBuffer, "JPG", 87);

	PhotoId id = MTP::nonce<PhotoId>();

	MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(MTP::authedId()), MTP_int(unixtime()), MTP_string(""), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes)));

	QString file, filename;
	int32 filesize = 0;
	QByteArray data;

	ReadyLocalMedia ready(ToPreparePhoto, file, filename, filesize, data, id, id, peerId, photo, photoThumbs, MTP_documentEmpty(MTP_long(0)), jpeg);

	connect(App::uploader(), SIGNAL(photoReady(MsgId, const MTPInputFile &)), App::app(), SLOT(photoUpdated(MsgId, const MTPInputFile &)), Qt::UniqueConnection);

	MsgId newId = clientMsgId();
	App::app()->regPhotoUpdate(peerId, newId);
	App::uploader()->uploadMedia(newId, ready);
}
开发者ID:thigas88,项目名称:tdesktop,代码行数:32,代码来源:application.cpp

示例5: MTP_string

void IntroCode::onSendCall() {
	if (!--waitTillCall) {
		callTimer.stop();
		MTP::send(MTPauth_SendCall(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::callDone));
	}
	update();
}
开发者ID:HoTaeWang,项目名称:tdesktop,代码行数:7,代码来源:introcode.cpp

示例6: prepareText

void AddContactBox::onSave() {
	if (_addRequest) return;

	QString firstName = prepareText(_first->getLastText());
	QString lastName = prepareText(_last->getLastText());
	QString phone = _phone->getLastText().trimmed();
	if (firstName.isEmpty() && lastName.isEmpty()) {
		if (_invertOrder) {
			_last->setFocus();
			_last->showError();
		} else {
			_first->setFocus();
			_first->showError();
		}
		return;
	} else if (!_user && !App::isValidPhone(phone)) {
		_phone->setFocus();
		_phone->showError();
		return;
	}
	if (firstName.isEmpty()) {
		firstName = lastName;
		lastName = QString();
	}
	_sentName = firstName;
	if (_user) {
		_contactId = rand_value<uint64>();
		QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_user->phone()), MTP_string(firstName), MTP_string(lastName)));
		_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v), MTP_bool(false)), rpcDone(&AddContactBox::onSaveUserDone), rpcFail(&AddContactBox::onSaveUserFail));
	} else {
		_contactId = rand_value<uint64>();
		QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(phone), MTP_string(firstName), MTP_string(lastName)));
		_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v), MTP_bool(false)), rpcDone(&AddContactBox::onImportDone));
	}
}
开发者ID:Igevorse,项目名称:tdesktop,代码行数:35,代码来源:addcontactbox.cpp

示例7: if

void AddContactBox::onSend() {
	if (_addRequest) return;

	QString firstName = _firstInput.text().trimmed(), lastName = _lastInput.text().trimmed(), phone = _phoneInput.text().trimmed();
	if (firstName.isEmpty() && lastName.isEmpty()) {
		_firstInput.setFocus();
		_firstInput.notaBene();
		return;
	} else if (!_peer && !App::isValidPhone(phone)) {
		_phoneInput.setFocus();
		_phoneInput.notaBene();
		return;
	}
	if (firstName.isEmpty()) {
		firstName = lastName;
		lastName = QString();
	}
	_sentName = firstName;
	if (_peer == App::self()) {
		_addRequest = MTP::send(MTPaccount_UpdateProfile(MTP_string(firstName), MTP_string(lastName)), rpcDone(&AddContactBox::onSaveSelfDone), rpcFail(&AddContactBox::onSaveSelfFail));
	} else if (_peer) {
		if (_peer->chat) {
			_addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(App::chatFromPeer(_peer->id)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail));
		} else {
			_contactId = MTP::nonce<uint64>();
			QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName)));
			_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v), MTP_bool(false)), rpcDone(&AddContactBox::onSaveUserDone), rpcFail(&AddContactBox::onSaveFail));
		}
	} else {
		_contactId = MTP::nonce<uint64>();
		QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(phone), MTP_string(firstName), MTP_string(lastName)));
		_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v), MTP_bool(false)), rpcDone(&AddContactBox::onImportDone));
	}
}
开发者ID:Nnamso,项目名称:tdesktop,代码行数:34,代码来源:addcontactbox.cpp

示例8: MTP_string

void ConfirmPhoneBox::onCallStatusTimer() {
	if (_callStatus.state == CallState::Waiting) {
		if (--_callStatus.timeout <= 0) {
			_callStatus.state = CallState::Calling;
			_callTimer->stop();
			MTP::send(MTPauth_ResendCode(MTP_string(_phone), MTP_string(_phoneHash)), rpcDone(&ConfirmPhoneBox::callDone));
		}
	}
	update();
}
开发者ID:Drru97,项目名称:tdesktop,代码行数:10,代码来源:confirmphonebox.cpp

示例9: setFocus

void IntroCode::onSubmitCode(bool force) {
	if (!force && (code.text() == sentCode || !code.isEnabled())) return;

	code.setDisabled(true);
	setFocus();

	showError("");

	checkRequest.start(1000);

	sentCode = code.text();
	sentRequest = MTP::send(MTPauth_SignIn(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash()), MTP_string(sentCode)), rpcDone(&IntroCode::codeSubmitDone), rpcFail(&IntroCode::codeSubmitFail));
}
开发者ID:HoTaeWang,项目名称:tdesktop,代码行数:13,代码来源:introcode.cpp

示例10: impl_

RSAPublicKey::RSAPublicKey(const char *key) : impl_(new Impl(key)) {
	if (!impl_->rsa) return;

	int nBytes = BN_num_bytes(impl_->rsa->n);
	int eBytes = BN_num_bytes(impl_->rsa->e);
	std::string nStr(nBytes, 0), eStr(eBytes, 0);
	BN_bn2bin(impl_->rsa->n, (uchar*)&nStr[0]);
	BN_bn2bin(impl_->rsa->e, (uchar*)&eStr[0]);

	mtpBuffer tmp;
	MTP_string(nStr).write(tmp);
	MTP_string(eStr).write(tmp);

	uchar sha1Buffer[20];
	impl_->fp = *(uint64*)(hashSha1(&tmp[0], tmp.size() * sizeof(mtpPrime), sha1Buffer) + 3);
}
开发者ID:VBelozyorov,项目名称:tdesktop,代码行数:16,代码来源:rsa_public_key.cpp

示例11: hideError

void PhoneWidget::toSignUp() {
	hideError(); // Hide error, but leave the signup label visible.

	_checkRequest->start(1000);

	_sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(0), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail));
}
开发者ID:absalan,项目名称:tdesktop,代码行数:7,代码来源:introphone.cpp

示例12: setFocus

void ConfirmPhoneBox::onSendCode() {
	if (_sendCodeRequestId) {
		return;
	}
	auto code = _code->getLastText();
	if (code.isEmpty()) {
		_code->showError();
		return;
	}

	_code->setDisabled(true);
	setFocus();

	showError(QString());

	_sendCodeRequestId = MTP::send(MTPaccount_ConfirmPhone(MTP_string(_phoneHash), MTP_string(_code->getLastText())), rpcDone(&ConfirmPhoneBox::confirmDone), rpcFail(&ConfirmPhoneBox::confirmFail));
}
开发者ID:Drru97,项目名称:tdesktop,代码行数:17,代码来源:confirmphonebox.cpp

示例13: disableAll

void IntroPhone::toSignUp() {
	disableAll();
	showError("");

	checkRequest.start(1000);

	sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(0), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Application::language())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
}
开发者ID:JayDi85,项目名称:tdesktop,代码行数:8,代码来源:introphone.cpp

示例14: disableAll

void IntroPhone::toSignUp() {
	disableAll();
	showError(QString());

	checkRequest.start(1000);

	MTPauth_SendCode::Flags flags = 0;
	sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
}
开发者ID:4ker,项目名称:tdesktop,代码行数:9,代码来源:introphone.cpp

示例15: getName

void UsernameBox::onCheck() {
	if (_checkRequest) {
		MTP::cancel(_checkRequest);
	}
	QString name = getName();
	if (name.size() >= MinUsernameLength) {
		_checkUsername = getName();
		_checkRequest = MTP::send(MTPaccount_CheckUsername(MTP_string(name)), rpcDone(&UsernameBox::onCheckDone), rpcFail(&UsernameBox::onCheckFail));
	}
}
开发者ID:09120898371,项目名称:tdesktop,代码行数:10,代码来源:usernamebox.cpp


注:本文中的MTP_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。