From be22bc76ea2ee48830dc60f5bb274953349d85f6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 9 Mar 2022 16:31:40 +0300 Subject: =?UTF-8?q?fixes=20#3044=20(Jabber:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D1=81=D1=82=D0=B8=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20"=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B2=D1=81=D0=BF=D0=BB=D1=8B=D0=B2=D0=B0=D1=8E=D1=89?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=BA=D0=BD=D0=B0=20=D1=81=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D0=B0=D0=BC=D0=B8"=20=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=B2=D1=81=D0=BF?= =?UTF-8?q?=D0=BB=D1=8B=D0=B2=D0=B0=D1=8E=D1=89=D0=B8=D1=85=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/newpluginapi.h | 4 +++- libs/win32/mir_app.lib | Bin 224912 -> 225328 bytes libs/win64/mir_app.lib | Bin 220638 -> 221068 bytes protocols/JabberG/src/jabber_opt.cpp | 1 - protocols/JabberG/src/jabber_proto.cpp | 2 ++ src/mir_app/src/CMPluginBase.cpp | 1 + src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/miranda.h | 6 ++++- src/mir_app/src/popupOption.cpp | 39 ++++++++++++++++++++++++++------- 10 files changed, 44 insertions(+), 11 deletions(-) diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 99e617cd5b..7081bd4f73 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -210,9 +210,11 @@ public: int addEffect(struct EffectID *pEffect); int addEffect(struct EffectIDW *pEffect); + int addPopupOption(const char *pszDescr, CMOption &pVar); + int addPopupOption(const wchar_t *pwszDescr, CMOption &pVal); + int addFrame(const struct CLISTFrame*); int addHotkey(const struct HOTKEYDESC*); - int addPopupOption(const char *pszDescr, CMOption &pVar); int addSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr); int addUserInfo(WPARAM wParam, struct OPTIONSDIALOGPAGE *odp); diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index d1f938908f..fa41ea0a59 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index da04590002..b2e3e9b86c 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 6a3f0558b4..aba6706a61 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -720,7 +720,6 @@ public: m_options.AddOption(LPGENW("Other"), LPGENW("Automatically accept authorization requests"), m_proto->m_bAutoAcceptAuthorization); m_options.AddOption(LPGENW("Other"), LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_bFixIncorrectTimestamps); m_options.AddOption(LPGENW("Other"), LPGENW("Disable frame"), m_proto->m_bDisableFrame); - m_options.AddOption(LPGENW("Other"), LPGENW("Display popups with errors"), m_proto->m_bUsePopups); m_options.AddOption(LPGENW("Other"), LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_bProcessXMPPLinks); m_options.AddOption(LPGENW("Other"), LPGENW("Embrace picture URLs with [img]"), m_proto->m_bEmbraceUrls); m_options.AddOption(LPGENW("Other"), LPGENW("Ignore server roster (groups and nick names)"), m_proto->m_bIgnoreRoster); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 3272604517..cfdadd8696 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -236,6 +236,8 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : if ((m_tszSelectedLang = getUStringA("XmlLang")) == nullptr) m_tszSelectedLang = mir_strdup("en"); + + g_plugin.addPopupOption(CMStringW(FORMAT, L"%s error notifications", m_tszUserName), m_bUsePopups); } CJabberProto::~CJabberProto() diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 2fddeda6a5..9ec679553d 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -110,6 +110,7 @@ static void wipePluginData(CMPluginBase *pPlugin) KillModuleEffects(pPlugin); KillModuleIcons(pPlugin); KillModuleHotkeys(pPlugin); + KillModulePopups(pPlugin); KillModuleSounds(pPlugin); KillModuleExtraIcons(pPlugin); KillModuleSrmmIcons(pPlugin); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 5dcd71c162..57ce92f4f5 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -794,3 +794,4 @@ _Netlib_SslWrite@12 @877 NONAME ?IsDuplicateEvent@DB@@YG_NIAAUDBEVENTINFO@@@Z @882 NONAME Srmm_GetButtonGap @883 ?addPopupOption@CMPluginBase@@QAEHPBDAAV?$CMOption@_N@@@Z @884 NONAME +?addPopupOption@CMPluginBase@@QAEHPB_WAAV?$CMOption@_N@@@Z @885 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index f40aa28380..0e11cd8e6e 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -794,3 +794,4 @@ Netlib_SslWrite @877 NONAME ?IsDuplicateEvent@DB@@YA_NIAEAUDBEVENTINFO@@@Z @882 NONAME Srmm_GetButtonGap @883 ?addPopupOption@CMPluginBase@@QEAAHPEBDAEAV?$CMOption@_N@@@Z @884 NONAME +?addPopupOption@CMPluginBase@@QEAAHPEB_WAEAV?$CMOption@_N@@@Z @885 NONAME diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index bd2e85fb03..e9ae1c1d2c 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -53,12 +53,16 @@ extern bool g_bModulesLoadedFired, g_bMirandaTerminated; char* GetPluginNameByInstance(HINSTANCE hInstance); int LoadStdPlugins(void); int LaunchServicePlugin(pluginEntry *p); -int PopupOptionsInit(WPARAM); /**** path.cpp *************************************************************************/ void InitPathVar(void); +/**** popupOptions.cpp *****************************************************************/ + +int PopupOptionsInit(WPARAM); +void KillModulePopups(HPLUGIN); + /**** srmm.cpp *************************************************************************/ void KillModuleSrmmIcons(HPLUGIN); diff --git a/src/mir_app/src/popupOption.cpp b/src/mir_app/src/popupOption.cpp index 25243de0e5..5033a601b6 100644 --- a/src/mir_app/src/popupOption.cpp +++ b/src/mir_app/src/popupOption.cpp @@ -27,9 +27,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct MPopupOption { - const char *m_descr; + MPopupOption(CMPluginBase *pPlugin, const char *pszDescr, CMOption &pVal) : + m_plugin(pPlugin), + m_val(pVal), + m_descr(pszDescr) + {} + + MPopupOption(CMPluginBase *pPlugin, const wchar_t *pwszDescr, CMOption &pVal) : + m_plugin(pPlugin), + m_val(pVal), + m_descr(pwszDescr) + {} + CMPluginBase *m_plugin; - CMOption &pVal; + CMOption &m_val; + CMStringW m_descr; }; static OBJLIST g_arOptions(1); @@ -38,11 +50,23 @@ static OBJLIST g_arOptions(1); int CMPluginBase::addPopupOption(const char *pszDescr, CMOption &pVal) { - MPopupOption tmp = { pszDescr, this, pVal }; - g_arOptions.insert(new MPopupOption(tmp)); + g_arOptions.insert(new MPopupOption(this, pszDescr, pVal)); return 0; } +int CMPluginBase::addPopupOption(const wchar_t *pwszDescr, CMOption &pVal) +{ + g_arOptions.insert(new MPopupOption(this, pwszDescr, pVal)); + return 0; +} + +void KillModulePopups(HPLUGIN pPlugin) +{ + for (auto &it : g_arOptions.rev_iter()) + if (it->m_plugin == pPlugin) + g_arOptions.remove(g_arOptions.indexOf(&it)); +} + ///////////////////////////////////////////////////////////////////////////////////////// class CPopupOptionsDlg : public CDlgBase @@ -64,12 +88,11 @@ public: lvi.iSubItem = 0; for (auto &it : g_arOptions) { - _A2T tmp(it->m_descr); - lvi.pszText = TranslateW_LP(tmp, it->m_plugin); + lvi.pszText = TranslateW_LP(it->m_descr, it->m_plugin); lvi.lParam = LPARAM(it); int iRow = m_tree.InsertItem(&lvi); - m_tree.SetItemState(iRow, it->pVal ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK); + m_tree.SetItemState(iRow, it->m_val ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK); } return true; @@ -85,7 +108,7 @@ public: m_tree.GetItem(&lvi); auto *p = (MPopupOption *)lvi.lParam; - p->pVal = lvi.state == 0x2000; + p->m_val = lvi.state == 0x2000; } return true; } -- cgit v1.2.3