summaryrefslogtreecommitdiff
path: root/plugins/NewAwaySysMod
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-04 18:37:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-04 18:37:35 +0300
commit9e7515f1d874554ccef6102f34e823368185f6b5 (patch)
tree86cdfe94fdcebe345539f71dcc3c0e8c5d4aa202 /plugins/NewAwaySysMod
parent90f18ff161dcff4ec9112758883b706655f56688 (diff)
fixes #2830 (NewAwaySys: remove "Enable contact menu items" option)
Diffstat (limited to 'plugins/NewAwaySysMod')
-rw-r--r--plugins/NewAwaySysMod/res/NewAwaySys.rc2
-rw-r--r--plugins/NewAwaySysMod/src/AwayOpt.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/AwaySys.cpp76
-rw-r--r--plugins/NewAwaySysMod/src/Options.cpp43
-rw-r--r--plugins/NewAwaySysMod/src/version.h2
5 files changed, 69 insertions, 56 deletions
diff --git a/plugins/NewAwaySysMod/res/NewAwaySys.rc b/plugins/NewAwaySysMod/res/NewAwaySys.rc
index 4ae3503068..797364bea4 100644
--- a/plugins/NewAwaySysMod/res/NewAwaySys.rc
+++ b/plugins/NewAwaySysMod/res/NewAwaySys.rc
@@ -185,8 +185,6 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,146,288,10
CONTROL "Store contact autoreply/ignore settings for each status separately",IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS,
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,15,157,294,16
- CONTROL "Enable contact menu items",IDC_MOREOPTDLG_USEMENUITEM,
- "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,167,203,142,17
CONTROL "Use protocol specific nick for %nas_mynick%",IDC_MOREOPTDLG_MYNICKPERPROTO,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,6,175,294,8
CONTROL "Update status messages for non-ICQ protocols every",IDC_MOREOPTDLG_UPDATEMSGS,
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp
index 9bcca8f929..f645bf677c 100644
--- a/plugins/NewAwaySysMod/src/AwayOpt.cpp
+++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp
@@ -404,7 +404,6 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS:
case IDC_MOREOPTDLG_PERSTATUSPERSONAL:
case IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS:
- case IDC_MOREOPTDLG_USEMENUITEM:
case IDC_MOREOPTDLG_MYNICKPERPROTO:
case IDC_MOREOPTDLG_USEDEFMSG:
case IDC_MOREOPTDLG_USELASTMSG:
@@ -1081,7 +1080,6 @@ void InitOptions()
g_MoreOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MOREOPTDLG_SAVEPERSONALMSGS, "SavePersonalMsgs", DBVT_BYTE, 1));
g_MoreOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MOREOPTDLG_PERSTATUSPERSONAL, "PerStatusPersonal", DBVT_BYTE, 0));
g_MoreOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS, "PerStatusPersonalSettings", DBVT_BYTE, 0));
- g_MoreOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MOREOPTDLG_USEMENUITEM, "UseMenuItem", DBVT_BYTE, 0));
g_MoreOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MOREOPTDLG_MYNICKPERPROTO, "MyNickPerProto", DBVT_BYTE, 1));
g_MoreOptPage.Items.AddElem(new COptItem_IntEdit(IDC_MOREOPTDLG_WAITFORMSG, "WaitForMsg", DBVT_WORD, TRUE, 5));
g_MoreOptPage.Items.AddElem(new COptItem_IntEdit(IDC_MOREOPTDLG_RECENTMSGSCOUNT, "MRMCount", DBVT_WORD, TRUE, 5));
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp
index a0641ae1c2..d2f00a9253 100644
--- a/plugins/NewAwaySysMod/src/AwaySys.cpp
+++ b/plugins/NewAwaySysMod/src/AwaySys.cpp
@@ -541,6 +541,7 @@ int MirandaLoaded(WPARAM, LPARAM)
mi.pszService = MS_AWAYSYS_AUTOREPLY_TOGGLE;
g_hToggleSOEMenuItem = Menu_AddMainMenuItem(&mi);
+ // contact menu items
memset(&mi, 0, sizeof(mi));
SET_UID(mi, 0xd3282acc, 0x9ff1, 0x4ede, 0x8a, 0x1e, 0x36, 0x72, 0x3f, 0x44, 0x4f, 0x84);
mi.position = -2000005000;
@@ -549,44 +550,43 @@ int MirandaLoaded(WPARAM, LPARAM)
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
g_hReadStatMenuItem = Menu_AddContactMenuItem(&mi);
- if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USEMENUITEM)) {
- memset(&mi, 0, sizeof(mi));
- SET_UID(mi, 0xc42a4fdb, 0x51b8, 0x4bbe, 0x83, 0xee, 0x2d, 0x32, 0x29, 0x5c, 0x2, 0xb3);
- mi.flags = CMIF_UNICODE | CMIF_HIDDEN;
- mi.name.w = LPGENW("Set status message"); // will never be shown
- mi.position = 1000020000;
- mi.hIcolibItem = iconList[8].hIcolib;
- mi.pszService = MS_AWAYSYS_SETCONTACTSTATMSG;
- g_hContactMenuItem = Menu_AddContactMenuItem(&mi);
-
- memset(&mi, 0, sizeof(mi));
- SET_UID(mi, 0x47a3c631, 0x8ca9, 0x4b7e, 0x84, 0x6e, 0x29, 0xbf, 0x53, 0x30, 0x6f, 0x83);
- mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = nullptr;
- mi.position = 1000020000;
- mi.name.w = LPGENW("Autoreply");
- g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi);
- UNSET_UID(mi);
-
- mi.flags = CMIF_UNICODE | CMIF_SYSTEM;
- mi.root = g_hToggleSOEContactMenuItem;
- mi.position = 1000020000;
-
- mi.hIcolibItem = iconList[1].hIcolib;
- mi.name.w = LPGENW("On");
- mi.pszService = MS_AWAYSYS_AUTOREPLY_ON;
- g_hAutoreplyOnContactMenuItem = Menu_AddContactMenuItem(&mi);
-
- mi.hIcolibItem = iconList[0].hIcolib;
- mi.name.w = LPGENW("Off");
- mi.pszService = MS_AWAYSYS_AUTOREPLY_OFF;
- g_hAutoreplyOffContactMenuItem = Menu_AddContactMenuItem(&mi);
-
- mi.hIcolibItem = iconList[5].hIcolib;
- mi.name.w = LPGENW("Use the default setting");
- mi.pszService = MS_AWAYSYS_AUTOREPLY_USEDEFAULT;
- g_hAutoreplyUseDefaultContactMenuItem = Menu_AddContactMenuItem(&mi);
- }
+ memset(&mi, 0, sizeof(mi));
+ SET_UID(mi, 0xc42a4fdb, 0x51b8, 0x4bbe, 0x83, 0xee, 0x2d, 0x32, 0x29, 0x5c, 0x2, 0xb3);
+ mi.flags = CMIF_UNICODE | CMIF_HIDDEN;
+ mi.name.w = LPGENW("Set status message"); // will never be shown
+ mi.position = 1000020000;
+ mi.hIcolibItem = iconList[8].hIcolib;
+ mi.pszService = MS_AWAYSYS_SETCONTACTSTATMSG;
+ g_hContactMenuItem = Menu_AddContactMenuItem(&mi);
+
+ memset(&mi, 0, sizeof(mi));
+ SET_UID(mi, 0x47a3c631, 0x8ca9, 0x4b7e, 0x84, 0x6e, 0x29, 0xbf, 0x53, 0x30, 0x6f, 0x83);
+ mi.flags = CMIF_UNICODE;
+ mi.hIcolibItem = nullptr;
+ mi.position = 1000020000;
+ mi.name.w = LPGENW("Autoreply");
+ g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi);
+ UNSET_UID(mi);
+
+ mi.flags = CMIF_UNICODE | CMIF_SYSTEM;
+ mi.root = g_hToggleSOEContactMenuItem;
+ mi.position = 1000020000;
+
+ mi.hIcolibItem = iconList[1].hIcolib;
+ mi.name.w = LPGENW("On");
+ mi.pszService = MS_AWAYSYS_AUTOREPLY_ON;
+ g_hAutoreplyOnContactMenuItem = Menu_AddContactMenuItem(&mi);
+
+ mi.hIcolibItem = iconList[0].hIcolib;
+ mi.name.w = LPGENW("Off");
+ mi.pszService = MS_AWAYSYS_AUTOREPLY_OFF;
+ g_hAutoreplyOffContactMenuItem = Menu_AddContactMenuItem(&mi);
+
+ mi.hIcolibItem = iconList[5].hIcolib;
+ mi.name.w = LPGENW("Use the default setting");
+ mi.pszService = MS_AWAYSYS_AUTOREPLY_USEDEFAULT;
+ g_hAutoreplyUseDefaultContactMenuItem = Menu_AddContactMenuItem(&mi);
+
// add that funky thingy (just tweaked a bit, was spotted in Miranda's src code)
// we have to read the status message from contacts too... err
CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetContactStatMsg);
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp
index f28cb1f2bf..223b678f81 100644
--- a/plugins/NewAwaySysMod/src/Options.cpp
+++ b/plugins/NewAwaySysMod/src/Options.cpp
@@ -113,9 +113,11 @@ COptPage& COptPage::operator=(const COptPage& Page)
return *this;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// default procedure for reading value from DB; used only for integral types
int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*)
-{ // default procedure for reading value from DB; used only for integral types
+{
if (sDBSetting != nullptr) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
@@ -127,8 +129,11 @@ int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*)
return (int)GetDefValue();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// default procedure for writing value to the DB; used only for integral types
+
void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*)
-{ // default procedure for writing value to the DB; used only for integral types
+{
if (sDBSetting != nullptr && !m_bReadOnly) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
@@ -215,7 +220,6 @@ void COptItem_BitDBSetting::MemToDB(const CString &sModule, CString *sDBSettingP
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
-
// ================================================ COptItem_TreeCtrl ================================================
int COptItem_TreeCtrl::IDToOrder(int ID)
@@ -341,8 +345,11 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi
}
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// only need to gather info of items state (expanded/collapsed, checked/unchecked)
+
void COptItem_TreeCtrl::WndToMem(HWND hWnd)
-{ // only need to gather info of items state (expanded/collapsed, checked/unchecked)
+{
HWND hTreeView = GetDlgItem(hWnd, m_dlgItemID);
for (int i = 0; i < m_value.GetSize(); i++) {
DWORD State = TreeView_GetItemState(hTreeView, m_value[i].hItem, TVIS_EXPANDED | TVIS_STATEIMAGEMASK);
@@ -433,13 +440,12 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd)
COptItem::MemToWnd(hWnd);
}
-
-typedef struct
+struct sTreeDeleteEnumData
{
TMyArray<CString> TreeSettings;
COptItem_TreeCtrl *TreeCtrl;
CString *sDBSettingPrefix;
-} sTreeDeleteEnumData;
+};
int TreeDeleteEnum(const char *szSetting, void *lParam)
{
@@ -515,9 +521,11 @@ void COptItem_TreeCtrl::RecursiveDelete(HWND hWnd, int i)
m_value.RemoveElem(i);
}
-CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item)
+/////////////////////////////////////////////////////////////////////////////////////////
// Item's ID and ParentID are not used (the new item position is determined by current selection in the tree)
// returns a pointer to the newly inserted item info
+
+CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item)
{
_ASSERT(!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || !(Item.Flags & TIF_GROUP));
HWND hTreeView = GetDlgItem(hWnd, m_dlgItemID);
@@ -564,9 +572,11 @@ CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item)
return &m_value[SelOrder + 1];
}
-int COptItem_TreeCtrl::RecursiveMove(int ItemOrder, int ParentID, int InsertAtOrder)
+/////////////////////////////////////////////////////////////////////////////////////////
// ItemOrder must be a movable item (i.e. ItemOrder >= 0)
// InsertAtOrder must be >= 0 too.
+
+int COptItem_TreeCtrl::RecursiveMove(int ItemOrder, int ParentID, int InsertAtOrder)
{
int ItemsMoved = 1;
m_value.MoveElem(ItemOrder, InsertAtOrder);
@@ -585,8 +595,11 @@ int COptItem_TreeCtrl::RecursiveMove(int ItemOrder, int ParentID, int InsertAtOr
return ItemsMoved;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// hMoveTo can be NULL and it means that we must move hItem to the beginning of the list
+
void COptItem_TreeCtrl::MoveItem(HWND hWnd, HTREEITEM hItem, HTREEITEM hMoveTo)
-{ // hMoveTo can be NULL and it means that we must move hItem to the beginning of the list
+{
_ASSERT(hItem && (hMoveTo || TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL));
if (hItem == hMoveTo)
return;
@@ -607,10 +620,12 @@ void COptItem_TreeCtrl::MoveItem(HWND hWnd, HTREEITEM hItem, HTREEITEM hMoveTo)
}
else MoveToOrder = -1;
+ // can't move root items
if (ItemOrder <= TREECTRL_ROOTORDEROFFS)
- return; // can't move root items
+ return;
- if (m_value[ItemOrder].Flags & TIF_GROUP) { // need to check for a case when trying to move a group to its own subgroup.
+ // need to check for a case when trying to move a group to its own subgroup.
+ if (m_value[ItemOrder].Flags & TIF_GROUP) {
int Order = MoveToOrder;
while (Order >= 0) {
Order = IDToOrder(m_value[Order].ParentID);
@@ -784,9 +799,11 @@ void COptItem_ListCtrl::ModifyItem(HWND hWnd, int ID, CListItem &Item)
m_bModified = true;
}
-CListItem* COptItem_ListCtrl::InsertItem(HWND hWnd, int ID, CListItem &Item)
+/////////////////////////////////////////////////////////////////////////////////////////
// returns a pointer to the newly inserted item info
// ID is position at which to insert the item; -1 = add to the end of the list
+
+CListItem* COptItem_ListCtrl::InsertItem(HWND hWnd, int ID, CListItem &Item)
{
HWND hListView = GetDlgItem(hWnd, m_dlgItemID);
int Res = SendMessage(hListView, LB_INSERTSTRING, ID, (LPARAM)(wchar_t*)(Item.Text)); // LB_INSERTSTRING doesn't sort the lists even with LBS_SORT style
diff --git a/plugins/NewAwaySysMod/src/version.h b/plugins/NewAwaySysMod/src/version.h
index 2fc57d631e..48b2d776e9 100644
--- a/plugins/NewAwaySysMod/src/version.h
+++ b/plugins/NewAwaySysMod/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 4
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#include <stdver.h>