From 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Apr 2013 21:40:22 +0000 Subject: - the kernel filters out contacts by proto names much faster than a plugin; - database cycles simplified git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/YAMN/src/proto/pop3/pop3comm.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'plugins/YAMN') diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index dcb2d55b59..da50c74b56 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -278,23 +278,19 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) for (Finder=POP3Plugin->FirstAccount;Finder != NULL;Finder=Finder->Next) { Finder->hContact = NULL; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - szProto = GetContactProto(hContact); - if (szProto != NULL && strcmp(szProto, YAMN_DBMODULE)==0) - { - if (!db_get_s(hContact,YAMN_DBMODULE,"Id",&dbv)) { - if ( strcmp( dbv.pszVal, Finder->Name) == 0) { - Finder->hContact = hContact; - db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE); - db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message")); - if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) - db_unset(Finder->hContact, "CList", "Hidden"); - - if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT)) - db_set_b(Finder->hContact, "CList", "Hidden", 1); - } - db_free(&dbv); + for (HANDLE hContact = db_find_first(YAMN_DBMODULE); hContact; hContact = db_find_next(hContact, YAMN_DBMODULE)) { + if (!db_get_s(hContact,YAMN_DBMODULE,"Id",&dbv)) { + if ( strcmp( dbv.pszVal, Finder->Name) == 0) { + Finder->hContact = hContact; + db_set_w(Finder->hContact, YAMN_DBMODULE, "Status", ID_STATUS_ONLINE); + db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message")); + if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) + db_unset(Finder->hContact, "CList", "Hidden"); + + if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT)) + db_set_b(Finder->hContact, "CList", "Hidden", 1); } + db_free(&dbv); } } -- cgit v1.2.3