diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-27 23:43:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-27 23:43:06 +0300 |
commit | e441a31e9f912fc8e9244d16560565559b1924d2 (patch) | |
tree | e9d47703f0e56bb5745e7e4e842d14ce989fe86d /src/mir_app | |
parent | 91811190c158e4ff97cc94ef93415c12ddf738ed (diff) |
end of manual experiments with CList/NotOnList
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/addcontact.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/auth.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/contacts.cpp | 17 | ||||
-rw-r--r-- | src/mir_app/src/ignore.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_clist.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/meta_utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 3 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 3 |
10 files changed, 34 insertions, 11 deletions
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 4d89422941..634ef8a50e 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -146,7 +146,7 @@ public: if (item > 0)
Clist_ContactChangeGroup(hContact, m_group.GetItemData(item));
- db_unset(hContact, "CList", "NotOnList");
+ Contact_PutOnList(hContact);
if (m_chkAuth.GetState()) {
DWORD flags = CallProtoServiceInt(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp index 11b834b36c..c17866e93a 100644 --- a/src/mir_app/src/auth.cpp +++ b/src/mir_app/src/auth.cpp @@ -117,7 +117,7 @@ public: SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr); SetDlgItemText(m_hwnd, IDC_REASON, reasonT); - if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact)) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE); SendDlgItemMessage(m_hwnd, IDC_DENYREASON, EM_LIMITTEXT, 255, 0); @@ -126,7 +126,7 @@ public: SetDlgItemText(m_hwnd, IDC_DENYREASON, TranslateT("Feature is not supported by protocol")); } - if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) { + if (Contact_OnList(m_hContact)) { chkAdd.Disable(); chkAdd.SetState(false); } @@ -254,7 +254,7 @@ public: mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT.get() : TranslateT("(Unknown)"), acc->tszAccountName); SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr); - if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact)) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE); return true; } @@ -276,7 +276,7 @@ public: { Contact_AddByEvent(m_hDbEvent, m_hwnd); - if (m_hContact == INVALID_CONTACT_ID || !db_get_b(m_hContact, "CList", "NotOnList", 0)) + if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact)) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE); } diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index ac6e365177..17da6a7888 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -201,7 +201,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact cc->flags |= CONTACTF_VISTO; else if (apparentMode) cc->flags |= CONTACTF_VISTO | CONTACTF_INVISTO; - if (db_get_b(hContact, "CList", "NotOnList", 0)) + if (!Contact_OnList(hContact)) cc->flags |= CONTACTF_NOTONLIST; DWORD idleMode = szProto != nullptr ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index ed2f250eb5..7769183396 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -239,7 +239,7 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) {
RECT rc, rcWin, rcWorkArea;
POINT pt;
- register int i, j, width, height, iCountedDots = 0, iNotCoveredDots = 0;
+ int i, j, width, height, iCountedDots = 0, iNotCoveredDots = 0;
BOOL bPartiallyCovered = FALSE;
HWND hAux = nullptr;
@@ -405,7 +405,7 @@ void UnloadContactListModule() // remove transitory contacts
for (MCONTACT hContact = db_find_first(); hContact != 0; ) {
MCONTACT hNext = db_find_next(hContact);
- if (db_get_b(hContact, "CList", "NotOnList", 0))
+ if (!Contact_OnList(hContact))
db_delete_contact(hContact);
hContact = hNext;
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index daf95dbf86..afd191c9b0 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -294,6 +294,23 @@ MIR_APP_DLL(void) Contact_Hide(MCONTACT hContact, bool bHidden) db_unset(hContact, "CList", "Hidden");
}
+///////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(bool) Contact_OnList(MCONTACT hContact)
+{
+ return db_get_b(hContact, "CList", "NotOnList", 0) == 0;
+}
+
+MIR_APP_DLL(void) Contact_PutOnList(MCONTACT hContact)
+{
+ db_unset(hContact, "CList", "NotOnList");
+}
+
+MIR_APP_DLL(void) Contact_RemoveFromList(MCONTACT hContact)
+{
+ db_set_b(hContact, "CList", "NotOnList", 1);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Options dialog
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 56c38e303f..9832bf56e1 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -38,7 +38,7 @@ static DWORD GetMask(MCONTACT hContact) if (hContact == 0)
mask = 0;
else {
- if (Contact_IsHidden(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
+ if (Contact_IsHidden(hContact) || !Contact_OnList(hContact))
mask = db_get_dw(0, "Ignore", "Mask1", 0);
else
mask = db_get_dw(0, "Ignore", "Default1", 0);
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 181df23c64..2f16fe578f 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -229,7 +229,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact) BuildContactParam bcp;
bcp.szProto = szProto;
- bcp.isOnList = (db_get_b(hContact, "CList", "NotOnList", 0) == 0);
+ bcp.isOnList = Contact_OnList(hContact);
bcp.isOnline = (szProto != nullptr && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE));
HMENU hMenu = CreatePopupMenu();
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index e16a24d00b..9bae3558e5 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -79,7 +79,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) }
// Check that is is 'on the list'
- if (db_get_b(hSub, "CList", "NotOnList", 0) == 1) {
+ if (!Contact_OnList(hSub)) {
MessageBox(nullptr, TranslateT("Contact is 'not on list' - please add the contact to your contact list before assigning."), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
db_free(&dbv);
return FALSE;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index a31384307a..5bfcbfed5a 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -693,3 +693,6 @@ Miranda_GetIdle @778 NONAME Ignore_Allow @779
Ignore_Ignore @780
Ignore_IsIgnored @781
+Contact_OnList @782
+Contact_PutOnList @783
+Contact_RemoveFromList @784
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index c92292f409..3a5645f024 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -693,3 +693,6 @@ Miranda_GetIdle @778 NONAME Ignore_Allow @779
Ignore_Ignore @780
Ignore_IsIgnored @781
+Contact_OnList @782
+Contact_PutOnList @783
+Contact_RemoveFromList @784
|