From ba19b70f9a12bf7e3c51d44bd0a3ca787da43ffc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Oct 2023 13:15:07 +0300 Subject: =?UTF-8?q?fixes=20#3730=20(YAMN:=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D0=B0=20=D0=B2=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B7=D0=B5=20=D0=BD=D0=B5=D1=82,=20=D0=BF=D0=BB?= =?UTF-8?q?=D0=B0=D0=B3=D0=B8=D0=BD=20=D0=BD=D0=B0=D1=87=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20=D0=B3=D0=BB=D1=8E=D1=87=D0=B8=D1=82=D1=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/YAMN/src/proto/pop3/pop3comm.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'protocols/YAMN/src/proto/pop3') diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index c336fe155d..c734847ff5 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -216,29 +216,16 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) break; } - for (CAccount *Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { - Finder->hContact = NULL; + for (CAccount *pAcc = POP3Plugin->FirstAccount; pAcc; pAcc = pAcc->Next) { + pAcc->hContact = 0; for (auto &hContact : Contacts(YAMN_DBMODULE)) { - if (g_plugin.getMStringA(hContact, "Id") == Finder->Name) { - Finder->hContact = hContact; - g_plugin.setWord(Finder->hContact, "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)) - Contact::Hide(Finder->hContact, false); - - if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT)) - Contact::Hide(Finder->hContact); + if (g_plugin.getMStringA(hContact, "Id") == pAcc->Name) { + pAcc->hContact = hContact; + break; } } - if (!Finder->hContact && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { - // No account contact found, have to create one - Finder->hContact = db_add_contact(); - Proto_AddToContact(Finder->hContact, YAMN_DBMODULE); - g_plugin.setString(Finder->hContact, "Id", Finder->Name); - g_plugin.setString(Finder->hContact, "Nick", Finder->Name); - g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_OFFLINE); - } + pAcc->RefreshContact(); } return 0; @@ -321,7 +308,7 @@ HYAMNMAIL MIR_CDECL CreatePOP3Mail(CAccount *Account) static void SetContactStatus(CAccount *account, int status) { - if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)) + if (account->NewMailN.Flags & YAMN_ACC_CONT) g_plugin.setWord(account->hContact, "Status", status); } -- cgit v1.2.3