diff options
author | George Hazan <george.hazan@gmail.com> | 2023-08-02 21:40:08 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-08-02 21:40:08 +0300 |
commit | 93545c9575e94cb9015827525a8737437f80166a (patch) | |
tree | d5bae556381df327d9e731268a11dc2fd653afb6 /src/core/stdmsg | |
parent | 29b1ddd269dca4e555ebd03afc13a347618719da (diff) |
fixes #3605 (NewsAggregator: при использовании встроенного журнала StdMsg или Scriver открытый из списка контактов фид пуст)
fixes #3523 (NewsAggregator и история сообщений.)
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 119 |
1 files changed, 69 insertions, 50 deletions
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0e9287aca7..e9c3b0df20 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -50,75 +50,94 @@ int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact) return sendId;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int SRMMStatusToPf2(int status)
{
switch (status) {
- case ID_STATUS_ONLINE: return PF2_ONLINE;
- case ID_STATUS_AWAY: return PF2_SHORTAWAY;
- case ID_STATUS_DND: return PF2_HEAVYDND;
- case ID_STATUS_NA: return PF2_LONGAWAY;
- case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
- case ID_STATUS_FREECHAT: return PF2_FREECHAT;
- case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
- case ID_STATUS_OFFLINE: return MODEF_OFFLINE;
+ case ID_STATUS_ONLINE: return PF2_ONLINE;
+ case ID_STATUS_AWAY: return PF2_SHORTAWAY;
+ case ID_STATUS_DND: return PF2_HEAVYDND;
+ case ID_STATUS_NA: return PF2_LONGAWAY;
+ case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
+ case ID_STATUS_FREECHAT: return PF2_FREECHAT;
+ case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
+ case ID_STATUS_OFFLINE: return MODEF_OFFLINE;
}
return 0;
}
-static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
+struct CAutoPopup : public MAsyncObject
{
- if (hContact == 0 || Contact::IsGroupChat(hContact))
- return 0;
-
- DB::EventInfo dbei(hDbEvent, false);
- if (!dbei)
- return 0;
+ MCONTACT hContact;
+ MEVENT hDbEvent;
- if (dbei.markedRead() || !DbEventIsShown(dbei))
- return 0;
+ CAutoPopup(MCONTACT _1, MEVENT _2) :
+ hContact(_1),
+ hDbEvent(_2)
+ {}
- bool bPopup = false;
- char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto && (g_plugin.popupFlags & SRMMStatusToPf2(Proto_GetStatus(szProto))))
- bPopup = true;
+ void Invoke() override
+ {
+ bool bPopup = false;
+ char *szProto = Proto_GetBaseAccountName(hContact);
+ if (szProto && (g_plugin.popupFlags & SRMMStatusToPf2(Proto_GetStatus(szProto))))
+ bPopup = true;
+
+ /* does a window for the contact exist? */
+ CTabbedWindow *pContainer = nullptr;
+ auto *pDlg = Srmm_FindDialog(hContact);
+ if (!pDlg) {
+ if (bPopup) {
+ pDlg = GetContainer()->AddPage(hContact, nullptr, true);
+ pContainer = pDlg->getOwner();
+ }
- /* does a window for the contact exist? */
- CTabbedWindow *pContainer = nullptr;
- auto *pDlg = Srmm_FindDialog(hContact);
- if (!pDlg) {
- if (bPopup) {
- pDlg = GetContainer()->AddPage(hContact, nullptr, true);
+ Skin_PlaySound("AlertMsg");
+ Srmm_AddEvent(hContact, hDbEvent);
+ }
+ else {
pContainer = pDlg->getOwner();
+ if (bPopup)
+ ShowWindow(pContainer->GetHwnd(), SW_RESTORE);
+
+ if (pContainer->CurrPage() != pDlg)
+ Srmm_AddEvent(hContact, hDbEvent);
}
-
- Skin_PlaySound("AlertMsg");
- Srmm_AddEvent(hContact, hDbEvent);
- }
- else {
- pContainer = pDlg->getOwner();
- if (bPopup)
- ShowWindow(pContainer->GetHwnd(), SW_RESTORE);
- if (pContainer->CurrPage() != pDlg)
- Srmm_AddEvent(hContact, hDbEvent);
+ if (pContainer) {
+ if (bPopup && g_Settings.bTabsEnable && GetForegroundWindow() != pContainer->GetHwnd())
+ g_pTabDialog->m_tab.ActivatePage(g_pTabDialog->m_tab.GetDlgIndex(pDlg));
+
+ if (!g_plugin.bDoNotStealFocus) {
+ SetForegroundWindow(pContainer->GetHwnd());
+ Skin_PlaySound("RecvMsgActive");
+ }
+ else {
+ if (GetForegroundWindow() == GetParent(pContainer->GetHwnd()))
+ Skin_PlaySound("RecvMsgActive");
+ else
+ Skin_PlaySound("RecvMsgInactive");
+ }
+ }
}
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
+{
+ if (hContact == 0 || Contact::IsGroupChat(hContact))
+ return 0;
- if (!pContainer)
+ DB::EventInfo dbei(hDbEvent, false);
+ if (!dbei)
return 0;
- if (bPopup && g_Settings.bTabsEnable && GetForegroundWindow() != pContainer->GetHwnd())
- g_pTabDialog->m_tab.ActivatePage(g_pTabDialog->m_tab.GetDlgIndex(pDlg));
+ if (dbei.markedRead() || !DbEventIsShown(dbei))
+ return 0;
- if (!g_plugin.bDoNotStealFocus) {
- SetForegroundWindow(pContainer->GetHwnd());
- Skin_PlaySound("RecvMsgActive");
- }
- else {
- if (GetForegroundWindow() == GetParent(pContainer->GetHwnd()))
- Skin_PlaySound("RecvMsgActive");
- else
- Skin_PlaySound("RecvMsgInactive");
- }
+ Utils_InvokeAsync(new CAutoPopup(hContact, hDbEvent));
return 0;
}
|