diff options
author | George Hazan <ghazan@miranda.im> | 2022-10-20 22:10:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-10-20 22:10:25 +0300 |
commit | 51037c1032b29ac1090cf4ecb78f3dce1bda554a (patch) | |
tree | 98e1e0fbc012520797849f2918382094451e4b3f /protocols/WhatsApp/src/proto.h | |
parent | d8a0f722b56a1933761a4148e33e564b3c05c0a4 (diff) |
WhatsApp: correct decoding of patches
Diffstat (limited to 'protocols/WhatsApp/src/proto.h')
-rw-r--r-- | protocols/WhatsApp/src/proto.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 475f564027..38d697f5ee 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -120,8 +120,6 @@ struct WACollection MBinBuffer hash; std::map<std::string, std::string> indexValueMap; - - void parseRecord(const proto::SyncdRecord &rec, bool bSet); }; class WANoise @@ -225,20 +223,26 @@ class WhatsAppProto : public PROTO<WhatsAppProto> friend class WhatsAppProto; WhatsAppProto &m_proto; - CTimer m_keepAlive; - void OnKeepAlive(CTimer *) { - m_proto.SendKeepAlive(); + CTimer m_keepAlive, m_resyncApp; + void OnKeepAlive(CTimer *) + { m_proto.SendKeepAlive(); + } + void OnResync(CTimer *pTimer) + { + pTimer->Stop(); + m_proto.ResyncAll(); } CWhatsAppProtoImpl(WhatsAppProto &pro) : m_proto(pro), - m_keepAlive(Miranda_GetSystemWindow(), UINT_PTR(this)) + m_keepAlive(Miranda_GetSystemWindow(), UINT_PTR(this)), + m_resyncApp(Miranda_GetSystemWindow(), UINT_PTR(this)+1) { m_keepAlive.OnEvent = Callback(this, &CWhatsAppProtoImpl::OnKeepAlive); + m_resyncApp.OnEvent = Callback(this, &CWhatsAppProtoImpl::OnResync); } } m_impl; - bool m_bTerminated, m_bRespawn; ptrW m_tszDefaultGroup; @@ -253,8 +257,10 @@ class WhatsAppProto : public PROTO<WhatsAppProto> // App state management OBJLIST<WACollection> m_arCollections; - void InitCollections(); + void InitCollections(void); + void ParsePatch(WACollection *pColl, const proto::SyncdRecord &rec, bool bSet); void ResyncServer(const OBJLIST<WACollection> &task); + void ResyncAll(void); __forceinline WACollection *FindCollection(const char *pszName) { return m_arCollections.find((WACollection *)&pszName); |