diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-16 13:15:07 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-16 13:15:07 +0300 |
commit | ba19b70f9a12bf7e3c51d44bd0a3ca787da43ffc (patch) | |
tree | f84d0695264db1f7d63141afcf04ebec77fb4a2b /protocols/YAMN/src/proto/pop3 | |
parent | 39badfe98c0f8a750101926f91b5b3122dfdeb22 (diff) |
fixes #3730 (YAMN: если контакта в базе нет, плагин начинает глючить)
Diffstat (limited to 'protocols/YAMN/src/proto/pop3')
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3comm.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
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);
}
|