diff options
Diffstat (limited to 'plugins/Import/src/utils.cpp')
| -rw-r--r-- | plugins/Import/src/utils.cpp | 30 | 
1 files changed, 14 insertions, 16 deletions
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 1795b3b2c8..397f5df370 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -83,15 +83,13 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  	HANDLE hExistingDbEvent;
  	DWORD dwEventTimeStamp;
 -	DBEVENTINFO dbeiExisting;
  	// get last event
 -	if (!(hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0)))
 +	if (!(hExistingDbEvent = db_event_last(hContact)))
  		return FALSE;
 -	ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
 -	dbeiExisting.cbSize = sizeof(dbeiExisting);
 -	CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
 +	DBEVENTINFO dbeiExisting = { sizeof(dbeiExisting) };
 +	db_event_get(hExistingDbEvent, &dbeiExisting);
  	dwEventTimeStamp = dbeiExisting.timestamp;
  	// compare with last timestamp
 @@ -109,12 +107,12 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  		dwPreviousTimeStamp = dwEventTimeStamp;
  		// get first event
 -		if (!(hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0)))
 +		if (!(hExistingDbEvent = db_event_first(hContact)))
  			return FALSE;
  		ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
  		dbeiExisting.cbSize = sizeof(dbeiExisting);
 -		CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
 +		db_event_get(hExistingDbEvent, &dbeiExisting);
  		dwEventTimeStamp = dbeiExisting.timestamp;
  		// compare with first timestamp
 @@ -132,20 +130,20 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  	if (dbei.timestamp == dwPreviousTimeStamp) {
  		ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
  		dbeiExisting.cbSize = sizeof(dbeiExisting);
 -		CallService(MS_DB_EVENT_GET, (WPARAM)hPreviousDbEvent, (LPARAM)&dbeiExisting);
 +		db_event_get(hPreviousDbEvent, &dbeiExisting);
  		if ((dbei.timestamp == dbeiExisting.timestamp) &&
  			(dbei.eventType == dbeiExisting.eventType) &&
  			(dbei.cbBlob == dbeiExisting.cbBlob) &&
 -			((dbei.flags&DBEF_SENT) == (dbeiExisting.flags&DBEF_SENT)))
 +			((dbei.flags & DBEF_SENT) == (dbeiExisting.flags & DBEF_SENT)))
  			return TRUE;
  		// find event with another timestamp
 -		hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hPreviousDbEvent, 0);
 +		hExistingDbEvent = db_event_next(hPreviousDbEvent);
  		while (hExistingDbEvent != NULL) {
  			ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
  			dbeiExisting.cbSize = sizeof(dbeiExisting);
 -			CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
 +			db_event_get(hExistingDbEvent, &dbeiExisting);
  			if (dbeiExisting.timestamp != dwPreviousTimeStamp) {
  				// use found event
 @@ -155,7 +153,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  			}
  			hPreviousDbEvent = hExistingDbEvent;
 -			hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hExistingDbEvent, 0);
 +			hExistingDbEvent = db_event_next(hExistingDbEvent);
  		}
  	}
 @@ -166,7 +164,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  		while (hExistingDbEvent != NULL) {
  			ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
  			dbeiExisting.cbSize = sizeof(dbeiExisting);
 -			CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
 +			db_event_get(hExistingDbEvent, &dbeiExisting);
  			if (dbei.timestamp > dbeiExisting.timestamp) {
  				// remember event
 @@ -188,7 +186,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  			}
  			// Get previous event in chain
 -			hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hExistingDbEvent, 0);
 +			hExistingDbEvent = db_event_prev(hExistingDbEvent);
  		}
  	}
  	else {
 @@ -196,7 +194,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  		while (hExistingDbEvent != NULL) {
  			ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
  			dbeiExisting.cbSize = sizeof(dbeiExisting);
 -			CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
 +			db_event_get(hExistingDbEvent, &dbeiExisting);
  			if (dbei.timestamp < dbeiExisting.timestamp) {
  				// remember event
 @@ -218,7 +216,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei)  			}
  			// Get next event in chain
 -			hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hExistingDbEvent, 0);
 +			hExistingDbEvent = db_event_next(hExistingDbEvent);
  		}
  	}
  	// reset last event
  | 
