|
本帖最后由 Qter 于 2020-3-25 19:19 编辑
- > LongChat.exe!Dialogs::IndexedList::addToEnd(Dialogs::Key key) 行 24 C++
- LongChat.exe!Dialogs::Entry::addToChatList(Dialogs::Mode list, gsl::not_null<Dialogs::IndexedList *> indexed) 行 156 C++
- LongChat.exe!DialogsInner::createDialog(Dialogs::Key key) 行 1258 C++
- LongChat.exe!DialogsWidget::createDialog(Dialogs::Key key) 行 369 C++
- LongChat.exe!MainWidget::createDialog(Dialogs::Key key) 行 1562 C++
- LongChat.exe!Dialogs::Entry::setChatListExistence(bool exists) 行 97 C++
- LongChat.exe!Dialogs::Entry::updateChatListSortPosition() 行 87 C++
- > LongChat.exe!Dialogs::Entry::setChatListTimeId(int date) 行 146 C++
- LongChat.exe!History::setChatListMessage(HistoryItem * item) 行 2201 C++
- LongChat.exe!History::setChatListMessageFromLast() 行 2267 C++
- LongChat.exe!History::requestChatListMessage() 行 2282 C++
- LongChat.exe!History::setLastMessage(HistoryItem * item) 行 2179 C++
- LongChat.exe!History::addNewItem(gsl::not_null<HistoryItem *> item, bool unread) 行 999 C++
- LongChat.exe!History::addNewToLastBlock(const MTPBoxed<MTPmessage> & msg, NewMessageType type) 行 657 C++
- LongChat.exe!History::addNewMessage(const MTPBoxed<MTPmessage> & msg, NewMessageType type) 行 640 C++
- LongChat.exe!Data::Session::addNewMessage(const MTPBoxed<MTPmessage> & data, NewMessageType type) 行 1465 C++
- LongChat.exe!App::feedMsgs(const QVector<MTPBoxed<MTPmessage>> & msgs, NewMessageType type) 行 225 C++
- LongChat.exe!DialogsWidget::applyReceivedDialogs(const QVector<MTPBoxed<MTPdialog>> & dialogs, const QVector<MTPBoxed<MTPmessage>> & messages) 行 668 C++
- LongChat.exe!DialogsWidget::dialogsReceived(const MTPBoxed<MTPmessages_dialogs> & dialogs, int requestId) 行 550 C++
- LongChat.exe!RPCDoneHandlerOwnedReq<void,DialogsWidget,MTPBoxed<MTPmessages_dialogs>>::operator()(int requestId, const int * from, const int * end) 行 406 C++
- LongChat.exe!MTP::Instance::Private::execCallback(int requestId, const int * from, const int * end) 行 1068 C++
- LongChat.exe!MTP::Instance::execCallback(int requestId, const int * from, const int * end) 行 1710 C++
- LongChat.exe!MTP::internal::Session::tryToReceive() 行 630 C++
复制代码 返回的结果集,其中的Vector<Dialog>为左侧聊天人员列表
messages.dialogsSlice#<font color="#ff0000">71e094f3 </font>count:int dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
其中的Dialog相关字段如下:- dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
复制代码 其对应的发送请求为
messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;
根据发磅请求的id b098aee6 找到对应处理函数
result.insert(mtpc_messages_getDialogs, Serialize_messages_getDialogs);- void Serialize_messages_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, uint32 iflag) {
- auto flag = MTPmessages_getDialogs::Flags::from_raw(iflag);
- if (stage) {
- to.add(",\n").addSpaces(lev);
- } else {
- to.add("{ messages_getDialogs");
- to.add("\n").addSpaces(lev);
- }
- switch (stage) {
- case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- case 1: to.add(" exclude_pinned: "); ++stages.back(); if (flag & MTPmessages_getDialogs::Flag::f_exclude_pinned) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
- case 2: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- case 3: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- case 4: to.add(" offset_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- case 5: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- case 6: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
- default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
- }
- }
复制代码 里面加断点,找到对应的发送时机- LongChat.exe!Serialize_messages_getDialogs(MTPStringLogger & to, int stage, int lev, QVector<unsigned int> & types, QVector<unsigned int> & vtypes, QVector<int> & stages, QVector<int> & flags, const int * start, const int * end, unsigned int iflag) 行 43179 C++
- LongChat.exe!mtpTextSerializeType(MTPStringLogger & to, const int * & from, const int * end, int cons, unsigned int level, int vcons) 行 45824 C++
- LongChat.exe!mtpTextSerializeCore(MTPStringLogger & to, const int * & from, const int * end, unsigned int cons, unsigned int level, int vcons) 行 288 C++
- LongChat.exe!mtpTextSerializeType(MTPStringLogger & to, const int * & from, const int * end, int cons, unsigned int level, int vcons) 行 45826 C++
- LongChat.exe!mtpTextSerialize(const int * & from, const int * end) 行 854 C++
- LongChat.exe!MTP::internal::ConnectionPrivate::sendSecureRequest(MTP::SecureRequest && request, bool needAnyResponse, QReadLocker & lockFinished) 行 3136 C++
- LongChat.exe!MTP::internal::ConnectionPrivate::tryToSend() 行 1042 C++
复制代码 这种方法跟踪不到具体代码中的发送位置
回到scheme.h中找到对些发送结构的定义- class MTPmessages_getDialogs { // RPC method 'messages.getDialogs'
- public:
- enum class Flag : uint32 {
- f_exclude_pinned = (1U << 0),
- MAX_FIELD = (1U << 0),
- };
- using Flags = base::flags<Flag>;
- friend inline constexpr auto is_flag_type(Flag) { return true; };
- bool is_exclude_pinned() const { return vflags.v & Flag::f_exclude_pinned; }
- MTPflags<MTPmessages_getDialogs::Flags> vflags;
- MTPint voffset_date;
- MTPint voffset_id;
- MTPInputPeer voffset_peer;
- MTPint vlimit;
- MTPint vhash;
- MTPmessages_getDialogs() = default;
- MTPmessages_getDialogs(const MTPflags<MTPmessages_getDialogs::Flags> &_flags, MTPint _offset_date, MTPint _offset_id, const MTPInputPeer &_offset_peer, MTPint _limit, MTPint _hash) : vflags(_flags), voffset_date(_offset_date), voffset_id(_offset_id), voffset_peer(_offset_peer), vlimit(_limit), vhash(_hash) {
- }
- uint32 innerLength() const;
- mtpTypeId type() const {
- return mtpc_messages_getDialogs;
- }
- void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getDialogs);
- void write(mtpBuffer &to) const;
- using ResponseType = MTPmessages_Dialogs;
- };
- using MTPmessages_GetDialogs = MTPBoxed<MTPmessages_getDialogs>;
复制代码 在程序中找对 MTPmessages_GetDialogs 的调用
LongChat.exe!DialogsWidget::loadDialogs() 行 967 C++
> LongChat.exe!DialogsWidget::{ctor}::__l2::<lambda>() 行 236 C++
3b9aca24 |
|