diff options
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/srmm_util.cpp | 40 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 890a9eec7f..a0addf8ff5 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -451,3 +451,5 @@ Hotkey_Subclass @455 Hotkey_Unregister @456
Hotkey_Unsubclass @457
Hotkey_Check @458
+?SetStatusText@CSrmmBaseDialog@@UAEXPB_WPAUHICON__@@@Z @459 NONAME
+Srmm_SetStatusText @460
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index f5e2debc70..963f8cd9ad 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -451,3 +451,5 @@ Hotkey_Subclass @455 Hotkey_Unregister @456
Hotkey_Unsubclass @457
Hotkey_Check @458
+?SetStatusText@CSrmmBaseDialog@@UEAAXPEB_WPEAUHICON__@@@Z @459 NONAME
+Srmm_SetStatusText @460
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index ad0abe21a3..f9e7ed65c5 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "chat.h" +///////////////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(DWORD) CALLBACK Srmm_LogStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) { LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA*)dwCookie; @@ -50,6 +52,8 @@ MIR_APP_DLL(DWORD) CALLBACK Srmm_LogStreamCallback(DWORD_PTR dwCookie, LPBYTE pb return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) { if (hContact == 0) @@ -71,12 +75,48 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(void) Srmm_Broadcast(UINT msg, WPARAM wParam, LPARAM lParam) { WindowList_Broadcast(g_hWindowList, msg, wParam, lParam); } +///////////////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(HWND) Srmm_FindWindow(MCONTACT hContact) { return WindowList_Find(g_hWindowList, hContact); } + +///////////////////////////////////////////////////////////////////////////////////////// +// serializes all thread-unsafe operation to the first thread + +struct SSTParam +{ + HWND hwnd; + const wchar_t *wszText; + HICON hIcon; +}; + +static INT_PTR CALLBACK sttSetStatusText(void *_p) +{ + SSTParam *param = (SSTParam*)_p; + + CSrmmBaseDialog *pDlg = (CSrmmBaseDialog*)GetWindowLongPtr(param->hwnd, GWLP_USERDATA); + if (pDlg != nullptr) + pDlg->SetStatusText((param->wszText == nullptr) ? L"" : param->wszText, param->hIcon); + return 0; +} + +MIR_APP_DLL(void) Srmm_SetStatusText(MCONTACT hContact, const wchar_t *wszText, HICON hIcon) +{ + HWND hwnd = Srmm_FindWindow(hContact); + if (hwnd == nullptr) + hwnd = Srmm_FindWindow(db_mc_getMeta(hContact)); + if (hwnd == nullptr) + return; + + SSTParam param = { hwnd, wszText, hIcon }; + CallFunctionSync(sttSetStatusText, ¶m); +} |