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


C++ UserData::setBotInfo方法代码示例

本文整理汇总了C++中UserData::setBotInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ UserData::setBotInfo方法的具体用法?C++ UserData::setBotInfo怎么用?C++ UserData::setBotInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserData的用法示例。


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

示例1: gotChatFull

void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
    const MTPDmessages_chatFull &d(result.c_messages_chatFull());
    const MTPDchatFull &f(d.vfull_chat.c_chatFull());

    const QVector<MTPChat> &vc(d.vchats.c_vector().v);
    bool badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version);

    App::feedUsers(d.vusers, false);
    App::feedChats(d.vchats, false);
    App::feedParticipants(f.vparticipants, false, false);
    const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v);
    for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) {
        switch (i->type()) {
        case mtpc_botInfo: {
            const MTPDbotInfo &b(i->c_botInfo());
            UserData *user = App::userLoaded(b.vuser_id.v);
            if (user) {
                user->setBotInfo(*i);
                App::clearPeerUpdated(user);
                emit fullPeerUpdated(user);
            }
        }
        break;
        }
    }
    PhotoData *photo = App::feedPhoto(f.vchat_photo);
    ChatData *chat = peer->asChat();
    if (chat) {
        if (photo) {
            chat->photoId = photo->id;
            photo->chat = chat;
        } else {
            chat->photoId = 0;
        }
        chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString();
    }

    App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings);

    _fullPeerRequests.remove(peer);
    if (badVersion) {
        peer->asChat()->version = vc.at(0).c_chat().vversion.v;
        requestPeer(peer);
    }
    App::clearPeerUpdated(peer);
    emit fullPeerUpdated(peer);
    App::emitPeerUpdated();
}
开发者ID:sseshachala,项目名称:tdesktop,代码行数:48,代码来源:apiwrap.cpp

示例2: gotChatFull

void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mtpRequestId req) {
	const MTPDmessages_chatFull &d(result.c_messages_chatFull());
	const QVector<MTPChat> &vc(d.vchats.c_vector().v);
	bool badVersion = false;
	if (peer->isChat()) {
		badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version);
	} else if (peer->isChannel()) {
		badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_channel && vc.at(0).c_channel().vversion.v < peer->asChannel()->version);
	}

	App::feedUsers(d.vusers, false);
	App::feedChats(d.vchats, false);

	if (peer->isChat()) {
		if (d.vfull_chat.type() != mtpc_chatFull) {
			LOG(("MTP Error: bad type in gotChatFull for chat: %1").arg(d.vfull_chat.type()));
			return;
		}
		const MTPDchatFull &f(d.vfull_chat.c_chatFull());
		App::feedParticipants(f.vparticipants, false, false);
		const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v);
		for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) {
			switch (i->type()) {
			case mtpc_botInfo: {
				const MTPDbotInfo &b(i->c_botInfo());
				UserData *user = App::userLoaded(b.vuser_id.v);
				if (user) {
					user->setBotInfo(*i);
					App::clearPeerUpdated(user);
					emit fullPeerUpdated(user);
				}
			} break;
			}
		}
		PhotoData *photo = App::feedPhoto(f.vchat_photo);
		ChatData *chat = peer->asChat();
		if (photo) {
			chat->photoId = photo->id;
			photo->peer = chat;
		} else {
			chat->photoId = 0;
		}
		chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString();

		App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings);
	} else if (peer->isChannel()) {
		if (d.vfull_chat.type() != mtpc_channelFull) {
			LOG(("MTP Error: bad type in gotChatFull for channel: %1").arg(d.vfull_chat.type()));
			return;
		}
		const MTPDchannelFull &f(d.vfull_chat.c_channelFull());
		PhotoData *photo = App::feedPhoto(f.vchat_photo);
		ChannelData *channel = peer->asChannel();
		channel->flagsFull = f.vflags.v;
		if (photo) {
			channel->photoId = photo->id;
			photo->peer = channel;
		} else {
			channel->photoId = 0;
		}
		if (f.has_migrated_from_chat_id()) {
			if (!channel->mgInfo) {
				channel->flags |= MTPDchannel::flag_megagroup;
				channel->flagsUpdated();
			}
			ChatData *cfrom = App::chat(peerFromChat(f.vmigrated_from_chat_id));
			bool updatedTo = (cfrom->migrateToPtr != channel), updatedFrom = (channel->mgInfo->migrateFromPtr != cfrom);
			if (updatedTo) {
				cfrom->migrateToPtr = channel;
			}
			if (updatedFrom) {
				channel->mgInfo->migrateFromPtr = cfrom;
				if (History *h = App::historyLoaded(cfrom->id)) {
					if (History *hto = App::historyLoaded(channel->id)) {
						if (!h->isEmpty()) {
							h->clear(true);
						}
						if (!hto->dialogs.isEmpty() && !h->dialogs.isEmpty()) {
							App::removeDialog(h);
						}
					}
				}
				Notify::migrateUpdated(channel);
			}
			if (updatedTo) {
				Notify::migrateUpdated(cfrom);
				App::main()->peerUpdated(cfrom);
			}
		}
		const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v);
		for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) {
			switch (i->type()) {
			case mtpc_botInfo: {
				const MTPDbotInfo &b(i->c_botInfo());
				UserData *user = App::userLoaded(b.vuser_id.v);
				if (user) {
					user->setBotInfo(*i);
					App::clearPeerUpdated(user);
					emit fullPeerUpdated(user);
				}
//.........这里部分代码省略.........
开发者ID:MobinRanjbar,项目名称:tdesktop,代码行数:101,代码来源:apiwrap.cpp


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