diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-09 16:14:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-09 16:14:28 +0000 |
commit | 3e6e572558a049fe8ebb7ac2390e954d12b2c320 (patch) | |
tree | 9b5493ada959c7522c1c05ef5af000a08393baee | |
parent | 50a2be2affae63fc6ba4e7ebb22af563f1f8b867 (diff) |
we don't use cache for statuses anymore
git-svn-id: http://svn.miranda-ng.org/main/trunk@17276 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 31 | ||||
-rw-r--r-- | plugins/TabSRMM/src/contactcache.h | 11 |
2 files changed, 23 insertions, 19 deletions
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index d3f7600f6d..c42ac94347 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -50,7 +50,7 @@ CContactCache::CContactCache(MCONTACT hContact) cc = &ccInvalid; m_szAccount = C_INVALID_ACCOUNT; m_isMeta = false; - m_Valid = false; + m_isValid = false; } /** @@ -66,8 +66,8 @@ void CContactCache::initPhaseTwo() m_szAccount = acc->tszAccountName; } - m_Valid = (cc->szProto != 0 && m_szAccount != 0) ? true : false; - if (m_Valid) { + m_isValid = (cc->szProto != 0 && m_szAccount != 0) ? true : false; + if (m_isValid) { m_isMeta = db_mc_isMeta(cc->contactID) != 0; // don't use cc->IsMeta() here if (m_isMeta) updateMeta(); @@ -110,7 +110,7 @@ void CContactCache::closeWindow() bool CContactCache::updateNick() { bool fChanged = false; - if (m_Valid) { + if (m_isValid) { wchar_t *tszNick = pcli->pfnGetContactDisplayName(getActiveContact(), 0); if (tszNick && mir_wstrcmp(m_szNick, tszNick)) fChanged = true; @@ -126,7 +126,7 @@ bool CContactCache::updateNick() */ void CContactCache::updateMeta() { - if (m_Valid) { + if (m_isValid) { MCONTACT hOldSub = m_hSub; m_hSub = db_mc_getSrmmSub(cc->contactID); m_szMetaProto = GetContactProto(m_hSub); @@ -156,7 +156,7 @@ bool CContactCache::updateUIN() { m_szUIN[0] = 0; - if (m_Valid) { + if (m_isValid) { ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, getActiveContact(), getActiveProto())); if (uid != NULL) wcsncpy_s(m_szUIN, uid, _TRUNCATE); @@ -390,12 +390,13 @@ void CContactCache::releaseAlloced() */ void CContactCache::deletedHandler() { - m_Valid = false; + cc = &ccInvalid; + m_isValid = false; if (m_hwnd) ::SendMessage(m_hwnd, WM_CLOSE, 1, 2); releaseAlloced(); - m_hContact = (MCONTACT)-1; + m_hContact = INVALID_CONTACT_ID; } /** @@ -416,7 +417,7 @@ void CContactCache::updateFavorite() */ void CContactCache::updateStatusMsg(const char *szKey) { - if (!m_Valid) + if (!m_isValid) return; MCONTACT hContact = getActiveContact(); @@ -573,9 +574,9 @@ size_t CContactCache::getMaxMessageLength() return m_nMax; } -bool CContactCache::updateStatus(int iStatus)
-{
- m_iOldStatus = m_iStatus;
- m_iStatus = iStatus;
- return m_iOldStatus != iStatus;
-}
+bool CContactCache::updateStatus(int iStatus) +{ + m_iOldStatus = m_iStatus; + m_iStatus = iStatus; + return m_iOldStatus != iStatus; +} diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index a469b4b6a5..1ec1e40221 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -57,15 +57,13 @@ struct TSessionStats { struct CContactCache : public MZeroedObject
{
- CContactCache() {}
CContactCache(MCONTACT hContact);
~CContactCache()
{
releaseAlloced();
}
- __forceinline bool isValid() const { return m_Valid; }
- __forceinline int getStatus() const { return m_iStatus; }
+ __forceinline bool isValid() const { return m_isValid; }
__forceinline int getActiveStatus() const { return m_isMeta ? m_iMetaStatus : getStatus(); }
__forceinline int getOldStatus() const { return m_iOldStatus; }
__forceinline LPCWSTR getNick() const { return m_szNick; }
@@ -94,6 +92,11 @@ struct CContactCache : public MZeroedObject __forceinline TWindowData* getDat() const { return m_dat; }
+ int getStatus(void) const
+ {
+ return db_get_w(m_hContact, cc->szProto, "Status", ID_STATUS_OFFLINE);
+ }
+
size_t getMaxMessageLength();
void updateStats(int iType, size_t value = 0);
@@ -136,7 +139,7 @@ private: BYTE m_xStatus;
DWORD m_idleTS;
bool m_isMeta;
- bool m_Valid;
+ bool m_isValid;
bool m_isFavorite;
bool m_isRecent;
HWND m_hwnd;
|