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 | |
parent | 39badfe98c0f8a750101926f91b5b3122dfdeb22 (diff) |
fixes #3730 (YAMN: если контакта в базе нет, плагин начинает глючить)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/YAMN/res/YAMN.rc | 2 | ||||
-rw-r--r-- | protocols/YAMN/src/account.cpp | 8 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3comm.cpp | 27 |
3 files changed, 12 insertions, 25 deletions
diff --git a/protocols/YAMN/res/YAMN.rc b/protocols/YAMN/res/YAMN.rc index 20338bf727..f20df2593a 100644 --- a/protocols/YAMN/res/YAMN.rc +++ b/protocols/YAMN/res/YAMN.rc @@ -181,7 +181,7 @@ BEGIN GROUPBOX "Errors",IDC_STATIC,161,153,143,44
CONTROL "Sound notification if failed",IDC_CHECKFSND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,166,163,135,10
CONTROL "Message notification if failed",IDC_CHECKFMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,166,174,135,10
- CONTROL "Tray icon notification if failed",IDC_CHECKFICO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,166,186,135,10
+ CONTROL "Tray icon notification if failed",IDC_CHECKFICO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,166,185,135,10
PUSHBUTTON "Reset counter",IDC_BTNRESET,161,200,75,13
LTEXT "",IDC_STTIMELEFT,163,216,141,8
END
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp index 4e2fad5824..572418305e 100644 --- a/protocols/YAMN/src/account.cpp +++ b/protocols/YAMN/src/account.cpp @@ -38,10 +38,7 @@ void CAccount::CheckMail() void CAccount::RefreshContact()
{
- if (hContact != 0) {
- Contact::Hide(hContact, !(Flags & YAMN_ACC_ENA) && (NewMailN.Flags & YAMN_ACC_CONT));
- }
- else if ((Flags & YAMN_ACC_ENA) && (NewMailN.Flags & YAMN_ACC_CONT)) {
+ if (hContact == 0) {
hContact = db_add_contact();
Proto_AddToContact(hContact, YAMN_DBMODULE);
g_plugin.setString(hContact, "Id", Name);
@@ -49,6 +46,9 @@ void CAccount::RefreshContact() g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE);
db_set_s(hContact, "CList", "StatusMsg", Translate("No new mail message"));
}
+
+ bool bIsVisible = (Flags & YAMN_ACC_ENA) && (NewMailN.Flags & YAMN_ACC_CONT);
+ Contact::Hide(hContact, !bIsVisible);
}
/////////////////////////////////////////////////////////////////////////////////////////
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);
}
|