diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-24 19:32:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-24 19:32:56 +0000 |
commit | e26440954f80b88d374559ab7f33821e8c78aa1e (patch) | |
tree | d45ebbc2cb8e52235a239978fc3c680967d07f55 /plugins/Import | |
parent | 93226b428b1b55a28c2af8dec864d597e2971409 (diff) |
another code simplification
git-svn-id: http://svn.miranda-ng.org/main/trunk@1170 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Import')
-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);
|