From 64516fd98ad1dae35864617563ee9963c0f31917 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 17:18:33 +0000 Subject: - OnSessionCreate was called too early; - function names normalization git-svn-id: http://svn.miranda-ng.org/main/trunk@7818 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_chat_int.h | 24 +-- plugins/Scriver/src/chat/main.cpp | 16 +- plugins/TabSRMM/src/chat/chat.h | 4 +- plugins/TabSRMM/src/chat/log.cpp | 273 ++++++++++++++++------------------ plugins/TabSRMM/src/chat/main.cpp | 16 +- plugins/TabSRMM/src/chat/services.cpp | 1 + src/core/stdchat/src/main.cpp | 20 +-- src/modules/chat/chat_svc.cpp | 13 +- src/modules/chat/clist.cpp | 4 +- src/modules/chat/manager.cpp | 11 +- 10 files changed, 186 insertions(+), 196 deletions(-) diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 53ca526607..2ac9b5bd0e 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -409,13 +409,13 @@ struct CHAT_MANAGER void (*OnCreateModule)(MODULEINFO*); void (*OnCreateSession)(SESSION_INFO*, MODULEINFO*); - void (*OnSessionDblClick)(SESSION_INFO*); - void (*OnSessionOffline)(SESSION_INFO*); - void (*OnSessionRemove)(SESSION_INFO*); - void (*OnSessionRename)(SESSION_INFO*); - void (*OnSessionReplace)(SESSION_INFO*); + void (*OnDblClickSession)(SESSION_INFO*); + void (*OnOfflineSession)(SESSION_INFO*); + void (*OnRemoveSession)(SESSION_INFO*); + void (*OnRenameSession)(SESSION_INFO*); + void (*OnReplaceSession)(SESSION_INFO*); - void (*ShowRoom)(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground); + void (*ShowRoom)(SESSION_INFO*, WPARAM wp, BOOL bSetForeground); void (*OnAddLog)(SESSION_INFO*, int); void (*OnClearLog)(SESSION_INFO*); void (*OnEventBroadcast)(SESSION_INFO *si, GCEVENT *gce); @@ -425,15 +425,15 @@ struct CHAT_MANAGER void (*OnAddUser)(SESSION_INFO*, USERINFO*); void (*OnNewUser)(SESSION_INFO*, USERINFO*); - void (*OnRemoveUser)(SESSION_INFO *si, USERINFO*); - void (*OnChangeNick)(SESSION_INFO *si); + void (*OnRemoveUser)(SESSION_INFO*, USERINFO*); + void (*OnChangeNick)(SESSION_INFO*); - void (*OnAddStatus)(SESSION_INFO *si, STATUSINFO*); - void (*OnSetStatus)(SESSION_INFO *si, int); + void (*OnAddStatus)(SESSION_INFO*, STATUSINFO*); + void (*OnSetStatus)(SESSION_INFO*, int); void (*OnLoadSettings)(void); - void (*OnFlashWindow)(SESSION_INFO *si, int); - void (*OnFlashHighlight)(SESSION_INFO *si, int); + void (*OnFlashWindow)(SESSION_INFO*, int bInactive); + void (*OnFlashHighlight)(SESSION_INFO*, int bInactive); }; extern CHAT_MANAGER ci, *pci; diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 5ccd29dd3a..8274ed3720 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -58,24 +58,24 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO*) si->windowData.flags = CWDF_RTF_INPUT; } -static void OnSessionDblClick(SESSION_INFO *si) +static void OnDblClickSession(SESSION_INFO *si) { PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); } -static void OnSessionRemove(SESSION_INFO *si) +static void OnRemoveSession(SESSION_INFO *si) { if (si->hWnd) SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0); } -static void OnSessionRename(SESSION_INFO *si) +static void OnRenameSession(SESSION_INFO *si) { if (si->hWnd) SendMessage(si->hWnd, DM_UPDATETITLEBAR, 0, 0); } -static void OnSessionReplace(SESSION_INFO *si) +static void OnReplaceSession(SESSION_INFO *si) { if (si->hWnd) RedrawWindow(GetDlgItem(si->hWnd, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE); @@ -199,10 +199,10 @@ int Chat_Load() pci->OnAddLog = OnAddLog; pci->OnCreateSession = OnCreateSession; - pci->OnSessionRemove = OnSessionRemove; - pci->OnSessionRename = OnSessionRename; - pci->OnSessionReplace = OnSessionReplace; - pci->OnSessionDblClick = OnSessionDblClick; + pci->OnRemoveSession = OnRemoveSession; + pci->OnRenameSession = OnRenameSession; + pci->OnReplaceSession = OnReplaceSession; + pci->OnDblClickSession = OnDblClickSession; pci->OnEventBroadcast = OnEventBroadcast; pci->OnSetStatusBar = OnSetStatusBar; diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 9d790b55a3..0d572fb76c 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -67,7 +67,9 @@ struct SESSION_INFO : public GCSessionInfoBase { TWindowData *dat; TContainerData *pContainer; - int iLogTrayFlags, iLogPopupFlags, iDiskLogFlags, iSearchItem; + int iLogTrayFlags, iLogPopupFlags, iDiskLogFlags; + + int iSearchItem; TCHAR szSearch[255]; }; diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index be94f1a5c3..dc86a1208a 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -837,7 +837,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) // ### RTF BODY (one iteration per event that should be streamed in) while (lin) { // filter - if (streamData->si->iType != GCW_CHATROOM || !streamData->si->bFilterEnabled || (streamData->si->iLogFilterFlags&lin->iType) != 0) { + if (streamData->si->iType != GCW_CHATROOM || !streamData->si->bFilterEnabled || (streamData->si->iLogFilterFlags & lin->iType) != 0) { if (lin->next != NULL) Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\par "); @@ -999,164 +999,151 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr streamData.bStripFormat = FALSE; streamData.dat = dat; - // bPhaseTwo = bRedraw && bPhaseTwo; + if (!bRedraw && si->iType == GCW_CHATROOM && si->bFilterEnabled && (si->iLogFilterFlags & lin->iType) == 0) + return; - if (bRedraw || si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&lin->iType) != 0) { - bool bFlag = false, fDoReplace; + bool bFlag = false, fDoReplace; - EDITSTREAM stream = { 0 }; - stream.pfnCallback = Log_StreamCallback; - stream.dwCookie = (DWORD_PTR) & streamData; + EDITSTREAM stream = { 0 }; + stream.pfnCallback = Log_StreamCallback; + stream.dwCookie = (DWORD_PTR) & streamData; - SCROLLINFO scroll = { 0 }; - scroll.cbSize = sizeof(SCROLLINFO); - scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; - GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &scroll); - SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point); + SCROLLINFO scroll = { 0 }; + scroll.cbSize = sizeof(SCROLLINFO); + scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; + GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &scroll); + SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point); - // do not scroll to bottom if there is a selection - SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel); - if (oldsel.cpMax != oldsel.cpMin) - SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); + // do not scroll to bottom if there is a selection + SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel); + if (oldsel.cpMax != oldsel.cpMin) + SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); - //set the insertion point at the bottom - sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); + //set the insertion point at the bottom + sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); - // fix for the indent... must be a M$ bug - if (sel.cpMax == 0) - bRedraw = TRUE; - - // should the event(s) be appended to the current log - WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; - - //get the number of pixels per logical inch - if (bRedraw) { - HDC hdc; - hdc = GetDC(NULL); - logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); - SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); - bFlag = true; - // SetCursor(LoadCursor(NULL, IDC_ARROW)); - } + // fix for the indent... must be a M$ bug + if (sel.cpMax == 0) + bRedraw = TRUE; - // stream in the event(s) - streamData.lin = lin; - streamData.bRedraw = bRedraw; - SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)&stream); - - - //SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&newsel); - /* - * for new added events, only replace in message or action events. - * no need to replace smileys or math formulas elsewhere - */ - fDoReplace = (bRedraw || (lin->ptszText - && (lin->iType == GC_EVENT_MESSAGE || lin->iType == GC_EVENT_ACTION))); - - /* - * replace marked nicknames with hyperlinks to make the nicks - * clickable - */ - if (g_Settings.bClickableNicks) { - FINDTEXTEX fi, fi2; - - CHARFORMAT2 cf2; - ZeroMemory(&cf2, sizeof(CHARFORMAT2)); - cf2.cbSize = sizeof(cf2); - - fi2.lpstrText = _T("#++~~"); - fi.chrg.cpMin = bRedraw ? 0 : sel.cpMin; - fi.chrg.cpMax = -1; - fi.lpstrText = _T("~~++#"); - - while (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { - fi2.chrg.cpMin = fi.chrgText.cpMin; - fi2.chrg.cpMax = -1; - - if (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi2) > -1) { - - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi.chrgText); - SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)_T("")); - fi2.chrgText.cpMin -= fi.chrgText.cpMax - fi.chrgText.cpMin; - fi2.chrgText.cpMax -= fi.chrgText.cpMax - fi.chrgText.cpMin; - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi2.chrgText); - SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)_T("")); - fi2.chrgText.cpMax = fi2.chrgText.cpMin; - - fi2.chrgText.cpMin = fi.chrgText.cpMin; - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi2.chrgText); - cf2.dwMask = CFM_PROTECTED; - cf2.dwEffects = CFE_PROTECTED; - SendMessage(hwndRich, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); - } - fi.chrg.cpMin = fi.chrgText.cpMax; - } - SendMessage(hwndRich, EM_SETSEL, -1, -1); - } + // should the event(s) be appended to the current log + WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; - /* - * run smileyadd - */ - if (PluginConfig.g_SmileyAddAvail && fDoReplace) { - newsel.cpMax = -1; - newsel.cpMin = sel.cpMin; - if (newsel.cpMin < 0) - newsel.cpMin = 0; - - SMADD_RICHEDIT3 sm = { sizeof(sm) }; - sm.hwndRichEditControl = hwndRich; - sm.Protocolname = si->pszModule; - sm.rangeToReplace = bRedraw ? NULL : &newsel; - sm.disableRedraw = TRUE; - sm.hContact = si->hContact; - CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); - } + //get the number of pixels per logical inch + if (bRedraw) { + HDC hdc; + hdc = GetDC(NULL); + logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); + logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); + ReleaseDC(NULL, hdc); + SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); + bFlag = true; + // SetCursor(LoadCursor(NULL, IDC_ARROW)); + } + + // stream in the event(s) + streamData.lin = lin; + streamData.bRedraw = bRedraw; + SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)&stream); + + // for new added events, only replace in message or action events. + // no need to replace smileys or math formulas elsewhere + fDoReplace = (bRedraw || (lin->ptszText && (lin->iType == GC_EVENT_MESSAGE || lin->iType == GC_EVENT_ACTION))); - /* - * trim the message log to the number of most recent events - * this uses hidden marks in the rich text to find the events which should be deleted - */ - if (si->bTrimmed) { - TCHAR szPattern[50]; - FINDTEXTEX fi; - - mir_sntprintf(szPattern, SIZEOF(szPattern), _T("~-+%d+-~"), si->pLogEnd); - fi.lpstrText = szPattern; - fi.chrg.cpMin = 0; - fi.chrg.cpMax = -1; - if (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) != 0) { - CHARRANGE sel; - sel.cpMin = 0; - sel.cpMax = 20; - SendMessage(hwndRich, EM_SETSEL, 0, fi.chrgText.cpMax + 1); + // replace marked nicknames with hyperlinks to make the nicks clickable + if (g_Settings.bClickableNicks) { + FINDTEXTEX fi, fi2; + + CHARFORMAT2 cf2; + ZeroMemory(&cf2, sizeof(CHARFORMAT2)); + cf2.cbSize = sizeof(cf2); + + fi2.lpstrText = _T("#++~~"); + fi.chrg.cpMin = bRedraw ? 0 : sel.cpMin; + fi.chrg.cpMax = -1; + fi.lpstrText = _T("~~++#"); + + while (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { + fi2.chrg.cpMin = fi.chrgText.cpMin; + fi2.chrg.cpMax = -1; + + if (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi2) > -1) { + + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi.chrgText); SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)_T("")); + fi2.chrgText.cpMin -= fi.chrgText.cpMax - fi.chrgText.cpMin; + fi2.chrgText.cpMax -= fi.chrgText.cpMax - fi.chrgText.cpMin; + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi2.chrgText); + SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)_T("")); + fi2.chrgText.cpMax = fi2.chrgText.cpMin; + + fi2.chrgText.cpMin = fi.chrgText.cpMin; + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&fi2.chrgText); + cf2.dwMask = CFM_PROTECTED; + cf2.dwEffects = CFE_PROTECTED; + SendMessage(hwndRich, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); } - si->bTrimmed = FALSE; + fi.chrg.cpMin = fi.chrgText.cpMax; } + SendMessage(hwndRich, EM_SETSEL, -1, -1); + } - // scroll log to bottom if the log was previously scrolled to bottom, else restore old position - if ((bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)) - SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0); - else - SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point); + // run smileyadd + if (PluginConfig.g_SmileyAddAvail && fDoReplace) { + newsel.cpMax = -1; + newsel.cpMin = sel.cpMin; + if (newsel.cpMin < 0) + newsel.cpMin = 0; + + SMADD_RICHEDIT3 sm = { sizeof(sm) }; + sm.hwndRichEditControl = hwndRich; + sm.Protocolname = si->pszModule; + sm.rangeToReplace = bRedraw ? NULL : &newsel; + sm.disableRedraw = TRUE; + sm.hContact = si->hContact; + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); + } - // do we need to restore the selection - if (oldsel.cpMax != oldsel.cpMin) { - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel); - SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); + // trim the message log to the number of most recent events + // this uses hidden marks in the rich text to find the events which should be deleted + if (si->bTrimmed) { + TCHAR szPattern[50]; + FINDTEXTEX fi; + + mir_sntprintf(szPattern, SIZEOF(szPattern), _T("~-+%d+-~"), si->pLogEnd); + fi.lpstrText = szPattern; + fi.chrg.cpMin = 0; + fi.chrg.cpMax = -1; + if (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) != 0) { + CHARRANGE sel; + sel.cpMin = 0; + sel.cpMax = 20; + SendMessage(hwndRich, EM_SETSEL, 0, fi.chrgText.cpMax + 1); + SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)_T("")); } + si->bTrimmed = FALSE; + } - // need to invalidate the window - if (bFlag) { - sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); - SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); - } + // scroll log to bottom if the log was previously scrolled to bottom, else restore old position + if ((bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)) + SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0); + else + SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point); + + // do we need to restore the selection + if (oldsel.cpMax != oldsel.cpMin) { + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel); + SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); + InvalidateRect(hwndRich, NULL, TRUE); + } + + // need to invalidate the window + if (bFlag) { + sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); + SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); + InvalidateRect(hwndRich, NULL, TRUE); } } diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 1d3bbed584..6eb0c2295f 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -56,24 +56,24 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi) } } -static void OnSessionDblClick(SESSION_INFO *si) +static void OnDblClickSession(SESSION_INFO *si) { PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); } -static void OnSessionRemove(SESSION_INFO *si) +static void OnRemoveSession(SESSION_INFO *si) { if (si->hWnd) SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0); } -static void OnSessionRename(SESSION_INFO *si) +static void OnRenameSession(SESSION_INFO *si) { if (si->hWnd) SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0); } -static void OnSessionReplace(SESSION_INFO *si) +static void OnReplaceSession(SESSION_INFO *si) { if (si->hContact) Chat_SetFilters(si); @@ -270,10 +270,10 @@ int Chat_Load() pci->OnAddLog = OnAddLog; pci->OnCreateSession = OnCreateSession; - pci->OnSessionRemove = OnSessionRemove; - pci->OnSessionRename = OnSessionRename; - pci->OnSessionReplace = OnSessionReplace; - pci->OnSessionDblClick = OnSessionDblClick; + pci->OnRemoveSession = OnRemoveSession; + pci->OnRenameSession = OnRenameSession; + pci->OnReplaceSession = OnReplaceSession; + pci->OnDblClickSession = OnDblClickSession; pci->OnEventBroadcast = OnEventBroadcast; pci->OnSetStatusBar = OnSetStatusBar; diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 61beccc984..c0b769a216 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -166,6 +166,7 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) if (si == NULL) return; + Chat_SetFilters(si); if (si->hWnd != NULL) { ActivateExistingTab(si->pContainer, si->hWnd); return; diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index aa0be90023..49aa8fcc07 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -112,7 +112,7 @@ static void OnClearLog(SESSION_INFO *si) } } -static void OnSessionDblClick(SESSION_INFO *si) +static void OnDblClickSession(SESSION_INFO *si) { if (g_Settings.bTabsEnable) SendMessage(si->hWnd, GC_REMOVETAB, 1, (LPARAM)si); @@ -120,7 +120,7 @@ static void OnSessionDblClick(SESSION_INFO *si) PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); } -static void OnSessionRemove(SESSION_INFO *si) +static void OnRemoveSession(SESSION_INFO *si) { if (!g_Settings.bTabsEnable) { if (si->hWnd) @@ -133,7 +133,7 @@ static void OnSessionRemove(SESSION_INFO *si) g_TabSession.nUsersInNicklist = 0; } -static void OnSessionRename(SESSION_INFO *si) +static void OnRenameSession(SESSION_INFO *si) { if (g_TabSession.hWnd && g_Settings.bTabsEnable) { g_TabSession.ptszName = si->ptszName; @@ -141,7 +141,7 @@ static void OnSessionRename(SESSION_INFO *si) } } -static void OnSessionReplace(SESSION_INFO *si) +static void OnReplaceSession(SESSION_INFO *si) { if (si->hWnd) g_TabSession.nUsersInNicklist = 0; @@ -154,7 +154,7 @@ static void OnSessionReplace(SESSION_INFO *si) RedrawWindow(GetDlgItem(g_TabSession.hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE); } -static void OnSessionOffline(SESSION_INFO *si) +static void OnOfflineSession(SESSION_INFO *si) { if (si->hWnd) { g_TabSession.nUsersInNicklist = 0; @@ -350,11 +350,11 @@ extern "C" __declspec(dllexport) int Load(void) pci->OnClearLog = OnClearLog; pci->OnCreateModule = OnCreateModule; - pci->OnSessionOffline = OnSessionOffline; - pci->OnSessionRemove = OnSessionRemove; - pci->OnSessionRename = OnSessionRename; - pci->OnSessionReplace = OnSessionReplace; - pci->OnSessionDblClick = OnSessionDblClick; + pci->OnOfflineSession = OnOfflineSession; + pci->OnRemoveSession = OnRemoveSession; + pci->OnRenameSession = OnRenameSession; + pci->OnReplaceSession = OnReplaceSession; + pci->OnDblClickSession = OnDblClickSession; pci->OnEventBroadcast = OnEventBroadcast; pci->OnLoadSettings = OnLoadSettings; diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 5b3b2df05a..0644d3e983 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -214,7 +214,7 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText); si->iSplitterX = g_Settings->iSplitterX; si->iSplitterY = g_Settings->iSplitterY; - si->iLogFilterFlags = (int)db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); + si->iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); si->bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0); si->bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1); @@ -239,6 +239,9 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else db_set_s(si->hContact, si->pszModule, "StatusBar", ""); + + if (ci.OnCreateSession) + ci.OnCreateSession(si, mi); } else if (si = ci.SM_FindSession(gcw->ptszID, gcw->pszModule)) { ci.UM_RemoveAll(&si->pUsers); @@ -247,8 +250,8 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->iStatusCount = 0; si->nUsersInNicklist = 0; - if (ci.OnSessionReplace) - ci.OnSessionReplace(si); + if (ci.OnReplaceSession) + ci.OnReplaceSession(si); } return 0; @@ -325,8 +328,8 @@ static int DoControl(GCEVENT *gce, WPARAM wp) replaceStrT(si->ptszName, gce->ptszText); if (si->hWnd) SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0); - if (ci.OnSessionRename) - ci.OnSessionRename(si); + if (ci.OnRenameSession) + ci.OnRenameSession(si); } } diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index ce9680cb32..503480e582 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -125,8 +125,8 @@ int RoomDoubleclicked(WPARAM wParam, LPARAM lParam) !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) { - if (ci.OnSessionDblClick) - ci.OnSessionDblClick(si); + if (ci.OnDblClickSession) + ci.OnDblClickSession(si); return 1; } ci.ShowRoom(si, WINDOW_VISIBLE, TRUE); diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index 0873dae5c3..1b8b498d49 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -72,9 +72,6 @@ static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule) node->ptszID = mir_tstrdup(pszID); node->pszModule = mir_strdup(pszModule); - if (ci.OnCreateSession) - ci.OnCreateSession(node, ci.MM_FindModule(pszModule)); - if (ci.wndList == NULL) { // list is empty ci.wndList = node; node->next = NULL; @@ -131,8 +128,8 @@ static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL remo if ((!pszID && pTemp->iType != GCW_SERVER || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) { DWORD dw = pTemp->dwItemData; - if (ci.OnSessionRemove) - ci.OnSessionRemove(pTemp); + if (ci.OnRemoveSession) + ci.OnRemoveSession(pTemp); DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)pTemp->dwItemData); if (pLast == NULL) @@ -189,8 +186,8 @@ static BOOL SM_SetOffline(const TCHAR *pszID, const char *pszModule) pTemp->nUsersInNicklist = 0; if (pTemp->iType != GCW_SERVER) pTemp->bInitDone = FALSE; - if (ci.OnSessionOffline) - ci.OnSessionOffline(pTemp); + if (ci.OnOfflineSession) + ci.OnOfflineSession(pTemp); if (pszID) return TRUE; } -- cgit v1.2.3