From 66ab99eb5b5c47a01e1cc6613af07426abbeb19b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 27 May 2018 14:52:20 +0300 Subject: unused variable CHAT_MANAGER *pci removed and replaced with g_chatApi --- plugins/TabSRMM/src/chat_log.cpp | 50 +++++++++++++++--------------- plugins/TabSRMM/src/chat_main.cpp | 43 +++++++++++++------------- plugins/TabSRMM/src/chat_manager.cpp | 8 ++--- plugins/TabSRMM/src/chat_options.cpp | 16 +++++----- plugins/TabSRMM/src/chat_tools.cpp | 58 +++++++++++++++++------------------ plugins/TabSRMM/src/chat_window.cpp | 40 ++++++++++++------------ plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 4 +-- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msgs.cpp | 2 +- plugins/TabSRMM/src/muchighlight.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 2 +- plugins/TabSRMM/src/taskbar.cpp | 2 +- 13 files changed, 115 insertions(+), 116 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index f737795772..d65b6a0e1f 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -78,7 +78,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t int lineLen, textCharsCount = 0; wchar_t* line = (wchar_t*)_alloca(8001 * sizeof(wchar_t)); wchar_t* d; - MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(streamData->si->pszModule); va_start(va, fmt); lineLen = mir_vsnwprintf(line, 8000, fmt, va); @@ -497,7 +497,7 @@ static void Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, CMStringA case 'r': if (!streamData->bStripFormat) { int index = EventToIndex(streamData->lin); - res.AppendFormat("%s ", pci->Log_SetStyle(index)); + res.AppendFormat("%s ", g_chatApi.Log_SetStyle(index)); } break; } @@ -634,10 +634,10 @@ static void AddEventToBuffer(CMStringA &str, LOGSTREAMDATA *streamData) char* Log_CreateRtfHeader(void) { // get the number of pixels per logical inch - if (pci->logPixelSY == 0) { + if (g_chatApi.logPixelSY == 0) { HDC hdc = GetDC(nullptr); - pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); + g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); + g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(nullptr, hdc); } @@ -646,12 +646,12 @@ char* Log_CreateRtfHeader(void) // font table CMStringA str("{\\rtf1\\ansi\\deff0{\\fonttbl"); for (int i = 0; i < OPTIONS_FONTCOUNT; i++) - str.AppendFormat("{\\f%u\\fnil\\fcharset%u%S;}", i, pci->aFonts[i].lf.lfCharSet, pci->aFonts[i].lf.lfFaceName); + str.AppendFormat("{\\f%u\\fnil\\fcharset%u%S;}", i, g_chatApi.aFonts[i].lf.lfCharSet, g_chatApi.aFonts[i].lf.lfFaceName); // colour table str.Append("}{\\colortbl ;"); - for (auto &it : pci->aFonts) + for (auto &it : g_chatApi.aFonts) str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(it.color), GetGValue(it.color), GetBValue(it.color)); for (auto &it : Utils::rtf_clrs) @@ -672,19 +672,19 @@ char* Log_CreateRtfHeader(void) szString[1] = 0; szString[0] = 0x28; - pci->LoadMsgDlgFont(17, &lf, nullptr); + g_chatApi.LoadMsgDlgFont(17, &lf, nullptr); HFONT hFont = CreateFontIndirect(&lf); int iText = Chat_GetTextPixelSize(szString, hFont, true) + 3; DeleteObject(hFont); - iIndent += (iText * 1440) / pci->logPixelSX; + iIndent += (iText * 1440) / g_chatApi.logPixelSX; str.AppendFormat("\\tx%u", iIndent); } else if (g_Settings.dwIconFlags) { - iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / pci->logPixelSX; + iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / g_chatApi.logPixelSX; str.AppendFormat("\\tx%u", iIndent); } if (g_Settings.bShowTime) { - int iSize = (g_Settings.LogTextIndent * 1440) / pci->logPixelSX; + int iSize = (g_Settings.LogTextIndent * 1440) / g_chatApi.logPixelSX; str.AppendFormat("\\tx%u", iIndent + iSize); if (g_Settings.bLogIndentEnabled) iIndent += iSize; @@ -697,7 +697,7 @@ char* Log_CreateRtfHeader(void) char* Log_CreateRTF(LOGSTREAMDATA *streamData) { LOGINFO *lin = streamData->lin; - MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(streamData->si->pszModule); SESSION_INFO *si = streamData->si; // ### RTF HEADER @@ -730,37 +730,37 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) streamData->dat->m_dwFlags &= ~MWF_DIVIDERWANTED; } // create new line, and set font and color - str.AppendFormat("\\ql\\sl0%s ", pci->Log_SetStyle(0)); + str.AppendFormat("\\ql\\sl0%s ", g_chatApi.Log_SetStyle(0)); str.AppendFormat("\\v~-+%p+-~\\v0 ", lin); // Insert icon if (g_Settings.bLogSymbols) // use symbols - str.AppendFormat("%s %c", pci->Log_SetStyle(17), EventToSymbol(lin)); + str.AppendFormat("%s %c", g_chatApi.Log_SetStyle(17), EventToSymbol(lin)); else if (g_Settings.dwIconFlags) { int iIndex = lin->bIsHighlighted ? ICON_HIGHLIGHT : EventToIcon(lin); str.Append("\\f0\\fs14"); - str.Append(pci->pLogIconBmpBits[iIndex]); + str.Append(g_chatApi.pLogIconBmpBits[iIndex]); } if (g_Settings.bTimeStampEventColour) { // colored timestamps static char szStyle[256]; - LOGFONT &F = pci->aFonts[0].lf; + LOGFONT &F = g_chatApi.aFonts[0].lf; int iii; if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) { iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1); mir_snprintf(szStyle, "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u", - iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY); + iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / g_chatApi.logPixelSY); str.Append(szStyle); } else { iii = lin->bIsHighlighted ? 16 : EventToIndex(lin); mir_snprintf(szStyle, "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u", - iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY); + iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / g_chatApi.logPixelSY); str.Append(szStyle); } } - else str.Append(pci->Log_SetStyle(0)); + else str.Append(g_chatApi.Log_SetStyle(0)); str.AppendChar(' '); // insert a TAB if necessary to put the timestamp in the right position @@ -771,8 +771,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bShowTime) { wchar_t szTimeStamp[30], szOldTimeStamp[30]; - wcsncpy_s(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), _TRUNCATE); - wcsncpy_s(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, si->LastTime), _TRUNCATE); + wcsncpy_s(szTimeStamp, g_chatApi.MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), _TRUNCATE); + wcsncpy_s(szOldTimeStamp, g_chatApi.MakeTimeStamp(g_Settings.pszTimeStamp, si->LastTime), _TRUNCATE); if (!g_Settings.bShowTimeIfChanged || si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) { si->LastTime = lin->time; Log_AppendRTF(streamData, TRUE, str, L"%s", szTimeStamp); @@ -788,7 +788,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bLogClassicIndicators || g_Settings.bColorizeNicksInLog) pszIndicator[0] = GetIndicator(si, lin->ptszNick, &crNickIndex); - str.Append(pci->Log_SetStyle(lin->bIsMe ? 2 : 1)); + str.Append(g_chatApi.Log_SetStyle(lin->bIsMe ? 2 : 1)); str.AppendChar(' '); if (g_Settings.bLogClassicIndicators) @@ -812,7 +812,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) } // Insert the message - str.Append(pci->Log_SetStyle(lin->bIsHighlighted ? 16 : EventToIndex(lin))); + str.Append(g_chatApi.Log_SetStyle(lin->bIsHighlighted ? 16 : EventToIndex(lin))); str.AppendChar(' '); streamData->lin = lin; @@ -879,8 +879,8 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) // get the number of pixels per logical inch if (bRedraw) { HDC hdc = GetDC(nullptr); - pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); + g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); + g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); ReleaseDC(nullptr, hdc); m_log.SendMsg(WM_SETREDRAW, FALSE, 0); bFlag = true; diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 8dc53ad7cf..af44648190 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -33,7 +33,6 @@ HANDLE g_hWindowList; pfnDoPopup oldDoPopup, oldLogToFile; pfnDoTrayIcon oldDoTrayIcon; -CHAT_MANAGER *pci; TMUCSettings g_Settings; static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi) @@ -119,13 +118,13 @@ static void OnLoadSettings() } LOGFONT lf; - pci->LoadMsgDlgFont(18, &lf, nullptr); + g_chatApi.LoadMsgDlgFont(18, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf); - pci->LoadMsgDlgFont(19, &lf, nullptr); + g_chatApi.LoadMsgDlgFont(19, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf); - pci->LoadMsgDlgFont(5, &lf, nullptr); + g_chatApi.LoadMsgDlgFont(5, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf); int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false); @@ -217,30 +216,30 @@ int Chat_Load() Utils::RTF_CTableInit(); CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message sessions") L"/" LPGENW("Group chats"), FONTMODE_ALTER, g_plugin.m_hLang }; - pci = Chat_GetInterface(&data); + Chat_CustomizeApi(&data); - pci->OnCreateModule = OnCreateModule; - pci->OnNewUser = OnNewUser; + g_chatApi.OnCreateModule = OnCreateModule; + g_chatApi.OnNewUser = OnNewUser; - pci->OnSetTopic = OnSetTopic; + g_chatApi.OnSetTopic = OnSetTopic; - pci->OnCreateSession = OnCreateSession; - pci->OnReplaceSession = OnReplaceSession; + g_chatApi.OnCreateSession = OnCreateSession; + g_chatApi.OnReplaceSession = OnReplaceSession; - pci->OnChangeNick = OnChangeNick; - pci->ShowRoom = stubShowRoom; - pci->OnLoadSettings = OnLoadSettings; + g_chatApi.OnChangeNick = OnChangeNick; + g_chatApi.ShowRoom = stubShowRoom; + g_chatApi.OnLoadSettings = OnLoadSettings; // this operation is unsafe, that's why we restore the old pci state on exit - pci->DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff; - pci->IsHighlighted = IsHighlighted; - oldLogToFile = pci->LogToFile; pci->LogToFile = LogToFile; - oldDoPopup = pci->DoPopup; pci->DoPopup = DoPopup; - oldDoTrayIcon = pci->DoTrayIcon; pci->ShowPopup = ShowPopup; - pci->Log_CreateRTF = Log_CreateRTF; - pci->Log_CreateRtfHeader = Log_CreateRtfHeader; - pci->UM_CompareItem = UM_CompareItem; - pci->ReloadSettings(); + g_chatApi.DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff; + g_chatApi.IsHighlighted = IsHighlighted; + oldLogToFile = g_chatApi.LogToFile; g_chatApi.LogToFile = LogToFile; + oldDoPopup = g_chatApi.DoPopup; g_chatApi.DoPopup = DoPopup; + oldDoTrayIcon = g_chatApi.DoTrayIcon; g_chatApi.ShowPopup = ShowPopup; + g_chatApi.Log_CreateRTF = Log_CreateRTF; + g_chatApi.Log_CreateRtfHeader = Log_CreateRtfHeader; + g_chatApi.UM_CompareItem = UM_CompareItem; + g_chatApi.ReloadSettings(); g_Settings.Highlight = new CMUCHighlight(); return 0; diff --git a/plugins/TabSRMM/src/chat_manager.cpp b/plugins/TabSRMM/src/chat_manager.cpp index 4b582ee06e..c40ed9e821 100644 --- a/plugins/TabSRMM/src/chat_manager.cpp +++ b/plugins/TabSRMM/src/chat_manager.cpp @@ -77,7 +77,7 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus) BOOL SM_ReconfigureFilters() { - for (auto &si : pci->arSessions) + for (auto &si : g_chatApi.arSessions) Chat_SetFilters(si); return TRUE; @@ -85,7 +85,7 @@ BOOL SM_ReconfigureFilters() SESSION_INFO* SM_FindSessionByHWND(HWND hWnd) { - for (auto &si : pci->arSessions) + for (auto &si : g_chatApi.arSessions) if (si->pDlg && si->pDlg->GetHwnd() == hWnd) return si; @@ -94,7 +94,7 @@ SESSION_INFO* SM_FindSessionByHWND(HWND hWnd) SESSION_INFO* SM_FindSessionByHCONTACT(MCONTACT h) { - for (auto &si : pci->arSessions) + for (auto &si : g_chatApi.arSessions) if (si->hContact == h) return si; @@ -111,7 +111,7 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* cu pszCurrent = pszOriginal; SESSION_INFO *pResult = nullptr; - for (auto &si : pci->arSessions) + for (auto &si : g_chatApi.arSessions) if (si != currSession && !mir_strcmpi(pszModule, si->pszModule)) if (my_strstri(si->ptszName, pszOriginal) == si->ptszName) if (prevSession != si && mir_wstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(si->ptszName, pszName) < 0)) { diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 428b1bdfe7..ddaeec4e78 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -303,9 +303,9 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM) void Chat_ApplyOptions() { - pci->ReloadSettings(); - pci->MM_IconsChanged(); - pci->MM_FontsChanged(); + g_chatApi.ReloadSettings(); + g_chatApi.MM_IconsChanged(); + g_chatApi.MM_FontsChanged(); Chat_UpdateOptions(); SM_ReconfigureFilters(); @@ -350,7 +350,7 @@ void Chat_AddIcons(void) { Icon_Register(g_hIconDLL, LPGEN("Message Sessions") "/" LPGEN("Group chat windows"), _icons, _countof(_icons), 0, g_plugin.m_hLang); Icon_Register(g_hIconDLL, LPGEN("Message Sessions") "/" LPGEN("Group chat log"), _logicons, _countof(_logicons), 0, g_plugin.m_hLang); - pci->MM_IconsChanged(); + g_chatApi.MM_IconsChanged(); } // get icon by name from the core icon library service @@ -836,7 +836,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM db_unset(0, CHAT_MODULE, "LogDirectory"); db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0); } - pci->SM_InvalidateLogDirectories(); + g_chatApi.SM_InvalidateLogDirectories(); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0); db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen); @@ -883,9 +883,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen); mir_free(pszText); - if (pci->hListBkgBrush) - DeleteObject(pci->hListBkgBrush); - pci->hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); + if (g_chatApi.hListBkgBrush) + DeleteObject(g_chatApi.hListBkgBrush); + g_chatApi.hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); return TRUE; } break; diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 180fa5d386..1e5a27c8c7 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -187,13 +187,13 @@ passed: COLORREF clr = 0; if ((iNewEvent & GC_EVENT_HIGHLIGHT)) { - clr = pci->aFonts[16].color; + clr = g_chatApi.aFonts[16].color; iNewEvent &= ~GC_EVENT_HIGHLIGHT; } if (iNewEvent == GC_EVENT_MESSAGE) { - ShowPopup(si->hContact, si, pci->hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : pci->aFonts[9].color, - TranslateT("%s%s says:%s %s"), bbStart, gce->ptszNick, bbEnd, pci->RemoveFormatting(gce->ptszText)); + ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : g_chatApi.aFonts[9].color, + TranslateT("%s%s says:%s %s"), bbStart, gce->ptszNick, bbEnd, g_chatApi.RemoveFormatting(gce->ptszText)); } else oldDoPopup(si, gce); @@ -221,14 +221,14 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) if (dat) { HWND hwndTab = GetParent(si->pDlg->GetHwnd()); - BOOL bForcedIcon = (p->hNotifyIcon == pci->hIcons[ICON_HIGHLIGHT] || p->hNotifyIcon == pci->hIcons[ICON_MESSAGE]); + BOOL bForcedIcon = (p->hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || p->hNotifyIcon == g_chatApi.hIcons[ICON_MESSAGE]); if ((p->iEvent & si->iLogTrayFlags) || bForcedIcon) { if (!p->bActiveTab) { - if (p->hNotifyIcon == pci->hIcons[ICON_HIGHLIGHT]) + if (p->hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT]) dat->m_iFlashIcon = p->hNotifyIcon; else { - if (dat->m_iFlashIcon != pci->hIcons[ICON_HIGHLIGHT] && dat->m_iFlashIcon != pci->hIcons[ICON_MESSAGE]) + if (dat->m_iFlashIcon != g_chatApi.hIcons[ICON_HIGHLIGHT] && dat->m_iFlashIcon != g_chatApi.hIcons[ICON_MESSAGE]) dat->m_iFlashIcon = p->hNotifyIcon; } dat->m_bCanFlashTab = TRUE; @@ -272,7 +272,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) } HICON hIcon = (HICON)SendMessage(dat->m_pContainer->m_hwnd, WM_GETICON, ICON_BIG, 0); - if (p->hNotifyIcon == pci->hIcons[ICON_HIGHLIGHT] || (hIcon != pci->hIcons[ICON_MESSAGE] && hIcon != pci->hIcons[ICON_HIGHLIGHT])) { + if (p->hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || (hIcon != g_chatApi.hIcons[ICON_MESSAGE] && hIcon != g_chatApi.hIcons[ICON_HIGHLIGHT])) { SendMessage(dat->m_pContainer->m_hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)p->hNotifyIcon); dat->m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; } @@ -327,7 +327,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (g_Settings.bFlashWindowHighlight && params->bInactive) params->bMustFlash = TRUE; params->bMustAutoswitch = TRUE; - params->hNotifyIcon = pci->hIcons[ICON_HIGHLIGHT]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_HIGHLIGHT]; } else { // do blinking icons in tray @@ -347,28 +347,28 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight case GC_EVENT_JOIN: params->sound = "ChatJoin"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_JOIN]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_JOIN]; break; case GC_EVENT_PART: params->sound = "ChatPart"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_PART]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_PART]; break; case GC_EVENT_QUIT: params->sound = "ChatQuit"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_QUIT]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_QUIT]; break; case GC_EVENT_ADDSTATUS: case GC_EVENT_REMOVESTATUS: params->sound = "ChatMode"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[params->iEvent == GC_EVENT_ADDSTATUS ? ICON_ADDSTATUS : ICON_REMSTATUS]; + params->hNotifyIcon = g_chatApi.hIcons[params->iEvent == GC_EVENT_ADDSTATUS ? ICON_ADDSTATUS : ICON_REMSTATUS]; break; case GC_EVENT_KICK: params->sound = "ChatKick"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_KICK]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_KICK]; break; case GC_EVENT_MESSAGE: params->sound = "ChatMessage"; @@ -380,56 +380,56 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight case GC_EVENT_ACTION: params->sound = "ChatAction"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_ACTION]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_ACTION]; break; case GC_EVENT_NICK: params->sound = "ChatNick"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_NICK]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_NICK]; break; case GC_EVENT_NOTICE: params->sound = "ChatNotice"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_NOTICE]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_NOTICE]; break; case GC_EVENT_TOPIC: params->sound = "ChatTopic"; if (params->bInactive) - params->hNotifyIcon = pci->hIcons[ICON_TOPIC]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_TOPIC]; break; } } else { switch (params->iEvent) { case GC_EVENT_JOIN: - params->hNotifyIcon = pci->hIcons[ICON_JOIN]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_JOIN]; break; case GC_EVENT_PART: - params->hNotifyIcon = pci->hIcons[ICON_PART]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_PART]; break; case GC_EVENT_QUIT: - params->hNotifyIcon = pci->hIcons[ICON_QUIT]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_QUIT]; break; case GC_EVENT_KICK: - params->hNotifyIcon = pci->hIcons[ICON_KICK]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_KICK]; break; case GC_EVENT_ACTION: - params->hNotifyIcon = pci->hIcons[ICON_ACTION]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_ACTION]; break; case GC_EVENT_NICK: - params->hNotifyIcon = pci->hIcons[ICON_NICK]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_NICK]; break; case GC_EVENT_NOTICE: - params->hNotifyIcon = pci->hIcons[ICON_NOTICE]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_NOTICE]; break; case GC_EVENT_TOPIC: - params->hNotifyIcon = pci->hIcons[ICON_TOPIC]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_TOPIC]; break; case GC_EVENT_ADDSTATUS: - params->hNotifyIcon = pci->hIcons[ICON_ADDSTATUS]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_ADDSTATUS]; break; case GC_EVENT_REMOVESTATUS: - params->hNotifyIcon = pci->hIcons[ICON_REMSTATUS]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_REMSTATUS]; break; } } @@ -438,7 +438,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight params->bMustAutoswitch = TRUE; if (g_Settings.bFlashWindow) params->bMustFlash = TRUE; - params->hNotifyIcon = pci->hIcons[ICON_MESSAGE]; + params->hNotifyIcon = g_chatApi.hIcons[ICON_MESSAGE]; } } if (dat && bFlagUnread) { @@ -536,7 +536,7 @@ char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex) for (USERINFO *ui = si->pUsers; ui; ui = ui->next) { if (!mir_wstrcmp(ui->pszNick, ptszNick)) { - STATUSINFO *ti = pci->TM_FindStatus(si->pStatuses, pci->TM_WordToString(si->pStatuses, ui->Status)); + STATUSINFO *ti = g_chatApi.TM_FindStatus(si->pStatuses, g_chatApi.TM_WordToString(si->pStatuses, ui->Status)); if (ti) { if (iNickIndex) *iNickIndex = ti->iIconIndex; // color table's index is not zero-based diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 49100fe14c..e51abd0bca 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -177,7 +177,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) m_pContainer->hwndSaved = m_hwnd; - pci->SetActiveSession(m_si); + g_chatApi.SetActiveSession(m_si); m_hTabIcon = m_hTabStatusIcon; if (m_iTabID >= 0) { @@ -261,7 +261,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) m_btnNickList.Enable(true); m_btnFilter.Enable(true); if (m_si->iType == GCW_CHATROOM) { - MODULEINFO *tmp = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *tmp = g_chatApi.MM_FindModule(m_si->pszModule); if (tmp) m_btnChannelMgr.Enable(tmp->bChanMgr); } @@ -427,7 +427,7 @@ LBL_SkipEnd: if (m_pLastSession != nullptr) pszName = m_pLastSession->ptszName; } - else pszName = pci->UM_FindUserAutoComplete(m_si->pUsers, m_wszSearchQuery, m_wszSearchResult); + else pszName = g_chatApi.UM_FindUserAutoComplete(m_si->pUsers, m_wszSearchQuery, m_wszSearchResult); replaceStrW(m_wszSearchResult, nullptr); @@ -489,10 +489,10 @@ CThumbBase* CChatRoomDlg::tabCreateThumb(CProxyWindow *pProxy) const void CChatRoomDlg::tabClearLog() { - SESSION_INFO *s = pci->SM_FindSession(m_si->ptszID, m_si->pszModule); + SESSION_INFO *s = g_chatApi.SM_FindSession(m_si->ptszID, m_si->pszModule); if (s) { ClearLog(); - pci->LM_RemoveAll(&s->pLog, &s->pLogEnd); + g_chatApi.LM_RemoveAll(&s->pLog, &s->pLogEnd); s->iEventCount = 0; s->LastTime = 0; m_si->iEventCount = 0; @@ -628,12 +628,12 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*) if (GetSendButtonState(m_hwnd) == PBS_DISABLED) return; - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); if (mi == nullptr) return; ptrA pszRtf(m_message.GetRichTextRtf()); - pci->SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf); + g_chatApi.SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf); CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf))); if (ptszText.IsEmpty()) @@ -847,7 +847,7 @@ void CChatRoomDlg::UpdateNickList() void CChatRoomDlg::UpdateOptions() { - MODULEINFO *pInfo = m_si ? pci->MM_FindModule(m_si->pszModule) : nullptr; + MODULEINFO *pInfo = m_si ? g_chatApi.MM_FindModule(m_si->pszModule) : nullptr; if (pInfo) { m_btnBold.Enable(pInfo->bBold); m_btnItalic.Enable(pInfo->bItalics); @@ -879,7 +879,7 @@ void CChatRoomDlg::UpdateStatusBar() return; //Mad: strange rare crash here... - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); if (!mi) return; @@ -1100,7 +1100,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) RemoveMenu(hSubMenu, 8, MF_BYPOSITION); RemoveMenu(hSubMenu, 4, MF_BYPOSITION); - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | ((mi && mi->bBold) ? MF_ENABLED : MF_GRAYED)); TranslateMenu(hSubMenu); @@ -1118,13 +1118,13 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) mwpd.hwnd = m_message.GetHwnd(); mwpd.hMenu = hSubMenu; mwpd.pt = pt; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); mwpd.selection = iSelection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); switch (iSelection) { case IDM_COPY: @@ -1323,7 +1323,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) } if (wParam == VK_UP && isCtrl && !isAlt) { - char *lpPrevCmd = pci->SM_GetPrevCommand(m_si->ptszID, m_si->pszModule); + char *lpPrevCmd = g_chatApi.SM_GetPrevCommand(m_si->ptszID, m_si->pszModule); if (!m_si->lpCurrentCommand || !m_si->lpCurrentCommand->last) { // Next command is not defined. It means currently entered text is not saved in the history and it @@ -1367,7 +1367,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) ste.flags = ST_DEFAULT; ste.codepage = CP_ACP; - char *lpPrevCmd = pci->SM_GetNextCommand(m_si->ptszID, m_si->pszModule); + char *lpPrevCmd = g_chatApi.SM_GetNextCommand(m_si->ptszID, m_si->pszModule); if (lpPrevCmd) m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd); else if (m_enteredText) { @@ -1516,7 +1516,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) // string we have int i, iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0); for (i = 0; i < iItems; i++) { - USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, i); + USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si->pUsers, i); if (ui) { if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) { m_nickList.SendMsg(LB_SETSEL, FALSE, -1); @@ -1749,7 +1749,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_CTLCOLORLISTBOX: SetBkColor((HDC)wParam, g_Settings.crUserListBGColor); - return (INT_PTR)pci->hListBkgBrush; + return (INT_PTR)g_chatApi.hListBkgBrush; case WM_MEASUREITEM: { @@ -1781,7 +1781,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int x_offset = 0; int index = dis->itemID; - USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, index); + USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si->pUsers, index); if (ui == nullptr) return TRUE; @@ -1790,14 +1790,14 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) height++; int offset = (height == 10) ? 0 : height / 2; - HICON hIcon = pci->SM_GetStatusIcon(m_si, ui); + HICON hIcon = g_chatApi.SM_GetStatusIcon(m_si, ui); HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx]; HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); SetBkMode(dis->hDC, TRANSPARENT); int nickIndex = 0; for (int i = 0; i < STATUSICONCOUNT; i++) { - if (hIcon == pci->hIcons[ICON_STATUS0 + i]) { + if (hIcon == g_chatApi.hIcons[ICON_STATUS0 + i]) { nickIndex = i; break; } @@ -1808,7 +1808,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SetTextColor(dis->hDC, g_Settings.nickColors[6]); } else { - FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush); + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); if (g_Settings.bColorizeNicks && nickIndex != 0) SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex - 1]); else diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 4df021f7a5..e541f394eb 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -191,7 +191,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HICON hIcon; if (dis->itemData > 0) - hIcon = (dis->itemData & 0x10000000) ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent; + hIcon = (dis->itemData & 0x10000000) ? g_chatApi.hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent; else if (dat != nullptr) { hIcon = dat->GetMyContactIcon(nullptr); idle = dat->m_idle; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 725632bf14..174aa7bcf9 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -108,14 +108,14 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) mwpd.hMenu = hSubMenu; mwpd.selection = 0; mwpd.pt = pt; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); // Second notification mwpd.selection = iSelection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); switch (iSelection) { case IDM_COPY: diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 39ef10892e..721046180f 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -862,7 +862,7 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const } else idx += 5; - MODULEINFO *mi = (isChat()) ? pci->MM_FindModule(m_si->pszModule) : nullptr; + MODULEINFO *mi = (isChat()) ? g_chatApi.MM_FindModule(m_si->pszModule) : nullptr; bool bInsideColor = false, bInsideUl = false; CMStringW res; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 083b648062..ba5aa42fa0 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -54,7 +54,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM) int SmileyAddOptionsChanged(WPARAM, LPARAM) { Srmm_Broadcast(DM_SMILEYOPTIONSCHANGED, 0, 0); - pci->SM_BroadcastMessage(nullptr, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE); + g_chatApi.SM_BroadcastMessage(nullptr, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE); return 0; } diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index d0744e2dcf..e0db76b3ff 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -120,7 +120,7 @@ bool CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dw return false; if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != nullptr) { - wchar_t *p = pci->RemoveFormatting(pgce->ptszText); + wchar_t *p = g_chatApi.RemoveFormatting(pgce->ptszText); p = NEWWSTR_ALLOCA(p); if (p == nullptr) return false; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index a053cf5659..b557416512 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -477,7 +477,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) dbei.pBlob = (PBYTE)job.szSendBuffer; MessageWindowEvent evt = { job.iSendId, job.hContact, &dbei }; - NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt); + NotifyEventHooks(g_chatApi.hevPreCreate, 0, (LPARAM)&evt); job.szSendBuffer = (char*)dbei.pBlob; MEVENT hNewEvent = db_event_add(job.hContact, &dbei); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 7487cd56e2..42acd42c6d 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -840,7 +840,7 @@ void CThumbMUC::renderContent() if (si == nullptr) return; - const MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + const MODULEINFO *mi = g_chatApi.MM_FindModule(si->pszModule); if (mi) { wchar_t szTemp[250]; if (m_dat->m_dwUnread) { -- cgit v1.2.3