summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-03-09 16:31:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-03-09 16:31:40 +0300
commitbe22bc76ea2ee48830dc60f5bb274953349d85f6 (patch)
tree32466abd051f3fba47d623b4d7643d12d4519359
parentd387ed11456e40f36f359cb3aa9f74a54b8f369b (diff)
fixes #3044 (Jabber: перенести опцию "Показывать всплывающие окна с ошибками" в настройки всплывающих окон)
-rw-r--r--include/newpluginapi.h4
-rw-r--r--libs/win32/mir_app.libbin224912 -> 225328 bytes
-rw-r--r--libs/win64/mir_app.libbin220638 -> 221068 bytes
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp1
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--src/mir_app/src/CMPluginBase.cpp1
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/miranda.h6
-rw-r--r--src/mir_app/src/popupOption.cpp39
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<bool> &pVar);
+ int addPopupOption(const wchar_t *pwszDescr, CMOption<bool> &pVal);
+
int addFrame(const struct CLISTFrame*);
int addHotkey(const struct HOTKEYDESC*);
- int addPopupOption(const char *pszDescr, CMOption<bool> &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
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index da04590002..b2e3e9b86c 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files 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<bool> &pVal) :
+ m_plugin(pPlugin),
+ m_val(pVal),
+ m_descr(pszDescr)
+ {}
+
+ MPopupOption(CMPluginBase *pPlugin, const wchar_t *pwszDescr, CMOption<bool> &pVal) :
+ m_plugin(pPlugin),
+ m_val(pVal),
+ m_descr(pwszDescr)
+ {}
+
CMPluginBase *m_plugin;
- CMOption<bool> &pVal;
+ CMOption<bool> &m_val;
+ CMStringW m_descr;
};
static OBJLIST<MPopupOption> g_arOptions(1);
@@ -38,11 +50,23 @@ static OBJLIST<MPopupOption> g_arOptions(1);
int CMPluginBase::addPopupOption(const char *pszDescr, CMOption<bool> &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<bool> &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;
}