diff options
-rw-r--r-- | plugins/Import/src/import.cpp | 16 | ||||
-rw-r--r-- | plugins/Import/src/utils.cpp | 21 |
2 files changed, 16 insertions, 21 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index fe2c4916bf..552beeefc5 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -85,6 +85,22 @@ static int ImportGroups() return nGroups;
}
+HANDLE HContactFromID(char* pszProtoName, char* pszSetting, char* pszID)
+{
+ HANDLE hContact = dstDb->FindFirstContact();
+ while (hContact != NULL) {
+ char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if ( !lstrcmpA(szProto, pszProtoName)) {
+ mir_ptr<char> id( db_get_sa(hContact, pszProtoName, pszSetting));
+ if ( !lstrcmpA(pszID, id))
+ return hContact;
+ }
+
+ hContact = dstDb->FindNextContact(hContact);
+ }
+ return INVALID_HANDLE_VALUE;
+}
+
HANDLE AddContact(HWND hdlgProgress, char* pszProtoName, char* pszUniqueSetting, DBVARIANT* id, TCHAR *nick, TCHAR *group)
{
HANDLE hContact;
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 69489ca087..522a987e02 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -53,27 +53,6 @@ HANDLE HContactFromNumericID(char* pszProtoName, char* pszSetting, DWORD dwID) return INVALID_HANDLE_VALUE;
}
-HANDLE HContactFromID(char* pszProtoName, char* pszSetting, char* pszID)
-{
- DBVARIANT dbv;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL) {
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if ( !lstrcmpA(szProto, pszProtoName)) {
- if (DBGetContactSettingString(hContact, pszProtoName, pszSetting, &dbv) == 0) {
- if (strcmp(pszID, dbv.pszVal) == 0) {
- DBFreeVariant(&dbv);
- return hContact;
- }
- DBFreeVariant(&dbv);
- }
- }
-
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
- }
- return INVALID_HANDLE_VALUE;
-}
-
HANDLE HistoryImportFindContact(HWND hdlgProgress, char* szModuleName, DWORD uin, int addUnknown)
{
HANDLE hContact = HContactFromNumericID(szModuleName, "UIN", uin);
|