summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Dbx_kv/src/dbevents.cpp7
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp7
-rw-r--r--plugins/Import/src/import.cpp22
3 files changed, 21 insertions, 15 deletions
diff --git a/plugins/Dbx_kv/src/dbevents.cpp b/plugins/Dbx_kv/src/dbevents.cpp
index 72a0f239e7..2d292d1de9 100644
--- a/plugins/Dbx_kv/src/dbevents.cpp
+++ b/plugins/Dbx_kv/src/dbevents.cpp
@@ -51,10 +51,13 @@ STDMETHODIMP_(MEVENT) CDbxKV::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
if (cc->IsSub()) {
ccSub = cc;
+ if ((cc = m_cache->GetCachedContact(cc->parentID)) == NULL)
+ return 0;
+
// set default sub to the event's source
if (!(dbei->flags & DBEF_SENT))
- db_mc_setDefault(cc->parentID, contactID, false);
- contactID = cc->parentID; // and add an event to a metahistory
+ db_mc_setDefault(cc->contactID, contactID, false);
+ contactID = cc->contactID; // and add an event to a metahistory
if (db_mc_isEnabled())
contactNotifyID = contactID;
}
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index d42975e698..5b99500e90 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -51,10 +51,13 @@ STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
if (cc->IsSub()) {
ccSub = cc;
+ if ((cc = m_cache->GetCachedContact(cc->parentID)) == NULL)
+ return 0;
+
// set default sub to the event's source
if (!(dbei->flags & DBEF_SENT))
- db_mc_setDefault(cc->parentID, contactID, false);
- contactID = cc->parentID; // and add an event to a metahistory
+ db_mc_setDefault(cc->contactID, contactID, false);
+ contactID = cc->contactID; // and add an event to a metahistory
if (db_mc_isEnabled())
contactNotifyID = contactID;
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 185760972a..d3b70833e7 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -924,35 +924,35 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
// custom filtering
if (!bSkipThis) {
- BOOL sent = (dbei.flags & DBEF_SENT);
+ bool bIsSent = (dbei.flags & DBEF_SENT) != 0;
if (dbei.timestamp < (DWORD)dwSinceDate)
- bSkipThis = 1;
+ bSkipThis = true;
if (!bSkipThis) {
if (hDst) {
bSkipThis = 1;
switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
- if ((sent ? IOPT_MSGSENT : IOPT_MSGRECV) & nImportOptions)
- bSkipThis = 0;
+ if ((bIsSent ? IOPT_MSGSENT : IOPT_MSGRECV) & nImportOptions)
+ bSkipThis = false;
break;
case EVENTTYPE_FILE:
- if ((sent ? IOPT_FILESENT : IOPT_FILERECV) & nImportOptions)
- bSkipThis = 0;
+ if ((bIsSent ? IOPT_FILESENT : IOPT_FILERECV) & nImportOptions)
+ bSkipThis = false;
break;
case EVENTTYPE_URL:
- if ((sent ? IOPT_URLSENT : IOPT_URLRECV) & nImportOptions)
- bSkipThis = 0;
+ if ((bIsSent ? IOPT_URLSENT : IOPT_URLRECV) & nImportOptions)
+ bSkipThis = false;
break;
default:
- if ((sent ? IOPT_OTHERSENT : IOPT_OTHERRECV) & nImportOptions)
- bSkipThis = 0;
+ if ((bIsSent ? IOPT_OTHERSENT : IOPT_OTHERRECV) & nImportOptions)
+ bSkipThis = false;
break;
}
}
else if (!(nImportOptions & IOPT_SYSTEM))
- bSkipThis = 1;
+ bSkipThis = true;
}
if (bSkipThis)