diff options
Diffstat (limited to 'plugins/Import')
-rw-r--r-- | plugins/Import/src/import.cpp | 2 | ||||
-rw-r--r-- | plugins/Import/src/utils.cpp | 26 |
2 files changed, 11 insertions, 17 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 43ca275ae6..dca01e591c 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -506,7 +506,7 @@ void ImportMeta(DBCachedContact *ccSrc) for (int i = 0; i < ccSrc->nSubs; i++) {
MCONTACT hDstSub = MapContact(ccSrc->pSubs[i]);
if (db_mc_getMeta(hDstSub) == NULL) // add a sub if needed
- CallService(MS_MC_ADDTOMETA, hDest, hDstSub);
+ CallService(MS_MC_ADDTOMETA, hDstSub, hDest);
}
}
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 8ab913ecf9..84fe165a26 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -36,7 +36,7 @@ bool IsProtocolLoaded(const char *pszProtocolName) // ------------------------------------------------
// Returns 1 if successful and 0 when it fails.
-int CreateGroup(const TCHAR* group, MCONTACT hContact)
+int CreateGroup(const TCHAR *group, MCONTACT hContact)
{
if (group == NULL)
return 0;
@@ -49,22 +49,18 @@ int CreateGroup(const TCHAR* group, MCONTACT hContact) // Check for duplicate & find unused id
char groupIdStr[11];
for (int groupId = 0;; groupId++) {
- DBVARIANT dbv;
itoa(groupId, groupIdStr, 10);
- if (db_get_ts(NULL, "CListGroups", groupIdStr, &dbv))
+ ptrT tszDbGroup(db_get_tsa(NULL, "CListGroups", groupIdStr));
+ if (tszDbGroup == NULL)
break;
- if (!lstrcmp(dbv.ptszVal + 1, tszGrpName + 1)) {
+ if (!lstrcmp((TCHAR*)tszDbGroup+1, tszGrpName+1)) {
if (hContact)
db_set_ts(hContact, "CList", "Group", tszGrpName + 1);
else
AddMessage(LPGENT("Skipping duplicate group %s."), tszGrpName + 1);
-
- db_free(&dbv);
return 0;
}
-
- db_free(&dbv);
}
db_set_ts(NULL, "CListGroups", groupIdStr, tszGrpName);
@@ -90,16 +86,14 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) static MCONTACT hPreviousContact = INVALID_CONTACT_ID;
static HANDLE hPreviousDbEvent = NULL;
- HANDLE hExistingDbEvent;
- DWORD dwEventTimeStamp;
-
// get last event
- if (!(hExistingDbEvent = db_event_last(hContact)))
+ HANDLE hExistingDbEvent = db_event_last(hContact);
+ if (hExistingDbEvent == NULL)
return FALSE;
DBEVENTINFO dbeiExisting = { sizeof(dbeiExisting) };
db_event_get(hExistingDbEvent, &dbeiExisting);
- dwEventTimeStamp = dbeiExisting.timestamp;
+ DWORD dwEventTimeStamp = dbeiExisting.timestamp;
// compare with last timestamp
if (dbei.timestamp > dwEventTimeStamp) {
@@ -129,7 +123,6 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) // remember event
dwPreviousTimeStamp = dwEventTimeStamp;
hPreviousDbEvent = hExistingDbEvent;
-
if (dbei.timestamp != dwEventTimeStamp)
return FALSE;
}
@@ -225,8 +218,9 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) /////////////////////////////////////////////////////////////////////////////////////////
// icons
-static IconItem iconList[] = {
- { LPGEN("Import..."), "import_main", IDI_IMPORT }
+static IconItem iconList[] =
+{
+ { LPGEN("Import..."), "import_main", IDI_IMPORT }
};
HICON GetIcon(int iIconId)
|