diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-18 18:55:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-18 18:55:32 +0000 |
commit | ffed014ccd5370a5073594d55dd0dc88080e0b3d (patch) | |
tree | 6d8c5c00d7d5e22607e55aa5ce73c1e2b8139044 /plugins/Dbx_mdb | |
parent | cdad72e9512d163ed15bc89bd0a93e7da2ee4c50 (diff) |
contacts cache details to be completely hidden from the outside world
git-svn-id: http://svn.miranda-ng.org/main/trunk@11873 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r-- | plugins/Dbx_mdb/src/dbcontacts.cpp | 15 | ||||
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 6 | ||||
-rw-r--r-- | plugins/Dbx_mdb/src/dbintf.h | 14 |
3 files changed, 26 insertions, 9 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index cf13a782b9..14267ab9ff 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -46,6 +46,11 @@ STDMETHODIMP_(LONG) CDbxMdb::GetContactCount(void) return m_contactCount;
}
+STDMETHODIMP_(LONG) CDbxMdb::GetContactSize(void)
+{
+ return sizeof(DBCachedContact);
+}
+
STDMETHODIMP_(MCONTACT) CDbxMdb::FindFirstContact(const char *szProto)
{
mir_cslock lck(m_csDbAccess);
@@ -102,9 +107,8 @@ STDMETHODIMP_(MCONTACT) CDbxMdb::AddContact() {
DWORD dwContactId;
- DBContact dbc;
+ DBContact dbc = { 0 };
dbc.signature = DBCONTACT_SIGNATURE;
- dbc.eventCount = 0;
{
mir_cslock lck(m_csDbAccess);
dwContactId = m_dwMaxContactId++;
@@ -119,8 +123,7 @@ STDMETHODIMP_(MCONTACT) CDbxMdb::AddContact() break;
}
- DBCachedContact *cc = m_cache->AddContactToCache(dwContactId);
- cc->dwDriverData = 0;
+ m_cache->AddContactToCache(dwContactId);
}
NotifyEventHooks(hContactAddedEvent, dwContactId, 0);
@@ -185,7 +188,9 @@ void CDbxMdb::FillContacts() DatabaseCorruption(NULL);
DBCachedContact *cc = m_cache->AddContactToCache(*(DWORD*)key.mv_data);
- cc->dwDriverData = dbc->eventCount;
+ cc->dwEventCount = dbc->eventCount;
+ cc->dwFirstUnread = dbc->dwFirstUnread;
+ cc->tsFirstUnread = dbc->tsFirstUnread;
arContacts.insert(cc);
}
}
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 5db1d6714b..720956817d 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -35,7 +35,7 @@ STDMETHODIMP_(LONG) CDbxMdb::GetEventCount(MCONTACT contactID) return m_header.eventCount;
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- return (cc == NULL) ? 0 : cc->dwDriverData;
+ return (cc == NULL) ? 0 : cc->dwEventCount;
}
STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
@@ -106,7 +106,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) return 0;
if (contactID != NULL) {
- DBContact dbc = { DBCONTACT_SIGNATURE, ++cc->dwDriverData };
+ DBContact dbc = { DBCONTACT_SIGNATURE, ++cc->dwEventCount };
MDB_val keyc = { sizeof(int), &contactID }, datac = { sizeof(DBContact), &dbc };
mdb_put(txn, m_dbContacts, &keyc, &datac, 0);
@@ -115,7 +115,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) key2.dwContactId = ccSub->contactID;
mdb_put(txn, m_dbEventsSort, &key, &data, 0);
- dbc.eventCount = ++ccSub->dwDriverData;
+ dbc.eventCount = ++ccSub->dwEventCount;
keyc.mv_data = &ccSub->contactID;
mdb_put(txn, m_dbContacts, &keyc, &datac, 0);
}
diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h index cf9600eadf..ea3d2feb0f 100644 --- a/plugins/Dbx_mdb/src/dbintf.h +++ b/plugins/Dbx_mdb/src/dbintf.h @@ -21,6 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define OWN_CACHED_CONTACT
+
#include <m_db_int.h>
/* tree diagram
@@ -73,6 +75,8 @@ struct DBContact {
DWORD signature;
DWORD eventCount; // number of events in the chain for this contact
+ DWORD tsFirstUnread;
+ DWORD dwFirstUnread;
};
#define DBMODULENAME_SIGNATURE 0x4DDECADEu
@@ -102,6 +106,13 @@ struct DBEvent #include <poppack.h>
+struct DBCachedContact : public DBCachedContactBase
+{
+ DWORD dwEventCount;
+ DWORD tsFirstUnread;
+ DWORD dwFirstUnread;
+};
+
struct CDbxMdb : public MIDatabase, public MIDatabaseChecker, public MZeroedObject
{
CDbxMdb(const TCHAR *tszFileName, int mode);
@@ -126,7 +137,7 @@ struct CDbxMdb : public MIDatabase, public MIDatabaseChecker, public MZeroedObje __forceinline bool usesPassword() const { return m_bUsesPassword; }
public:
- STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
+ STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
STDMETHODIMP_(LONG) GetContactCount(void);
STDMETHODIMP_(MCONTACT) FindFirstContact(const char *szProto = NULL);
@@ -134,6 +145,7 @@ public: STDMETHODIMP_(LONG) DeleteContact(MCONTACT contactID);
STDMETHODIMP_(MCONTACT) AddContact(void);
STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID);
+ STDMETHODIMP_(LONG) GetContactSize(void);
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID);
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe);
|