summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-15 15:31:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-15 15:31:06 +0300
commit3342dd204597c09bb726dfc1d7a0acbfd2fd5d8f (patch)
tree03d29ca3ad2c9918314f92ccfdbb515ecd510aa7
parentf52b5cc86d9eff2494902157c8fc0a4e019a3c95 (diff)
anonymous SRMM services got names
-rw-r--r--include/m_message.h9
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp4
-rw-r--r--plugins/Clist_modern/src/stdafx.h1
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp6
-rw-r--r--plugins/Clist_nicer/src/stdafx.h1
-rw-r--r--plugins/Scriver/src/msgs.cpp11
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/mim.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp5
-rw-r--r--protocols/MSN/src/msn_chat.cpp13
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp8
14 files changed, 36 insertions, 34 deletions
diff --git a/include/m_message.h b/include/m_message.h
index f892f10219..b2bbf34070 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -42,6 +42,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_MSG_SENDMESSAGEW "SRMsg/SendCommandW"
/////////////////////////////////////////////////////////////////////////////////////////
+// reads a message from contact list event structure
+// wParam = 0 (unused)
+// lParam = (CLISTEVT*)pEvent
+// always returns 0
+
+#define MS_MSG_READMESSAGE "SRMsg/ReadMessage"
+#define MS_MSG_TYPINGMESSAGE "SRMsg/TypingMessage"
+
+/////////////////////////////////////////////////////////////////////////////////////////
// gets fired when a message window appears/disappears
// wparam = 0
// lparam = (WPARAM)(MessageWindowEventData*)hWindowEvent;
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 377949ba85..c9e9a7702a 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -97,8 +97,8 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
if (p->pszService &&
- (!strncmp("SRMsg/ReadMessage", p->pszService, _countof("SRMsg/ReadMessage")) ||
- !strncmp("GChat/DblClickEvent", p->pszService, _countof("GChat/DblClickEvent")))) {
+ (!strncmp(MS_MSG_READMESSAGE, p->pszService, _countof(MS_MSG_READMESSAGE)) ||
+ !strncmp("GChat/DblClickEvent", p->pszService, _countof("GChat/DblClickEvent")))) {
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) {
if (GetMenuItemInfo(g_CluiData.hMenuNotify, j, TRUE, &mii) != 0) {
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h
index 5b1c5a4531..f2e3fbb331 100644
--- a/plugins/Clist_modern/src/stdafx.h
+++ b/plugins/Clist_modern/src/stdafx.h
@@ -82,6 +82,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_clist.h>
#include <m_skin.h>
#include <m_skin_eng.h>
+#include <m_message.h>
#include <m_skinbutton.h>
#include <m_contacts.h>
#include <m_avatars.h>
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index 7ea9af4889..e2cd2825d2 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -235,14 +235,14 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
CListEvent* AddEvent(CLISTEVENT *cle)
{
CListEvent *p = coreCli.pfnAddEvent(cle);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
if (p->hContact != 0 && p->hDbEvent != 1 && !(p->flags & CLEF_ONLYAFEW)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
- if (p->pszService && !strncmp("SRMsg/ReadMessage", p->pszService, 17)) {
+ if (!mir_strncmp(MS_MSG_READMESSAGE, p->pszService, _countof(MS_MSG_READMESSAGE))) {
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(cfg::dat.hMenuNotify); j++) {
if (GetMenuItemInfo(cfg::dat.hMenuNotify, j, TRUE, &mii) != 0) {
diff --git a/plugins/Clist_nicer/src/stdafx.h b/plugins/Clist_nicer/src/stdafx.h
index 23fe833568..35c41717fb 100644
--- a/plugins/Clist_nicer/src/stdafx.h
+++ b/plugins/Clist_nicer/src/stdafx.h
@@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_database.h>
#include <m_system.h>
#include <m_langpack.h>
+#include <m_message.h>
#include <m_avatars.h>
#include <m_button.h>
#include <m_options.h>
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index a335489ee8..8f583564b2 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -121,7 +121,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = toolTip;
pcli->pfnAddEvent(&cle);
}
@@ -204,7 +204,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
cle.hDbEvent = 1;
cle.flags = CLEF_ONLYAFEW | CLEF_UNICODE;
cle.hIcon = GetCachedIcon("scriver_TYPING");
- cle.pszService = "SRMsg/TypingMessage";
+ cle.pszService = MS_MSG_TYPINGMESSAGE;
cle.szTooltip.w = szTip;
pcli->pfnAddEvent(&cle);
}
@@ -271,7 +271,7 @@ static void RestoreUnreadMessageAlerts(void)
CLISTEVENT cle = {};
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.flags = CLEF_UNICODE;
cle.szTooltip.w = toolTip;
@@ -642,11 +642,10 @@ int OnLoadModule(void)
HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+ CreateServiceFunction(MS_MSG_READMESSAGE, ReadMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
-
- CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
- CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
+ CreateServiceFunction(MS_MSG_TYPINGMESSAGE, TypingMessageCommand);
SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index b47f1f6214..5b4539fb8f 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -529,7 +529,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void)
CLISTEVENT cle = {};
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.flags = CLEF_UNICODE;
cle.szTooltip.w = toolTip;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 10d092cb5e..5e613b9f6a 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -145,7 +145,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
CLISTEVENT *cli = pcli->pfnGetEvent(-1, 0);
if (cli != nullptr) {
- if (strncmp(cli->pszService, "SRMsg/TypingMessage", mir_strlen(cli->pszService))) {
+ if (strncmp(cli->pszService, MS_MSG_TYPINGMESSAGE, mir_strlen(cli->pszService))) {
CallService(cli->pszService, 0, (LPARAM)cli);
break;
}
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 63e9975081..a275fa74be 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -283,7 +283,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode)
cle.hDbEvent = 1;
cle.flags = CLEF_ONLYAFEW | CLEF_UNICODE;
cle.hIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
- cle.pszService = "SRMsg/TypingMessage";
+ cle.pszService = MS_MSG_TYPINGMESSAGE;
cle.szTooltip.w = szTip;
pcli->pfnAddEvent(&cle);
}
@@ -514,7 +514,7 @@ nowindowcreate:
cle.hDbEvent = hDbEvent;
cle.flags = CLEF_UNICODE;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
mir_snwprintf(toolTip, TranslateT("Message from %s"), contactName);
cle.szTooltip.w = toolTip;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index d28eaad284..f49abafe3c 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -777,7 +777,7 @@ void CTabBaseDlg::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei)
cle.hContact = m_hContact;
cle.hDbEvent = hEvent;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
pcli->pfnAddEvent(&cle);
m_dwFlagsEx |= MWF_SHOW_FLASHCLIST;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 3a88bd7ee1..2e7473b05a 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -1004,15 +1004,14 @@ static INT_PTR ReloadSettings(WPARAM, LPARAM lParam)
static void TSAPI InitAPI()
{
+ CreateServiceFunction(MS_MSG_READMESSAGE, ReadMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
+ CreateServiceFunction(MS_MSG_TYPINGMESSAGE, TypingMessageCommand);
CreateServiceFunction("TabSRMsg/ReloadSkin", ReloadSkin);
CreateServiceFunction("TabSRMsg/ReloadSettings", ReloadSettings);
- CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
- CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
-
CreateServiceFunction(MS_TABMSG_SETUSERPREFS, SetUserPrefs);
CreateServiceFunction(MS_TABMSG_TRAYSUPPORT, Service_OpenTrayMenu);
CreateServiceFunction(MS_TABMSG_SLQMGR, CSendLater::svcQMgr);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 9653c829b4..d6983751a5 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -506,12 +506,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
break;
case GC_USER_PRIVMESS:
- {
- char *email = mir_u2a(gch->ptszUID);
- MCONTACT hContact = MSN_HContactFromEmail(email);
- CallService(MS_MSG_SENDMESSAGE, hContact, 0);
- mir_free(email);
- }
+ CallService(MS_MSG_SENDMESSAGE, MSN_HContactFromEmail(_T2A(gch->ptszUID)), 0);
break;
case GC_USER_LOGMENU:
@@ -528,15 +523,13 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
break;
case GC_USER_NICKLISTMENU:
- MCONTACT hContact = MSN_HContactFromEmail(_T2A(gch->ptszUID));
-
switch (gch->dwData) {
case 10:
- CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ CallService(MS_USERINFO_SHOWDIALOG, MSN_HContactFromEmail(_T2A(gch->ptszUID)), 0);
break;
case 20:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, MSN_HContactFromEmail(_T2A(gch->ptszUID)), 0);
break;
case 30:
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index b0ba6ce84f..9c8c61f073 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -80,7 +80,7 @@ void CVkProto::AddCListEvent(bool bNews)
CLISTEVENT cle = {};
cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.flags = CLEF_URGENT | CLEF_UNICODE;
cle.hContact = hContact;
cle.hDbEvent = NULL;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 6d302f3111..0e8d6cf3ea 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -93,7 +93,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
cle.hDbEvent = lParam;
cle.flags = CLEF_UNICODE;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = toolTip;
pcli->pfnAddEvent(&cle);
return 0;
@@ -175,7 +175,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
cle.hDbEvent = 1;
cle.flags = CLEF_ONLYAFEW | CLEF_UNICODE;
cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_TYPING);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = szTip;
pcli->pfnAddEvent(&cle);
@@ -262,7 +262,7 @@ static void RestoreUnreadMessageAlerts(void)
CLISTEVENT cle = {};
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
+ cle.pszService = MS_MSG_READMESSAGE;
cle.flags = CLEF_UNICODE;
cle.szTooltip.w = toolTip;
@@ -503,7 +503,7 @@ int LoadSendRecvMessageModule(void)
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
- CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
+ CreateServiceFunction(MS_MSG_READMESSAGE, ReadMessageCommand);
SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));