From 69581b8648e0c2fe96f454455763359ebeeba46a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Jul 2023 13:11:06 +0300 Subject: SRMM: automatic RTF log redraw on event's change/removal --- protocols/JabberG/src/jabber.cpp | 3 --- protocols/JabberG/src/jabber_file.cpp | 17 ++++++++--------- protocols/JabberG/src/stdafx.h | 2 +- protocols/Telegram/src/avatars.cpp | 2 -- protocols/Telegram/src/main.cpp | 2 -- protocols/Telegram/src/stdafx.h | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 1c13d97a87..e19f7bc264 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma comment(lib, "Secur32.lib") HMODULE hMsftedit; -HANDLE g_hevEventEdited; CMPlugin g_plugin; @@ -127,8 +126,6 @@ int CMPlugin::Load() bPlatform = false; #endif - g_hevEventEdited = CreateHookableEvent(ME_DB_EVENT_EDITED); - Miranda_GetVersionText(szCoreVersion, _countof(szCoreVersion)); CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries); diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index aea0b617b1..863874a011 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -31,9 +31,9 @@ INT_PTR __cdecl CJabberProto::OnOfflineFile(WPARAM param, LPARAM) return 0; } -void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *param) +void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *ofd) { - DB::EventInfo dbei(param->hDbEvent); + DB::EventInfo dbei(ofd->hDbEvent); if (m_bJabberOnline && dbei && !strcmp(dbei.szModule, m_szModuleName) && dbei.eventType == EVENTTYPE_FILE) { DB::FILE_BLOB blob(dbei); if (const char *url = blob.getUrl()) { @@ -49,7 +49,7 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *param) } else if (ret != 2 || (strcmp(protocol, "https") && strcmp(protocol, "http"))) { debugLogA("Wrong url"); - delete param; + delete ofd; return; } @@ -63,7 +63,7 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *param) // download the page NLHR_PTR nlhrReply(Netlib_HttpTransaction(m_hNetlibUser, &nlhr)); if (nlhrReply && nlhrReply->resultCode == 200) { - FILE *f = _wfopen(param->wszPath, L"wb"); + FILE *f = _wfopen(ofd->wszPath, L"wb"); size_t written = 0; if (f) { if (encrypted) { @@ -96,17 +96,16 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *param) if (written) { DBVARIANT dbv = { DBVT_DWORD }; dbv.dVal = (DWORD)written; - db_event_setJson(param->hDbEvent, "ft", &dbv); - db_event_setJson(param->hDbEvent, "fs", &dbv); - NotifyEventHooks(g_hevEventEdited, 0, param->hDbEvent); + db_event_setJson(ofd->hDbEvent, "ft", &dbv); + db_event_setJson(ofd->hDbEvent, "fs", &dbv); - param->Finish(); + ofd->Finish(); } } } } - delete param; + delete ofd; } void CJabberProto::OnCreateOfflineFile(DB::FILE_BLOB &blob, void *pHandle) diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index a96311c6f0..bc16368761 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -508,7 +508,7 @@ extern unsigned int g_nTempFileId; extern int g_cbCountries; extern struct CountryListEntry* g_countries; -extern HANDLE hExtListInit, hDiscoInfoResult, g_hevEventEdited; +extern HANDLE hExtListInit, hDiscoInfoResult; /******************************************************************* * Function declarations diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 4a08866989..48236fd9e7 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -204,8 +204,6 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj) F->ofd->ResetFileName(wszFullName); // resulting ofd->wszPath may differ from wszFullName MoveFileW(wszExistingFile, F->ofd->wszPath); - NotifyEventHooks(g_plugin.m_hevEventEdited, 0, F->ofd->hDbEvent); - F->ofd->Finish(); } diff --git a/protocols/Telegram/src/main.cpp b/protocols/Telegram/src/main.cpp index 9ed452ad48..32206a9b6c 100644 --- a/protocols/Telegram/src/main.cpp +++ b/protocols/Telegram/src/main.cpp @@ -49,7 +49,5 @@ int CMPlugin::Load() registerIcon("Protocols/Telegram", iconList, "tg"); m_hIcon = ExtraIcon_RegisterIcolib("tg_premium", LPGEN("Telegram Premium user"), getIconHandle(IDI_PREMIUM)); - - m_hevEventEdited = CreateHookableEvent(ME_DB_EVENT_EDITED); return 0; } diff --git a/protocols/Telegram/src/stdafx.h b/protocols/Telegram/src/stdafx.h index dad748c7cd..f6e7100f53 100644 --- a/protocols/Telegram/src/stdafx.h +++ b/protocols/Telegram/src/stdafx.h @@ -49,7 +49,7 @@ struct CMPlugin : public ACCPROTOPLUGIN { CMPlugin(); - HANDLE m_hIcon, m_hevEventEdited; + HANDLE m_hIcon; int Load() override; }; -- cgit v1.2.3