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 /plugins/Scriver/src/msgs.cpp | |
parent | 29b1ddd269dca4e555ebd03afc13a347618719da (diff) |
fixes #3605 (NewsAggregator: при использовании встроенного журнала StdMsg или Scriver открытый из списка контактов фид пуст)
fixes #3523 (NewsAggregator и история сообщений.)
Diffstat (limited to 'plugins/Scriver/src/msgs.cpp')
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 62d97ef0fe..80dbe87ee0 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -79,6 +79,39 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CAutoPpopup : public MAsyncObject
+{
+ MCONTACT hContact;
+ MEVENT hDbEvent;
+
+ CAutoPpopup(MCONTACT _1, MEVENT _2) :
+ hContact(_1),
+ hDbEvent(_2)
+ {}
+
+ void Invoke() override
+ {
+ /* does a window for the contact exist? */
+ HWND hwnd = Srmm_FindWindow(hContact);
+ if (hwnd == nullptr)
+ hwnd = Srmm_FindWindow(db_event_getContact(hDbEvent));
+
+ if (hwnd == nullptr) {
+ /* new message */
+ Skin_PlaySound("AlertMsg");
+ if (IsAutoPopup(hContact)) {
+ (new CMsgDialog(hContact, true))->Show();
+ return;
+ }
+ }
+
+ if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd)))
+ Srmm_AddEvent(hContact, hDbEvent);
+ }
+};
+
static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
if (hContact == 0 || Contact::IsGroupChat(hContact))
@@ -94,23 +127,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (dbei.flags & DBEF_SENT || !DbEventIsMessageOrCustom(dbei))
return 0;
- /* does a window for the contact exist? */
- HWND hwnd = Srmm_FindWindow(hContact);
- if (hwnd == nullptr)
- hwnd = Srmm_FindWindow(db_event_getContact(hDbEvent));
-
- if (hwnd == nullptr) {
- /* new message */
- Skin_PlaySound("AlertMsg");
- if (IsAutoPopup(hContact)) {
- (new CMsgDialog(hContact, true))->Show();
- return 0;
- }
- }
-
- if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd)))
- Srmm_AddEvent(hContact, hDbEvent);
-
+ Utils_InvokeAsync(new CAutoPpopup(hContact, hDbEvent));
return 0;
}
|