diff options
Diffstat (limited to 'plugins/NewStory/src/utils.cpp')
-rw-r--r-- | plugins/NewStory/src/utils.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index f6aca92604..b8b5369451 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -1,6 +1,6 @@ /*
Copyright (c) 2005 Victor Pavlychko (nullbyte@sotline.net.ua)
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -49,19 +49,29 @@ Bitmap* LoadImageFromResource(HINSTANCE hInst, int resourceId, const wchar_t *pw /////////////////////////////////////////////////////////////////////////////////////////
-int SmartSendEvent(int iEventType, MCONTACT hContact, LPARAM hEvent)
+static void SmartSendEventWorker(MWindowList wndList, int iEventType, MCONTACT cc1, MCONTACT cc2, MEVENT hEvent)
{
- if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, hContact))
- SendMessage(hwnd, iEventType, hContact, hEvent);
+ if (HWND hwnd = WindowList_Find(wndList, cc1))
+ PostMessage(hwnd, iEventType, cc1, hEvent);
- if (db_mc_isMeta(hContact)) {
- // Send a message to a real contact too
+ if (cc2 != INVALID_CONTACT_ID)
+ if (HWND hwnd = WindowList_Find(wndList, cc2))
+ PostMessage(hwnd, iEventType, cc2, hEvent);
+}
+
+int SmartSendEvent(int iEventType, MCONTACT cc1, MEVENT hEvent)
+{
+ MCONTACT cc2 = INVALID_CONTACT_ID;
+
+ // Send a message to a real contact too
+ if (db_mc_isMeta(cc1)) {
MCONTACT cc = db_event_getContact(hEvent);
- if (cc != hContact)
- if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, cc))
- SendMessage(hwnd, iEventType, cc, hEvent);
+ if (cc != cc1)
+ cc2 = cc;
}
+ SmartSendEventWorker(g_hNewstoryLogs, iEventType, cc1, cc2, hEvent);
+ SmartSendEventWorker(g_hNewstoryHistLogs, iEventType, cc1, cc2, hEvent);
return 0;
}
@@ -194,6 +204,9 @@ static int DetectUrl(const wchar_t *text) void UrlAutodetect(CMStringW &str)
{
+ if (str.IsEmpty())
+ return;
+
int level = 0;
for (auto *p = str.c_str(); *p; p++) {
|