diff options
author | George Hazan <ghazan@miranda.im> | 2020-01-29 21:32:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-01-29 21:32:51 +0300 |
commit | ca553c73ad639dbcbc2b470ec3d8f3a6473b3d53 (patch) | |
tree | 389233c512a71b41ade366d927cadf332ab8edc8 /protocols | |
parent | 22985cfd94e02d1308b1facd22359c863dcf8aba (diff) |
fixes #2039 (Jabber: реализовать обновление LastGetVCard не только при запуске)
Diffstat (limited to 'protocols')
-rwxr-xr-x | protocols/JabberG/src/jabber_iqid.cpp | 6 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 1 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.h | 28 |
3 files changed, 30 insertions, 5 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index c0b5f66d48..64ca5d58c1 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -210,9 +210,11 @@ void CJabberProto::OnLoggedIn() SendGetVcard(0);
}
else {
- time_t lastReadVcard(getDword("LastGetVcard"));
- if (time(0) - lastReadVcard > 84600) // read vcard on login once a day
+ time_t elapsed = time(0) - getDword("LastGetVcard");
+ if (elapsed > 84600) // read vcard on login once a day
SendGetVcard(0);
+ else
+ m_impl.m_heartBeat.Start(elapsed * 1000);
}
m_pepServices.ResetPublishAll();
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 03afdf9043..513a9dfd8f 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -54,6 +54,7 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
PROTO<CJabberProto>(aProtoName, aUserName),
+ m_impl(*this),
m_omemo(this),
m_lstTransports(50, compareTransports),
m_lstRoster(50, compareListItems),
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index eab240ce21..20e6a34ee0 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -64,8 +64,30 @@ struct TFilterInfo struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
{
- CJabberProto(const char*, const wchar_t*);
- ~CJabberProto();
+ class CJabberProtoImpl
+ {
+ friend struct CJabberProto;
+ CJabberProto &m_proto;
+
+ CTimer m_heartBeat;
+ void OnHeartBeat(CTimer *pTimer)
+ {
+ m_proto.SendGetVcard(0);
+
+ pTimer->Stop();
+ pTimer->Start(86400 * 1000);
+ }
+
+ CJabberProtoImpl(CJabberProto &pro) :
+ m_proto(pro),
+ m_heartBeat(Miranda_GetSystemWindow(), UINT_PTR(this))
+ {
+ m_heartBeat.OnEvent = Callback(this, &CJabberProtoImpl::OnHeartBeat);
+ }
+ } m_impl;
+
+ CJabberProto(const char *, const wchar_t *);
+ ~CJabberProto();
//====================================================================================
// PROTO_INTERFACE
@@ -243,7 +265,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface CPrivacyListManager m_privacyListManager;
CJabberSDManager m_SDManager;
- //HWND m_hwndConsole;
+ // xml console
CJabberDlgBase *m_pDlgConsole;
HANDLE m_hThreadConsole;
UINT m_dwConsoleThreadId;
|