diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-27 14:40:29 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-27 14:40:29 +0300 |
commit | 226f2fceddb5b81d5ba7a16729b4f07e53cfafb4 (patch) | |
tree | 77d177e5517eb8267c2755b97f4fe9a3d37d1a37 /src | |
parent | 15c49e3fc4cf033fffbf79e9f68a0405d5a95d14 (diff) |
obsolete services from m_ignore.h converted into functions
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/ignore.cpp | 47 | ||||
-rw-r--r-- | src/mir_app/src/meta_menu.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/meta_services.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/meta_utils.cpp | 19 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 3 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 3 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 2 |
7 files changed, 46 insertions, 32 deletions
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 231e4d5a0f..888aef29e2 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -340,45 +340,50 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) return 0;
}
-static INT_PTR IsIgnored(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(bool) Ignore_IsIgnored(MCONTACT hContact, int idx)
{
- DWORD mask = GetMask(wParam);
- if (lParam < 1 || lParam > IGNOREEVENT_MAX)
+ DWORD mask = GetMask(hContact);
+ if (idx < 1 || idx > IGNOREEVENT_MAX)
return 1;
- return (masks[lParam-1] & mask) != 0;
+ return (masks[idx-1] & mask) != 0;
}
-static INT_PTR Ignore(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Ignore_Ignore(MCONTACT hContact, int idx)
{
- DWORD mask = GetMask(wParam);
- if ((lParam < 1 || lParam > IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL)
+ DWORD mask = GetMask(hContact);
+ if ((idx < 1 || idx > IGNOREEVENT_MAX) && idx != IGNOREEVENT_ALL)
return 1;
- if (lParam == IGNOREEVENT_ALL)
+
+ if (idx == IGNOREEVENT_ALL)
mask = 0xFFFF;
else
- mask |= masks[lParam-1];
- SaveItemValue(wParam, "Mask1", mask);
+ mask |= masks[idx-1];
+ SaveItemValue(hContact, "Mask1", mask);
return 0;
}
-static INT_PTR Unignore(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Ignore_Allow(MCONTACT hContact, int idx)
{
- DWORD mask = GetMask(wParam);
- if ((lParam < 1 || lParam > IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL)
+ DWORD mask = GetMask(hContact);
+ if ((idx < 1 || idx > IGNOREEVENT_MAX) && idx != IGNOREEVENT_ALL)
return 1;
- if (lParam == IGNOREEVENT_ALL)
+ if (idx == IGNOREEVENT_ALL)
mask = 0;
else
- mask &= ~(masks[lParam-1]);
- SaveItemValue(wParam, "Mask1", mask);
+ mask &= ~(masks[idx-1]);
+ SaveItemValue(hContact, "Mask1", mask);
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR IgnoreRecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- if (IsIgnored(ccs->hContact, IGNOREEVENT_MESSAGE))
+ if (Ignore_IsIgnored(ccs->hContact, IGNOREEVENT_MESSAGE))
return 1;
return Proto_ChainRecv(wParam, ccs);
}
@@ -386,7 +391,7 @@ static INT_PTR IgnoreRecvMessage(WPARAM wParam, LPARAM lParam) static INT_PTR IgnoreRecvFile(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- if (IsIgnored(ccs->hContact, IGNOREEVENT_FILE))
+ if (Ignore_IsIgnored(ccs->hContact, IGNOREEVENT_FILE))
return 1;
return Proto_ChainRecv(wParam, ccs);
}
@@ -394,7 +399,7 @@ static INT_PTR IgnoreRecvFile(WPARAM wParam, LPARAM lParam) static INT_PTR IgnoreRecvAuth(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- if (IsIgnored(ccs->hContact, IGNOREEVENT_AUTHORIZATION))
+ if (Ignore_IsIgnored(ccs->hContact, IGNOREEVENT_AUTHORIZATION))
return 1;
return Proto_ChainRecv(wParam, ccs);
}
@@ -407,10 +412,6 @@ int LoadIgnoreModule(void) CreateProtoServiceFunction("Ignore", PSR_FILE, IgnoreRecvFile);
CreateProtoServiceFunction("Ignore", PSR_AUTH, IgnoreRecvAuth);
- CreateServiceFunction(MS_IGNORE_ISIGNORED, IsIgnored);
- CreateServiceFunction(MS_IGNORE_IGNORE, Ignore);
- CreateServiceFunction(MS_IGNORE_UNIGNORE, Unignore);
-
HookEvent(ME_OPT_INITIALISE, IgnoreOptInitialise);
return 0;
}
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 5d9a53e492..3c9ac140bd 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -100,7 +100,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI // stop ignoring, if we were
if (g_metaOptions.bSuppressStatus)
- CallService(MS_IGNORE_UNIGNORE, ccSub->contactID, IGNOREEVENT_USERONLINE);
+ Ignore_Allow(ccSub->contactID, IGNOREEVENT_USERONLINE);
}
}
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index ad63a46862..769cbdabca 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -478,7 +478,7 @@ int Meta_ContactDeleted(WPARAM hContact, LPARAM) // stop ignoring, if we were
if (g_metaOptions.bSuppressStatus)
- CallService(MS_IGNORE_UNIGNORE, cc->pSubs[i], IGNOREEVENT_USERONLINE);
+ Ignore_Allow(cc->pSubs[i], IGNOREEVENT_USERONLINE);
}
return 0;
}
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index 7d0cee5982..09c61b98d1 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -182,7 +182,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) // Ignore status if the option is on
if (g_metaOptions.bSuppressStatus)
- CallService(MS_IGNORE_IGNORE, hSub, IGNOREEVENT_USERONLINE);
+ Ignore_Ignore(hSub, IGNOREEVENT_USERONLINE);
NotifyEventHooks(hSubcontactsChanged, hMeta, 0);
return TRUE;
@@ -373,7 +373,7 @@ int Meta_HideLinkedContacts(void) }
if (g_metaOptions.bSuppressStatus)
- CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
+ Ignore_Ignore(hContact, IGNOREEVENT_USERONLINE);
MCONTACT hMostOnline = Meta_GetMostOnline(ccMeta); // set nick
Meta_CopyContactNick(ccMeta, hMostOnline);
@@ -393,7 +393,10 @@ int Meta_HideMetaContacts(bool bHide) DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc->IsSub()) { // show on hide, reverse flag
bSet = !bHide;
- CallService(bSuppress ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
+ if (bSuppress)
+ Ignore_Ignore(hContact, IGNOREEVENT_USERONLINE);
+ else
+ Ignore_Allow(hContact, IGNOREEVENT_USERONLINE);
}
else if (cc->IsMeta())
bSet = bHide;
@@ -412,11 +415,15 @@ int Meta_HideMetaContacts(bool bHide) return 0;
}
-int Meta_SuppressStatus(bool suppress)
+int Meta_SuppressStatus(bool bSuppress)
{
for (auto &hContact : Contacts())
- if (db_mc_isSub(hContact))
- CallService((suppress) ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
+ if (db_mc_isSub(hContact)) {
+ if (bSuppress)
+ Ignore_Ignore(hContact, IGNOREEVENT_USERONLINE);
+ else
+ Ignore_Allow(hContact, IGNOREEVENT_USERONLINE);
+ }
return 0;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8a0d8aaa07..3f53cf195b 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -690,3 +690,6 @@ Clist_GetGroup @775 Clist_SetGroup @776
?ReportSelfAvatarChanged@PROTO_INTERFACE@@QAEXXZ @777 NONAME
Miranda_GetIdle @778 NONAME
+Ignore_Allow @779
+Ignore_Ignore @780
+Ignore_IsIgnored @781
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index d302dbff59..b933dcd83a 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -690,3 +690,6 @@ Clist_GetGroup @775 Clist_SetGroup @776
?ReportSelfAvatarChanged@PROTO_INTERFACE@@QEAAXXZ @777 NONAME
Miranda_GetIdle @778 NONAME
+Ignore_Allow @779
+Ignore_Ignore @780
+Ignore_IsIgnored @781
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 28a893f770..a717d6f2fe 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -219,7 +219,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) if (!szProto)
return 0;
- if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_TYPINGNOTIFY))
+ if (Ignore_IsIgnored(wParam, IGNOREEVENT_TYPINGNOTIFY))
return 0;
if (type < PROTOTYPE_CONTACTTYPING_OFF)
|