summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-19 14:12:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-19 14:13:06 +0300
commite254312f9a660c83081ce2062ab14ba3c3614089 (patch)
tree324dff386c4b394ed4dc0f9b912ce3332bd94e84 /src
parent54ad7c456325b4c7fd639ef2d7cca7d5aef81c05 (diff)
useless structure GCDEST finally removed
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp4
-rw-r--r--src/mir_app/src/chat_manager.cpp2
-rw-r--r--src/mir_app/src/chat_svc.cpp45
-rw-r--r--src/mir_app/src/chat_tools.cpp14
4 files changed, 29 insertions, 36 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index 3afa17bccc..913c3d0987 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -121,14 +121,14 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive)
static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
- if (gce->pDest->iType & g_Settings.dwTrayIconFlags)
+ if (gce->iType & g_Settings.dwTrayIconFlags)
return oldDoTrayIcon(si, gce);
return TRUE;
}
static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
- if (gce->pDest->iType & g_Settings.dwPopupFlags)
+ if (gce->iType & g_Settings.dwPopupFlags)
return oldDoPopup(si, gce);
return TRUE;
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 141faa2be0..93f9ebe728 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -207,7 +207,7 @@ BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool
LOGINFO *li = chatApi.LM_AddEvent(&si->pLog, &si->pLogEnd);
si->iEventCount++;
- li->iType = gce->pDest->iType;
+ li->iType = gce->iType;
li->ptszNick = mir_wstrdup(gce->ptszNick);
li->ptszText = mir_wstrdup(gce->ptszText);
li->ptszStatus = mir_wstrdup(gce->ptszStatus);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 1de51605e6..2b4458593d 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -374,7 +374,7 @@ MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *wszId, bool
static void AddUser(GCEVENT *gce)
{
- SESSION_INFO *si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = chatApi.SM_FindSession(gce->ptszID, gce->pszModule);
if (si == nullptr)
return;
@@ -407,7 +407,7 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
for (int i = 0; i < g_arSessions.getCount(); i++) {
SESSION_INFO *si = g_arSessions[i];
- if (!si->bInitDone || mir_strcmpi(si->pszModule, gce->pDest->pszModule))
+ if (!si->bInitDone || mir_strcmpi(si->pszModule, gce->pszModule))
continue;
if (!chatApi.UM_FindUser(si->pUsers, gce->ptszUID))
@@ -443,13 +443,12 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
bool bIsHighlighted = false, bRemoveFlag = false;
// Do different things according to type of event
- GCDEST *gcd = gce->pDest;
- switch (gcd->iType) {
+ switch (gce->iType) {
case GC_EVENT_SETCONTACTSTATUS:
- return SM_SetContactStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
+ return SM_SetContactStatus(gce->ptszID, gce->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
case GC_EVENT_TOPIC:
- if (SESSION_INFO *si = chatApi.SM_FindSession(gcd->ptszID, gcd->pszModule)) {
+ if (SESSION_INFO *si = chatApi.SM_FindSession(gce->ptszID, gce->pszModule)) {
wchar_t *pwszNew = RemoveFormatting(gce->ptszText);
if (!mir_wstrcmp(si->ptszTopic, pwszNew)) // nothing changed? exiting
return 0;
@@ -473,25 +472,25 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
break;
case GC_EVENT_ADDSTATUS:
- SM_GiveStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, gce->ptszStatus);
+ SM_GiveStatus(gce->ptszID, gce->pszModule, gce->ptszUID, gce->ptszStatus);
bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_REMOVESTATUS:
- SM_TakeStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, gce->ptszStatus);
+ SM_TakeStatus(gce->ptszID, gce->pszModule, gce->ptszUID, gce->ptszStatus);
bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
- if (!gce->bIsMe && gcd->ptszID && gce->ptszText) {
- SESSION_INFO *si = chatApi.SM_FindSession(gcd->ptszID, gcd->pszModule);
+ if (!gce->bIsMe && gce->ptszID && gce->ptszText) {
+ SESSION_INFO *si = chatApi.SM_FindSession(gce->ptszID, gce->pszModule);
bIsHighlighted = chatApi.IsHighlighted(si, gce);
}
break;
case GC_EVENT_NICK:
- SM_ChangeNick(gcd->ptszID, gcd->pszModule, gce);
+ SM_ChangeNick(gce->ptszID, gce->pszModule, gce);
bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
@@ -511,13 +510,13 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
// Decide which window (log) should have the event
LPCTSTR pWnd = nullptr;
LPCSTR pMod = nullptr;
- if (gcd->ptszID) {
- pWnd = gcd->ptszID;
- pMod = gcd->pszModule;
+ if (gce->ptszID) {
+ pWnd = gce->ptszID;
+ pMod = gce->pszModule;
}
- else if (gcd->iType == GC_EVENT_NOTICE || gcd->iType == GC_EVENT_INFORMATION) {
+ else if (gce->iType == GC_EVENT_NOTICE || gce->iType == GC_EVENT_INFORMATION) {
SESSION_INFO *si = chatApi.GetActiveSession();
- if (si && !mir_strcmp(si->pszModule, gcd->pszModule)) {
+ if (si && !mir_strcmp(si->pszModule, gce->pszModule)) {
pWnd = si->ptszID;
pMod = si->pszModule;
}
@@ -538,13 +537,13 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
SESSION_INFO *si = chatApi.SM_FindSession(pWnd, pMod);
// fix for IRC's old style mode notifications. Should not affect any other protocol
- if ((gcd->iType == GC_EVENT_ADDSTATUS || gcd->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
+ if ((gce->iType == GC_EVENT_ADDSTATUS || gce->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
return 0;
- if (gcd->iType == GC_EVENT_JOIN && gce->time == 0)
+ if (gce->iType == GC_EVENT_JOIN && gce->time == 0)
return 0;
- if (si && (si->bInitDone || gcd->iType == GC_EVENT_TOPIC || (gcd->iType == GC_EVENT_JOIN && gce->bIsMe))) {
+ if (si && (si->bInitDone || gce->iType == GC_EVENT_TOPIC || (gce->iType == GC_EVENT_JOIN && gce->bIsMe))) {
if (gce->ptszNick == nullptr && gce->ptszUID != nullptr) {
USERINFO *ui = chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
if (ui != nullptr)
@@ -571,7 +570,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
}
if (bRemoveFlag)
- return SM_RemoveUser(gcd->ptszID, gcd->pszModule, gce->ptszUID) == 0;
+ return SM_RemoveUser(gce->ptszID, gce->pszModule, gce->ptszUID) == 0;
return GC_EVENT_ERROR;
}
@@ -581,11 +580,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
if (gce == nullptr)
return GC_EVENT_ERROR;
- GCDEST *gcd = gce->pDest;
- if (gcd == nullptr)
- return GC_EVENT_ERROR;
-
- if (!IsEventSupported(gcd->iType))
+ if (!IsEventSupported(gce->iType))
return GC_EVENT_ERROR;
return CallFunctionSync(sttEventStub, gce);
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 1bffbfb6a3..2d098c0e30 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -82,7 +82,7 @@ wchar_t* RemoveFormatting(const wchar_t *pszWord)
BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
- switch (gce->pDest->iType) {
+ switch (gce->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
chatApi.AddEvent(si->hContact, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), GC_FAKE_EVENT, 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
@@ -208,7 +208,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
- switch (gce->pDest->iType) {
+ switch (gce->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, chatApi.aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
@@ -275,10 +275,10 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
BOOL bInactive = si->pDlg == nullptr || GetForegroundWindow() != si->pDlg->GetHwnd();
- int iEvent = gce->pDest->iType;
+ int iEvent = gce->iType;
if (bHighlight) {
- gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
+ gce->iType |= GC_EVENT_HIGHLIGHT;
if (bInactive || !g_Settings->bSoundsFocus)
Skin_PlaySound("ChatHighlight");
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
@@ -492,7 +492,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
pszNick = szTemp;
}
- switch (gce->pDest->iType) {
+ switch (gce->iType) {
case GC_EVENT_MESSAGE:
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
@@ -611,8 +611,7 @@ MIR_APP_DLL(BOOL) Chat_DoEventHook(SESSION_INFO *si, int iType, const USERINFO *
if (si == nullptr)
return FALSE;
- GCDEST gcd = { si->pszModule, si->ptszID, iType };
- GCHOOK gch = { 0 };
+ GCHOOK gch = { si->pszModule, si->ptszID, iType };
if (pUser != nullptr) {
gch.ptszUID = pUser->pszUID;
gch.ptszNick = pUser->pszNick;
@@ -621,7 +620,6 @@ MIR_APP_DLL(BOOL) Chat_DoEventHook(SESSION_INFO *si, int iType, const USERINFO *
gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
- gch.pDest = &gcd;
NotifyEventHooks(hevSendEvent, 0, (WPARAM)&gch);
return TRUE;
}