diff options
author | George Hazan <george.hazan@gmail.com> | 2014-10-12 19:59:19 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-10-12 19:59:19 +0000 |
commit | 3a4aec44402f1d508703a473502f84d2eb6b03d2 (patch) | |
tree | 88f775656bb83fb04586cc2600e9cc2bcc1108b1 /plugins/Import/src/utils.cpp | |
parent | a79e53790cc9b73c745aea0852f5c82d240613e8 (diff) |
fix for metaimport
git-svn-id: http://svn.miranda-ng.org/main/trunk@10773 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Import/src/utils.cpp')
-rw-r--r-- | plugins/Import/src/utils.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
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)
|