From 36efd5151e53f6ebae280ca9992a1fa824086aef Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Nov 2023 17:44:50 +0300 Subject: added ability to mark contacts as read-only --- include/m_contacts.h | 6 ++++++ libs/win32/mir_app.lib | Bin 272870 -> 273396 bytes libs/win64/mir_app.lib | Bin 272104 -> 272630 bytes src/mir_app/src/contacts.cpp | 15 +++++++++++++++ src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ 6 files changed, 25 insertions(+) diff --git a/include/m_contacts.h b/include/m_contacts.h index 3cea1e17d6..3435fe19e4 100644 --- a/include/m_contacts.h +++ b/include/m_contacts.h @@ -95,6 +95,12 @@ namespace Contact MIR_APP_DLL(bool) IsHidden(MCONTACT hContact); MIR_APP_DLL(void) Hide(MCONTACT hContact, bool bHidden = true); + ///////////////////////////////////////////////////////////////////////////////////////// + // gets / sets read-only status for a contact + + MIR_APP_DLL(bool) IsReadonly(MCONTACT hContact); + MIR_APP_DLL(void) Readonly(MCONTACT hContact, bool bReadOnly = true); + ///////////////////////////////////////////////////////////////////////////////////////// // checks / adds / removes a contact from list of contacts // removed contacts would be physically deleted after restart diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index e3fa4aed2e..db0f15fec3 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 e2288c68aa..72e66630fd 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 94d6313df8..a486cc988c 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -306,6 +306,21 @@ MIR_APP_DLL(void) Contact::Hide(MCONTACT hContact, bool bHidden) /////////////////////////////////////////////////////////////////////////////// +MIR_APP_DLL(bool) Contact::IsReadonly(MCONTACT hContact) +{ + return db_get_b(hContact, "CList", "ReadOnly") != 0; +} + +MIR_APP_DLL(void) Contact::Readonly(MCONTACT hContact, bool bReadOnly) +{ + if (bReadOnly) + db_set_b(hContact, "CList", "ReadOnly", 1); + else + db_unset(hContact, "CList", "ReadOnly"); +} + +/////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(bool) Contact::OnList(MCONTACT hContact) { return db_get_b(hContact, "CList", "NotOnList", 0) == 0; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index c670d01805..bd9234ca7e 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -909,3 +909,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@PAVCMsgDialog@@@Z @1027 NONAME ?addColor@CMPluginBase@@QAEHPBD0PB_W1K@Z @1028 NONAME ?addFont@CMPluginBase@@QAEHPBD0PB_W111HHPAUtagLOGFONTW@@K@Z @1029 NONAME +?IsReadonly@Contact@@YG_NI@Z @1030 NONAME +?Readonly@Contact@@YGXI_N@Z @1031 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index fd393985c3..478cde2493 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -909,3 +909,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@PEAVCMsgDialog@@@Z @1027 NONAME ?addColor@CMPluginBase@@QEAAHPEBD0PEB_W1K@Z @1028 NONAME ?addFont@CMPluginBase@@QEAAHPEBD0PEB_W111HHPEAUtagLOGFONTW@@K@Z @1029 NONAME +?IsReadonly@Contact@@YA_NI@Z @1030 NONAME +?Readonly@Contact@@YAXI_N@Z @1031 NONAME -- cgit v1.2.3