summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-06 16:15:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-06 16:15:19 +0000
commit3bb087726db613aad9c1e61332fda7300600f60c (patch)
treea31945932779db8ba24f83e7bbaba16ae95dfb95 /src
parent910d3cab907dc5649a01bab756dc78af74a23981 (diff)
clist services' extermination continued
git-svn-id: http://svn.miranda-ng.org/main/trunk@17265 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/addcontact.cpp4
-rw-r--r--src/mir_app/src/clc.cpp4
-rw-r--r--src/mir_app/src/clcutils.cpp2
-rw-r--r--src/mir_app/src/clistmod.cpp43
-rw-r--r--src/mir_app/src/contact.cpp12
-rw-r--r--src/mir_app/src/menu_utils.cpp16
-rw-r--r--src/mir_app/src/meta_services.cpp4
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/miranda.h2
-rw-r--r--src/mir_app/src/movetogroup.cpp2
11 files changed, 40 insertions, 55 deletions
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 5a3ef8408a..87d34fbdb3 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -202,7 +202,7 @@ public:
int item = m_group.GetCurSel();
if (item > 0)
- CallService(MS_CLIST_CONTACTCHANGEGROUP, hContact, m_group.GetItemData(item));
+ Clist_ContactChangeGroup(hContact, m_group.GetItemData(item));
db_unset(hContact, "CList", "NotOnList");
@@ -218,7 +218,7 @@ public:
}
if (m_chkOpen.GetState())
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, hContact, 0);
+ Clist_ContactDoubleClicked(hContact);
}
};
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index aa01ae56bb..f0f947ad0f 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -1101,7 +1101,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
cli.pfnGetRowByIndex(dat, dat->selection, &contactn, NULL);
cli.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, NULL);
if (contacto->type == CLCIT_CONTACT) //dropee is a contact
- CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId);
+ Clist_ContactChangeGroup(contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
mir_snwprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
@@ -1147,7 +1147,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
Clist_GroupRename(contact->groupId, szNewName);
}
else if (contact->type == CLCIT_CONTACT) //dropee is a contact
- CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contact->hContact, 0);
+ Clist_ContactChangeGroup(contact->hContact, 0);
}
}
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index de469d6a17..6b10fd8e65 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -357,7 +357,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat)
if (contact->type == CLCIT_GROUP)
cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
if (contact->type == CLCIT_CONTACT)
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)contact->hContact, 0);
+ Clist_ContactDoubleClicked(contact->hContact);
}
int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index edba951768..13f82b29ae 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -23,9 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
+
#include "clc.h"
+#include "genmenu.h"
-INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam);
int InitCListEvents(void);
void UninitCListEvents(void);
void UninitGroupServices(void);
@@ -221,19 +222,25 @@ static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam)
return 0;
}
-static INT_PTR ContactDoubleClicked(WPARAM wParam, LPARAM)
+MIR_APP_DLL(void) Clist_ContactDoubleClicked(MCONTACT hContact)
{
// Try to process event myself
- if (cli.pfnEventsProcessContactDoubleClick(wParam) == 0)
- return 0;
+ if (cli.pfnEventsProcessContactDoubleClick(hContact) == 0)
+ return;
// Allow third-party plugins to process a dblclick
- if (NotifyEventHooks(hContactDoubleClicked, wParam, 0))
- return 0;
+ if (NotifyEventHooks(hContactDoubleClicked, hContact, 0))
+ return;
// Otherwise try to execute the default action
- TryProcessDoubleClick(wParam);
- return 0;
+ TIntMenuObject *pmo = GetMenuObjbyId(hContactMenuObject);
+ if (pmo != NULL) {
+ NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0);
+
+ TMO_IntMenuItem *pimi = Menu_GetDefaultItem(pmo->m_items.first);
+ if (pimi != NULL)
+ Menu_ProcessCommand(pimi, hContact);
+ }
}
static INT_PTR GetIconsImageList(WPARAM, LPARAM)
@@ -241,12 +248,6 @@ static INT_PTR GetIconsImageList(WPARAM, LPARAM)
return (INT_PTR)hCListImages;
}
-static INT_PTR ContactFilesDropped(WPARAM wParam, LPARAM lParam)
-{
- CallService(MS_FILE_SENDSPECIFICFILES, wParam, lParam);
- return 0;
-}
-
static int CListIconsChanged(WPARAM, LPARAM)
{
for (int i = 0; i < _countof(statusModeList); i++)
@@ -398,13 +399,14 @@ void fnChangeContactIcon(MCONTACT hContact, int iIcon)
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hContact2)
{
- ClcContact *p1, *p2;
ClcData *dat = (ClcData*)GetWindowLongPtr(cli.hwndContactTree, 0);
- if (dat != NULL)
- if (!cli.pfnFindItem(cli.hwndContactTree, dat, wParam, &p1, NULL, NULL) && !cli.pfnFindItem(cli.hwndContactTree, dat, lParam, &p2, NULL, NULL))
+ if (dat != NULL) {
+ ClcContact *p1, *p2;
+ if (!cli.pfnFindItem(cli.hwndContactTree, dat, hContact1, &p1, NULL, NULL) && !cli.pfnFindItem(cli.hwndContactTree, dat, hContact2, &p2, NULL, NULL))
return cli.pfnCompareContacts(p1, p2);
+ }
return 0;
}
@@ -423,11 +425,6 @@ int LoadContactListModule2(void)
hContactDoubleClicked = CreateHookableEvent(ME_CLIST_DOUBLECLICKED);
hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED);
- CreateServiceFunction(MS_CLIST_CONTACTDOUBLECLICKED, ContactDoubleClicked);
- CreateServiceFunction(MS_CLIST_CONTACTFILESDROPPED, ContactFilesDropped);
- CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts);
- CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup);
-
InitCListEvents();
InitGroupServices();
cli.pfnInitTray();
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp
index c482deed19..430c699a1d 100644
--- a/src/mir_app/src/contact.cpp
+++ b/src/mir_app/src/contact.cpp
@@ -46,18 +46,18 @@ void fnLoadContactTree(void)
Clist_EndRebuild();
}
-INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Clist_ContactChangeGroup(MCONTACT hContact, MGROUP hGroup)
{
CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, NULL };
- if (lParam == NULL)
- db_unset(wParam, "CList", "Group");
+ if (hGroup == NULL)
+ db_unset(hContact, "CList", "Group");
else {
- grpChg.pszNewName = Clist_GroupGetName(lParam, NULL);
- db_set_ws(wParam, "CList", "Group", grpChg.pszNewName);
+ grpChg.pszNewName = Clist_GroupGetName(hGroup, NULL);
+ db_set_ws(hContact, "CList", "Group", grpChg.pszNewName);
}
- NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg);
+ NotifyEventHooks(hGroupChangeEvent, hContact, (LPARAM)&grpChg);
return 0;
}
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp
index 30a2a02eec..76955d5ae4 100644
--- a/src/mir_app/src/menu_utils.cpp
+++ b/src/mir_app/src/menu_utils.cpp
@@ -1273,22 +1273,6 @@ int RegisterAllIconsInIconLib()
return 0;
}
-int TryProcessDoubleClick(MCONTACT hContact)
-{
- TIntMenuObject *pmo = GetMenuObjbyId(hContactMenuObject);
- if (pmo != NULL) {
- NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0);
-
- TMO_IntMenuItem *pimi = Menu_GetDefaultItem(pmo->m_items.first);
- if (pimi != NULL) {
- Menu_ProcessCommand(pimi, hContact);
- return 0;
- }
- }
-
- return 1;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Static services
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 3393c14a69..7a862f79df 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -695,10 +695,10 @@ INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam)
CallService(MS_MSG_SENDMESSAGEW, hMeta, 0);
}
else // protocol does not support messaging - simulate double click
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, hContact, 0);
+ Clist_ContactDoubleClicked(hContact);
}
else // protocol does not support messaging - simulate double click
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, hContact, 0);
+ Clist_ContactDoubleClicked(hContact);
}
else if (options.menu_function == FT_MENU) // show contact's context menu
CallFunctionAsync(sttMenuThread, (void*)hContact);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 832cbb31b9..4f2eee5936 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -268,3 +268,6 @@ Clist_BroadcastAsync @267
Clist_MenuProcessCommand @268
Clist_IsDocked @269
Clist_MenuProcessHotkey @270
+Clist_ContactChangeGroup @271
+Clist_ContactCompare @272
+Clist_ContactDoubleClicked @273
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index d4dbb2fe8f..a046bfaf97 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -268,3 +268,6 @@ Clist_BroadcastAsync @267
Clist_MenuProcessCommand @268
Clist_IsDocked @269
Clist_MenuProcessHotkey @270
+Clist_ContactChangeGroup @271
+Clist_ContactCompare @272
+Clist_ContactDoubleClicked @273
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index c83fa8e4bf..3f3888f216 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -123,8 +123,6 @@ extern const int skinIconStatusFlags[ MAX_STATUS_COUNT ];
extern OBJLIST<CListEvent> g_cliEvents;
-int TryProcessDoubleClick(MCONTACT hContact);
-
/**** protocols.cpp *********************************************************************/
#define OFFSET_PROTOPOS 200
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp
index 6f229c38d7..aa5fbb7091 100644
--- a/src/mir_app/src/movetogroup.cpp
+++ b/src/mir_app/src/movetogroup.cpp
@@ -124,7 +124,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
static INT_PTR MTG_DOMOVE(WPARAM wParam, LPARAM lParam)
{
- CallService(MS_CLIST_CONTACTCHANGEGROUP, wParam, lParam < 0 ? 0 : lParam);
+ Clist_ContactChangeGroup(wParam, lParam < 0 ? 0 : lParam);
return 0;
}