summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp18
-rw-r--r--src/core/stdmsg/src/chat_util.cpp2
-rw-r--r--src/core/stdmsg/src/chat_window.cpp117
-rw-r--r--src/core/stdmsg/src/stdafx.h2
-rw-r--r--src/mir_app/src/chat.h3
-rw-r--r--src/mir_app/src/chat_manager.cpp3
-rw-r--r--src/mir_app/src/chat_svc.cpp23
-rw-r--r--src/mir_app/src/chat_tools.cpp2
8 files changed, 75 insertions, 95 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index a32ffae315..d22366faff 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -149,17 +149,11 @@ static void OnCreateModule(MODULEINFO *mi)
ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
}
-static void OnAddLog(SESSION_INFO *si, int isOk)
+static void OnAddLog(SESSION_INFO *si)
{
- if (isOk && si->hWnd) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
- }
- else if (si->hWnd) {
+ if (si->hWnd) {
g_TabSession.pLog = si->pLog;
g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
}
@@ -224,15 +218,9 @@ static void OnOfflineSession(SESSION_INFO *si)
static void OnEventBroadcast(SESSION_INFO *si, GCEVENT *gce)
{
- if (pci->SM_AddEvent(si->ptszID, si->pszModule, gce, FALSE) && si->hWnd && si->bInitDone) {
- g_TabSession.pLog = si->pLog;
- g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
- }
- else if (si->hWnd && si->bInitDone) {
+ if (si->hWnd && si->bInitDone) {
g_TabSession.pLog = si->pLog;
g_TabSession.pLogEnd = si->pLogEnd;
- SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
}
diff --git a/src/core/stdmsg/src/chat_util.cpp b/src/core/stdmsg/src/chat_util.cpp
index 39521530b6..566c29f442 100644
--- a/src/core/stdmsg/src/chat_util.cpp
+++ b/src/core/stdmsg/src/chat_util.cpp
@@ -51,7 +51,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw)
{
if (hwndDlg == 0 || lin == 0 || si == 0)
return;
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 30f03c8421..c257c2c1a4 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -216,6 +216,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
{
SESSION_INFO *Parentsi = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CHARRANGE sel;
switch (msg) {
case EM_SUBCLASSED:
@@ -269,8 +270,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
}
}
- else
- dat->lastEnterTime = 0;
+ else dat->lastEnterTime = 0;
if (wParam == 1 && isCtrl && !isAlt) { //ctrl-a
SendMessage(hwnd, EM_SETSEL, 0, -1);
@@ -526,8 +526,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return TRUE;
}
}
- //fall through
-
+
+ // fall through
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_KILLFOCUS:
@@ -536,7 +536,6 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_RBUTTONDOWN:
{
- CHARRANGE sel, all = { 0, -1 };
HMENU hSubMenu = GetSubMenu(g_hMenu, 4);
TranslateMenu(hSubMenu);
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
@@ -553,6 +552,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
pt.y = (short)HIWORD(lParam);
ClientToScreen(hwnd, &pt);
+ CHARRANGE all = { 0, -1 };
UINT uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
switch (uID) {
case 0:
@@ -579,7 +579,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case ID_MESSAGE_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
break;
case ID_MESSAGE_CLEAR:
@@ -761,9 +761,10 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ CHARRANGE sel;
+
switch (msg) {
case WM_LBUTTONUP:
- CHARRANGE sel;
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
SendMessage(hwnd, WM_COPY, 0, 0);
@@ -810,18 +811,14 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
tci.flags = TCHT_ONITEM;
-
ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
+ int i = TabCtrl_HitTest(hwnd, &tci);
if (i != -1) {
TCITEM tc;
- SESSION_INFO *s = NULL;
-
tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
- s = (SESSION_INFO*)tc.lParam;
+ SESSION_INFO *s = (SESSION_INFO*)tc.lParam;
if (s) {
BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE ? TRUE : FALSE;
MODULEINFO *mi = pci->MM_FindModule(s->pszModule);
@@ -873,7 +870,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case WM_LBUTTONDBLCLK:
{
- TCHITTESTINFO tci = { 0 };
+ TCHITTESTINFO tci = {};
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
tci.flags = TCHT_ONITEM;
@@ -886,7 +883,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
break;
case WM_MBUTTONUP:
- TCHITTESTINFO tci = { 0 };
+ TCHITTESTINFO tci = {};
tci.pt.x = (short)LOWORD(GetMessagePos());
tci.pt.y = (short)HIWORD(GetMessagePos());
tci.flags = TCHT_ONITEM;
@@ -1067,13 +1064,14 @@ static void __cdecl phase2(void * lParam)
SESSION_INFO *si = (SESSION_INFO*)lParam;
Sleep(30);
if (si && si->hWnd)
- PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
+ PostMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *s, *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
RECT rc;
+ CHARRANGE sel;
switch (uMsg) {
case WM_INITDIALOG:
@@ -1112,7 +1110,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (g_Settings.bTabsEnable && g_Settings.TabRestore) {
TABLIST *node = g_TabList;
while (node) {
- SESSION_INFO *s = pci->SM_FindSession(node->pszID, node->pszModule);
+ s = pci->SM_FindSession(node->pszID, node->pszModule);
if (s)
SendMessage(hwndDlg, GC_ADDTAB, -1, (LPARAM)s);
@@ -1133,10 +1131,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
case GC_SETWNDPROPS:
+ InitButtons(hwndDlg, si);
{
- InitButtons(hwndDlg, si);
-
- // stupid hack to make icons show. I dunno why this is needed currently
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
HICON hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
if (!hIcon) {
@@ -1334,10 +1330,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0)
index++;
}
- Log_StreamInEvent(hwndDlg, pLog, si, TRUE, FALSE);
+ Log_StreamInEvent(hwndDlg, pLog, si, TRUE);
mir_forkthread(phase2, si);
}
- else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
+ else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
}
else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1345,18 +1341,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case GC_REDRAWLOG2:
si->LastTime = 0;
if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
- break;
-
- case GC_REDRAWLOG3:
- si->LastTime = 0;
- if (si->pLog)
- Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, TRUE);
+ Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
break;
case GC_ADDLOG:
if (si->pLogEnd)
- Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
+ Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
else
SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1423,7 +1413,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else i = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- END_REMOVETAB:
+END_REMOVETAB:
if (i != -1 && i < tabId) {
TCITEM id = { 0 };
TabCtrl_DeleteItem(GetDlgItem(hwndDlg, IDC_TAB), i);
@@ -1435,7 +1425,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
}
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
+ s = (SESSION_INFO*)id.lParam;
if (s)
pci->ShowRoom(s, (WPARAM)WINDOW_VISIBLE, wParam == 1 ? FALSE : TRUE);
}
@@ -1586,7 +1576,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TCITEM id = { 0 };
id.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
+ s = (SESSION_INFO*)id.lParam;
if (s) {
if (s->wState & STATE_TALK) {
s->wState &= ~STATE_TALK;
@@ -1887,7 +1877,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
scroll.nPos = scroll.nMax - scroll.nPage + 1;
SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &scroll, TRUE);
- CHARRANGE sel;
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
PostMessage(GetDlgItem(hwndDlg, IDC_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
@@ -1920,7 +1909,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TCITEM tci;
tci.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &tci);
- SESSION_INFO *s = (SESSION_INFO*)tci.lParam;
+ s = (SESSION_INFO*)tci.lParam;
if (s) {
s->wState &= ~GC_EVENT_HIGHLIGHT;
s->wState &= ~STATE_TALK;
@@ -1962,11 +1951,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TCITEM id = { 0 };
id.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
ClientToScreen(GetDlgItem(hwndDlg, IDC_TAB), &tci.pt);
HMENU hSubMenu = GetSubMenu(g_hMenu, 5);
TranslateMenu(hSubMenu);
+
+ s = (SESSION_INFO*)id.lParam;
if (s) {
WORD w = db_get_w(s->hContact, s->pszModule, "TabPosition", 0);
if (w == 0)
@@ -2018,19 +2008,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case EN_MSGFILTER:
if (((LPNMHDR)lParam)->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
- CHARRANGE sel, all = { 0, -1 };
- POINT pt;
- UINT uID = 0;
- HMENU hMenu = 0;
- wchar_t pszWord[4096];
-
- pt.x = (short)LOWORD(((ENLINK *)lParam)->lParam);
- pt.y = (short)HIWORD(((ENLINK *)lParam)->lParam);
+ POINT pt = { GET_X_LPARAM(((ENLINK *)lParam)->lParam), GET_Y_LPARAM(((ENLINK *)lParam)->lParam) };
ClientToScreen(((LPNMHDR)lParam)->hwndFrom, &pt);
// fixing stuff for searches
- pszWord[0] = '\0';
-
POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
ScreenToClient(GetDlgItem(hwndDlg, IDC_LOG), (LPPOINT)&ptl);
long iCharIndex = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_CHARFROMPOS, 0, (LPARAM)&ptl);
@@ -2040,22 +2021,21 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
long start = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
long end = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
+ wchar_t pszWord[4096]; pszWord[0] = '\0';
if (end - start > 0) {
TEXTRANGE tr;
- memset(&tr, 0, sizeof(TEXTRANGE));
-
- CHARRANGE cr;
- cr.cpMin = start;
- cr.cpMax = end;
- tr.chrg = cr;
tr.lpstrText = pszWord;
+ tr.chrg.cpMin = start;
+ tr.chrg.cpMax = end;
long iRes = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (iRes > 0)
for (size_t iLen = mir_wstrlen(pszWord) - 1; wcschr(szTrimString, pszWord[iLen]); iLen--)
pszWord[iLen] = 0;
}
- uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
+ CHARRANGE all = { 0, -1 };
+ HMENU hMenu = 0;
+ UINT uID = CreateGCMenu(hwndDlg, &hMenu, 1, pt, si, NULL, pszWord);
switch (uID) {
case 0:
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -2063,26 +2043,24 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case ID_COPYALL:
SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)& all);
+ SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
SendMessage(((LPNMHDR)lParam)->hwndFrom, WM_COPY, 0, 0);
SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
break;
case ID_CLEARLOG:
- {
- SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule);
- if (s) {
- SetDlgItemText(hwndDlg, IDC_LOG, L"");
- pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
- s->iEventCount = 0;
- s->LastTime = 0;
- si->iEventCount = 0;
- si->LastTime = 0;
- si->pLog = s->pLog;
- si->pLogEnd = s->pLogEnd;
- PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
- }
+ s = pci->SM_FindSession(si->ptszID, si->pszModule);
+ if (s) {
+ SetDlgItemText(hwndDlg, IDC_LOG, L"");
+ pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
+ s->iEventCount = 0;
+ s->LastTime = 0;
+ si->iEventCount = 0;
+ si->LastTime = 0;
+ si->pLog = s->pLog;
+ si->pLogEnd = s->pLogEnd;
+ PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
}
break;
@@ -2111,12 +2089,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case EN_LINK:
if (((LPNMHDR)lParam)->idFrom == IDC_LOG) {
- switch (((ENLINK *)lParam)->msg) {
+ switch (((ENLINK*)lParam)->msg) {
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
{
- CHARRANGE sel;
SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax)
break;
@@ -2407,7 +2384,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
id.mask = TCIF_PARAM;
for (j; j >= 0; j--) {
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), j, &id);
- SESSION_INFO *s = (SESSION_INFO*)id.lParam;
+ s = (SESSION_INFO*)id.lParam;
if (s)
TabM_AddTab(s->ptszID, s->pszModule);
}
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 92426c4a7a..a46288de7d 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -128,7 +128,7 @@ void Unload_ChatModule();
void Load_ChatModule();
// log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw);
void ValidateFilename(wchar_t * filename);
char* Log_CreateRtfHeader(MODULEINFO * mi);
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 5ad1c4e85b..2d3c5b3130 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -46,6 +46,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData);
char* Log_SetStyle(int style);
// chat_manager.cpp
+BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted);
BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT *gce);
char* SM_GetUsers(SESSION_INFO *si);
BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus);
@@ -99,7 +100,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighl
int GetColorIndex(const char *pszModule, COLORREF cr);
void CheckColorsInModule(const char *pszModule);
int GetRichTextLength(HWND hwnd);
-BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
+bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const wchar_t* pszUID, const wchar_t* pszText, INT_PTR dwItem);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index b602a42bc4..3c0bc47c8a 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -185,7 +185,7 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
return chatApi.hIcons[ICON_STATUS0];
}
-static BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, BOOL bIsHighlighted)
+BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted)
{
SESSION_INFO *p = SM_FindSession(pszID, pszModule);
if (p == NULL)
@@ -1083,7 +1083,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
chatApi.GetActiveSession = GetActiveSession;
chatApi.SM_FindSession = SM_FindSession;
chatApi.SM_GetStatusIcon = SM_GetStatusIcon;
- chatApi.SM_AddEvent = SM_AddEvent;
chatApi.SM_BroadcastMessage = SM_BroadcastMessage;
chatApi.SM_AddCommand = SM_AddCommand;
chatApi.SM_GetPrevCommand = SM_GetPrevCommand;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 879fab56c9..3840ece962 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -429,6 +429,13 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
if (chatApi.OnEventBroadcast)
chatApi.OnEventBroadcast(p, gce);
+ if (p->hWnd && p->bInitDone) {
+ if (SM_AddEvent(p->ptszID, p->pszModule, gce, FALSE))
+ SendMessage(p->hWnd, GC_ADDLOG, 0, 0);
+ else
+ SendMessage(p->hWnd, GC_REDRAWLOG2, 0, 0);
+ }
+
if (!(gce->dwFlags & GCEF_NOTNOTIFY)) {
DoFlashParam param = { p, gce, FALSE, bManyFix };
CallFunctionSync(stubFlash, &param);
@@ -457,8 +464,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
if (NotifyEventHooks(hHookEvent, 0, LPARAM(gce)))
return 1;
- BOOL bIsHighlighted = FALSE;
- BOOL bRemoveFlag = FALSE;
+ bool bIsHighlighted = false, bRemoveFlag = false;
// Do different things according to type of event
switch (gcd->iType) {
@@ -548,13 +554,22 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
return 0;
if (si && (si->bInitDone || gcd->iType == GC_EVENT_TOPIC || (gcd->iType == GC_EVENT_JOIN && gce->bIsMe))) {
- int isOk = chatApi.SM_AddEvent(pWnd, pMod, gce, bIsHighlighted);
+ if (si->hWnd) {
+ int isOk = SM_AddEvent(pWnd, pMod, gce, bIsHighlighted);
+ if (isOk)
+ SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
+ else
+ SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
+ }
+
if (chatApi.OnAddLog)
- chatApi.OnAddLog(si, isOk);
+ chatApi.OnAddLog(si);
+
if (!(gce->dwFlags & GCEF_NOTNOTIFY)) {
DoFlashParam param = { si, gce, bIsHighlighted, 0 };
CallFunctionSync(stubFlash, &param);
}
+
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
chatApi.LogToFile(si, gce);
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 2ff093934a..566e1c07e7 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -413,7 +413,7 @@ const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2)
static wchar_t szTrimString[] = L":,.!?;\'>)";
-BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
+bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
{
if (!g_Settings->bHighlightEnabled || !g_Settings->pszHighlightWords || !gce || !si || !si->pMe)
return FALSE;