summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-10-24 16:26:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-10-24 16:26:54 +0300
commit05b4e7f995a6b5cf0b29489662f6b13185124c71 (patch)
treee75b45cbc61805be431f8ce596537320b8fe3453 /protocols
parent4f802e6c5ad79684ad1c7684e6d247103fc92833 (diff)
fixes #2604 (Jabber: add ability to disable MAM)
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp5
-rw-r--r--protocols/JabberG/src/jabber_mam.cpp5
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp101
-rw-r--r--protocols/JabberG/src/jabber_opttree.cpp94
-rw-r--r--protocols/JabberG/src/jabber_opttree.h15
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp1
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h1
7 files changed, 99 insertions, 123 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index c34cc8cb50..a9ddcda9ff 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -131,8 +131,9 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq)
m_ThreadInfo->send(XmlNodeIq("set", SerialNext()) << XCHILDNS((m_bEnableCarbons) ? "enable" : "disable", JABBER_FEAT_CARBONS));
// Server seems to support MAM, let's retrieve MAM settings
- if (info->jabberServerCaps & JABBER_CAPS_MAM)
- m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResultMamInfo, JABBER_IQ_TYPE_GET, 0, this)) << XCHILDNS("prefs", JABBER_FEAT_MAM));
+ if (m_bEnableMam)
+ if (info->jabberServerCaps & JABBER_CAPS_MAM)
+ m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResultMamInfo, JABBER_IQ_TYPE_GET, 0, this)) << XCHILDNS("prefs", JABBER_FEAT_MAM));
if (m_bAutoJoinBookmarks) {
LIST<JABBER_LIST_ITEM> ll(10);
diff --git a/protocols/JabberG/src/jabber_mam.cpp b/protocols/JabberG/src/jabber_mam.cpp
index 9d5ba27b64..7e9c1acb4b 100644
--- a/protocols/JabberG/src/jabber_mam.cpp
+++ b/protocols/JabberG/src/jabber_mam.cpp
@@ -51,6 +51,9 @@ void CJabberProto::OnIqResultMamInfo(const TiXmlElement *iqNode, CJabberIqInfo *
void CJabberProto::MamSetMode(int iNewMode)
{
+ if (!m_bEnableMam)
+ return;
+
const char *szMode;
switch (iNewMode) {
case 0: szMode = "never"; break;
@@ -135,7 +138,7 @@ void CJabberProto::OnIqResultRsm(const TiXmlElement *iqNode, CJabberIqInfo *pInf
INT_PTR __cdecl CJabberProto::OnMenuLoadHistory(WPARAM hContact, LPARAM)
{
- if (hContact == 0)
+ if (hContact == 0 || !m_bEnableMam)
return 0;
// wipe out old history first
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index e4edbff37e..3045c470b2 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -752,7 +752,7 @@ class CDlgOptAdvanced : public CJabberDlgBase
CCtrlCheck m_chkDirect;
CCtrlCheck m_chkDirectManual;
CCtrlEdit m_txtDirect;
- CCtrlTreeOpts m_otvOptions;
+ CCtrlTreeOpts m_options;
bool m_oldFrameValue;
@@ -762,7 +762,7 @@ public:
m_chkDirect(this, IDC_DIRECT),
m_chkDirectManual(this, IDC_DIRECT_MANUAL),
m_txtDirect(this, IDC_DIRECT_ADDR),
- m_otvOptions(this, IDC_OPTTREE),
+ m_options(this, IDC_OPTTREE),
m_oldFrameValue(proto->m_bDisableFrame)
{
CreateLink(m_chkDirect, proto->m_bBsDirect);
@@ -771,40 +771,41 @@ public:
m_chkDirect.OnChange = m_chkDirectManual.OnChange = Callback(this, &CDlgOptAdvanced::chkDirect_OnChange);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Use message delivery receipts (XEP-0184)"), m_proto->m_bMsgAck);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable avatars"), m_proto->m_bEnableAvatars);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log chat state changes"), m_proto->m_bLogChatstates);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence subscription state changes"), m_proto->m_bLogPresence);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence errors"), m_proto->m_bLogPresenceErrors);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user moods receiving"), m_proto->m_bEnableUserMood);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user tunes receiving"), m_proto->m_bEnableUserTune);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user activity receiving"), m_proto->m_bEnableUserActivity);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_bAcceptNotes);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_bAutosaveNotes);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Inline pictures in messages (XEP-0231)"), m_proto->m_bInlinePictures);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable chat states sending (XEP-0085)"), m_proto->m_bEnableChatStates);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history (XEP-0136)"), m_proto->m_bEnableMsgArchive);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable carbon copies (XEP-0280)"), m_proto->m_bEnableCarbons);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Use Stream Management (XEP-0198) if possible (Testing)"), m_proto->m_bEnableStreamMgmt);
-
- m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_bDisable3920auth);
- m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Enable stream compression (if possible)"), m_proto->m_bEnableZlib);
-
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable remote controlling (from another resource of same JID only)"), m_proto->m_bEnableRemoteControl);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Show transport agents on contact list"), m_proto->m_bShowTransport);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically add contact when accept authorization"), m_proto->m_bAutoAdd);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically accept authorization requests"), m_proto->m_bAutoAcceptAuthorization);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_bFixIncorrectTimestamps);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Disable frame"), m_proto->m_bDisableFrame);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_bProcessXMPPLinks);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Embrace picture URLs with [img]"), m_proto->m_bEmbraceUrls);
- m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Ignore server roster (groups and nick names)"), m_proto->m_bIgnoreRoster);
-
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Allow servers to request version (XEP-0092)"), m_proto->m_bAllowVersionRequests);
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Show information about operating system in version replies"), m_proto->m_bShowOSVersion);
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_bBsOnlyIBB);
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_bAcceptHttpAuth);
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Use OMEMO encryption for messages if possible (XEP-0384) (Basic support without GUI)"), m_proto->m_bUseOMEMO);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Use message delivery receipts (XEP-0184)"), m_proto->m_bMsgAck);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable avatars"), m_proto->m_bEnableAvatars);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Log chat state changes"), m_proto->m_bLogChatstates);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Log presence subscription state changes"), m_proto->m_bLogPresence);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Log presence errors"), m_proto->m_bLogPresenceErrors);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable user moods receiving"), m_proto->m_bEnableUserMood);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable user tunes receiving"), m_proto->m_bEnableUserTune);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable user activity receiving"), m_proto->m_bEnableUserActivity);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Receive notes"), m_proto->m_bAcceptNotes);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Automatically save received notes"), m_proto->m_bAutosaveNotes);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Inline pictures in messages (XEP-0231)"), m_proto->m_bInlinePictures);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable chat states sending (XEP-0085)"), m_proto->m_bEnableChatStates);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable server-side history (XEP-0136)"), m_proto->m_bEnableMsgArchive);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable Message Archive Management (XEP-0313)"), m_proto->m_bEnableMam);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable carbon copies (XEP-0280)"), m_proto->m_bEnableCarbons);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Use Stream Management (XEP-0198) if possible (Testing)"), m_proto->m_bEnableStreamMgmt);
+
+ m_options.AddOption(LPGENW("Server options"), LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_bDisable3920auth);
+ m_options.AddOption(LPGENW("Server options"), LPGENW("Enable stream compression (if possible)"), m_proto->m_bEnableZlib);
+
+ m_options.AddOption(LPGENW("Other"), LPGENW("Enable remote controlling (from another resource of same JID only)"), m_proto->m_bEnableRemoteControl);
+ m_options.AddOption(LPGENW("Other"), LPGENW("Show transport agents on contact list"), m_proto->m_bShowTransport);
+ m_options.AddOption(LPGENW("Other"), LPGENW("Automatically add contact when accept authorization"), m_proto->m_bAutoAdd);
+ 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("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);
+
+ m_options.AddOption(LPGENW("Security"), LPGENW("Allow servers to request version (XEP-0092)"), m_proto->m_bAllowVersionRequests);
+ m_options.AddOption(LPGENW("Security"), LPGENW("Show information about operating system in version replies"), m_proto->m_bShowOSVersion);
+ m_options.AddOption(LPGENW("Security"), LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_bBsOnlyIBB);
+ m_options.AddOption(LPGENW("Security"), LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_bAcceptHttpAuth);
+ m_options.AddOption(LPGENW("Security"), LPGENW("Use OMEMO encryption for messages if possible (XEP-0384) (Basic support without GUI)"), m_proto->m_bUseOMEMO);
}
bool OnInitDialog() override
@@ -841,6 +842,7 @@ public:
}
}
}
+
if (m_proto->m_bUseOMEMO)
m_proto->m_omemo.init();
else
@@ -877,7 +879,7 @@ class CDlgOptGc : public CJabberDlgBase
CCtrlEdit m_txtAltNick;
CCtrlEdit m_txtSlap;
CCtrlEdit m_txtQuit;
- CCtrlTreeOpts m_otvOptions;
+ CCtrlTreeOpts m_options;
public:
CDlgOptGc(CJabberProto *proto) :
@@ -885,23 +887,24 @@ public:
m_txtAltNick(this, IDC_TXT_ALTNICK),
m_txtSlap(this, IDC_TXT_SLAP),
m_txtQuit(this, IDC_TXT_QUIT),
- m_otvOptions(this, IDC_OPTTREE)
+ m_options(this, IDC_OPTTREE)
{
CreateLink(m_txtAltNick, "GcAltNick", L"");
CreateLink(m_txtSlap, "GcMsgSlap", TranslateW(_T(JABBER_GC_MSG_SLAP)));
CreateLink(m_txtQuit, "GcMsgQuit", TranslateW(_T(JABBER_GC_MSG_QUIT)));
- m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_bAutoAcceptMUC);
- m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join bookmarks on login"), m_proto->m_bAutoJoinBookmarks);
- m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join conferences on login"), m_proto->m_bAutoJoinConferences);
- m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Do not open chat windows on creation"), m_proto->m_bAutoJoinHidden);
- m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Do not show multiuser chat invitations"), m_proto->m_bIgnoreMUCInvites);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Ban notifications"), m_proto->m_bGcLogBans);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Room configuration changes"), m_proto->m_bGcLogConfig);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Affiliation changes"), m_proto->m_bGcLogAffiliations);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Role changes"), m_proto->m_bGcLogRoles);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Status changes"), m_proto->m_bGcLogStatuses);
- m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Don't notify history messages"), m_proto->m_bGcLogChatHistory);
+ m_options.AddOption(LPGENW("General"), LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_bAutoAcceptMUC);
+ m_options.AddOption(LPGENW("General"), LPGENW("Automatically join bookmarks on login"), m_proto->m_bAutoJoinBookmarks);
+ m_options.AddOption(LPGENW("General"), LPGENW("Automatically join conferences on login"), m_proto->m_bAutoJoinConferences);
+ m_options.AddOption(LPGENW("General"), LPGENW("Do not open chat windows on creation"), m_proto->m_bAutoJoinHidden);
+ m_options.AddOption(LPGENW("General"), LPGENW("Do not show multiuser chat invitations"), m_proto->m_bIgnoreMUCInvites);
+
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Ban notifications"), m_proto->m_bGcLogBans);
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Room configuration changes"), m_proto->m_bGcLogConfig);
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Affiliation changes"), m_proto->m_bGcLogAffiliations);
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Role changes"), m_proto->m_bGcLogRoles);
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Status changes"), m_proto->m_bGcLogStatuses);
+ m_options.AddOption(LPGENW("Log events"), LPGENW("Don't notify history messages"), m_proto->m_bGcLogChatHistory);
}
};
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp
index 10736104cd..2a909a1bd8 100644
--- a/protocols/JabberG/src/jabber_opttree.cpp
+++ b/protocols/JabberG/src/jabber_opttree.cpp
@@ -37,13 +37,11 @@ CCtrlTreeOpts::CCtrlTreeOpts(CDlgBase* dlg, int ctrlId):
CCtrlTreeOpts::~CCtrlTreeOpts()
{
- for (auto &it : m_options)
- delete it;
}
-void CCtrlTreeOpts::AddOption(wchar_t *szOption, CMOption<bool> &option)
+void CCtrlTreeOpts::AddOption(const wchar_t *pwszSection, const wchar_t *pwszName, CMOption<bool> &option)
{
- m_options.insert(new COptionsItem(szOption, option), m_options.getCount());
+ m_options.insert(new COptionsItem(pwszSection, pwszName, option), m_options.getCount());
}
BOOL CCtrlTreeOpts::OnNotify(int idCtrl, NMHDR *pnmh)
@@ -105,56 +103,34 @@ void CCtrlTreeOpts::OnInit()
/* build options tree. based on code from IcoLib */
for (auto &it : m_options) {
- int sectionLevel = 0;
-
- HTREEITEM hSection = nullptr;
- wchar_t itemName[1024];
- mir_wstrcpy(itemName, it->m_szOptionName);
- wchar_t *sectionName = itemName;
-
- while (sectionName) {
- // allow multi-level tree
- wchar_t *pItemName = sectionName;
- HTREEITEM hItem;
-
- if (sectionName = wcschr(sectionName, '/')) {
- // one level deeper
- *sectionName = 0;
- sectionName++;
+ if (it->m_pwszSection) {
+ HTREEITEM hSection = FindNamedItem(nullptr, it->m_pwszSection);
+ if (!hSection) {
+ TVINSERTSTRUCT tvis = {};
+ tvis.hParent = hSection;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.pszText = (LPWSTR)it->m_pwszSection;
+ tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED | TVIS_BOLD;
+ tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN;
+ hSection = InsertItem(&tvis);
}
- hItem = FindNamedItem(hSection, pItemName);
- if (!sectionName || !hItem) {
- if (!hItem) {
- TVINSERTSTRUCT tvis = {};
- tvis.hParent = hSection;
- tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.pszText = pItemName;
- tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- if (sectionName) {
- tvis.item.lParam = -1;
- tvis.item.state |= TVIS_BOLD;
- tvis.item.stateMask |= TVIS_BOLD;
- tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN;
- }
- else {
- tvis.item.lParam = m_options.indexOf(&it);
-
- BYTE val = *it->m_option;
-
- if (it->m_groupId == OPTTREE_CHECK)
- tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_CHECK : IMG_NOCHECK;
- else
- tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_RCHECK : IMG_NORCHECK;
- }
- hItem = InsertItem(&tvis);
- if (!sectionName)
- it->m_hItem = hItem;
- }
- }
- sectionLevel++;
- hSection = hItem;
+ TVINSERTSTRUCT tvis = {};
+ tvis.hParent = hSection;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.pszText = (LPWSTR)it->m_pwszName;
+ tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
+ tvis.item.lParam = m_options.indexOf(&it);
+
+ BYTE val = *it->m_option;
+ if (it->m_groupId == OPTTREE_CHECK)
+ tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_CHECK : IMG_NOCHECK;
+ else
+ tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_RCHECK : IMG_NORCHECK;
+
+ it->m_hItem = InsertItem(&tvis);
}
}
@@ -207,7 +183,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti)
case IMG_NORCHECK:
for (auto &it : m_options) {
- if (it->m_groupId == m_options[tvi.lParam]->m_groupId) {
+ if (it->m_groupId == m_options[tvi.lParam].m_groupId) {
TVITEMEX tvi_tmp;
tvi_tmp.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi_tmp.hItem = it->m_hItem;
@@ -222,15 +198,3 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti)
SetItem(&tvi);
}
-
-CCtrlTreeOpts::COptionsItem::COptionsItem(wchar_t *szOption, CMOption<bool> &option) :
- m_option(&option),
- m_groupId(OPTTREE_CHECK)
-{
- m_szOptionName = mir_wstrdup(szOption);
-}
-
-CCtrlTreeOpts::COptionsItem::~COptionsItem()
-{
- mir_free(m_szOptionName);
-}
diff --git a/protocols/JabberG/src/jabber_opttree.h b/protocols/JabberG/src/jabber_opttree.h
index a1dab5d5f1..e2b53015c8 100644
--- a/protocols/JabberG/src/jabber_opttree.h
+++ b/protocols/JabberG/src/jabber_opttree.h
@@ -37,7 +37,7 @@ public:
CCtrlTreeOpts(CDlgBase* dlg, int ctrlId);
~CCtrlTreeOpts();
- void AddOption(wchar_t *szOption, CMOption<bool> &option);
+ void AddOption(const wchar_t *pwszSection, const wchar_t *pwszName, CMOption<bool> &option);
BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
void OnDestroy() override;
@@ -47,18 +47,21 @@ public:
protected:
struct COptionsItem
{
- wchar_t *m_szOptionName;
- int m_groupId;
+ const wchar_t *m_pwszSection, *m_pwszName;
+ int m_groupId = OPTTREE_CHECK;
CMOption<bool> *m_option;
HTREEITEM m_hItem = nullptr;
- COptionsItem(wchar_t *szOption, CMOption<bool> &option);
- ~COptionsItem();
+ COptionsItem(const wchar_t *pwszSection, const wchar_t *pwszName, CMOption<bool> &option) :
+ m_pwszSection(pwszSection),
+ m_pwszName(pwszName),
+ m_option(&option)
+ {}
};
- LIST<COptionsItem> m_options;
+ OBJLIST<COptionsItem> m_options;
void ProcessItemClick(HTREEITEM hti);
};
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 05559615fc..c39046ab06 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -95,6 +95,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
m_bEnableAvatars(this, "EnableAvatars", true),
m_bEnableCarbons(this, "EnableCarbons", true),
m_bEnableChatStates(this, "EnableChatStates", true),
+ m_bEnableMam(this, "EnableMam", true),
m_bEnableMsgArchive(this, "EnableMsgArchive", false),
m_bEnableRemoteControl(this, "EnableRemoteControl", false),
m_bEnableStreamMgmt(this, "UseStreamMgmt", false),
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 9d78f99b63..b6e70e7aff 100755
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -189,6 +189,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
CMOption<bool> m_bEnableCarbons;
CMOption<bool> m_bEnableChatStates;
CMOption<bool> m_bEnableMsgArchive;
+ CMOption<bool> m_bEnableMam;
CMOption<bool> m_bEnableRemoteControl;
CMOption<bool> m_bEnableStreamMgmt;
CMOption<bool> m_bEnableUserActivity;