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/PasteIt/src/PasteIt.cpp | 5 +-- plugins/RecentContacts/src/RecentContacts.cpp | 8 +--- plugins/Scriver/src/chat_main.cpp | 26 ++++++------ plugins/Scriver/src/chat_manager.cpp | 4 +- plugins/Scriver/src/chat_options.cpp | 8 ++-- plugins/Scriver/src/chat_window.cpp | 40 +++++++++--------- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/input.cpp | 4 +- plugins/SendScreenshotPlus/src/CSend.cpp | 2 +- plugins/SendScreenshotPlus/src/Main.cpp | 3 -- 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 +- plugins/XSoundNotify/src/xsn_main.cpp | 5 +-- 24 files changed, 161 insertions(+), 177 deletions(-) (limited to 'plugins') diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index a419de75b1..a56a46d15e 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -35,7 +35,6 @@ static IconItem iconList[] = }; CMPlugin g_plugin; -CHAT_MANAGER *pci; #define FROM_CLIPBOARD 10 #define FROM_FILE 11 @@ -128,7 +127,7 @@ static void PasteIt(MCONTACT hContact, int mode) // in chat room. // Next step is to get all protocol sessions and find // one with correct hContact - int cnt = pci->SM_GetCount(szProto); + int cnt = g_chatApi.SM_GetCount(szProto); for (int i = 0; i < cnt; i++) { GC_INFO gci = {}; gci.iItem = i; @@ -349,8 +348,6 @@ static int ModulesLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { - pci = Chat_GetInterface(); - g_plugin.registerIcon(LPGEN("Paste It"), iconList); NETLIBUSER nlu = {}; diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 750249de5e..3babe1eeb4 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -9,8 +9,6 @@ static const basic_string ::size_type npos = -1; char *szProto; CMPlugin g_plugin; -CHAT_MANAGER *pci; - HANDLE hTopToolbarButtonShowList; HANDLE hMsgWndEvent; HGENMENU hMenuItemRemove; @@ -466,7 +464,7 @@ static int OnGCInEvent(WPARAM, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; if (gce->iType == GC_EVENT_MESSAGE) { - SESSION_INFO *si = pci->SM_FindSession(gce->ptszID, gce->pszModule); + SESSION_INFO *si = g_chatApi.SM_FindSession(gce->ptszID, gce->pszModule); if (si && si->hContact) { // skip old events if (gce->time && gce->time <= GetLastUsedTimeStamp(si->hContact)) @@ -481,7 +479,7 @@ static int OnGCOutEvent(WPARAM, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; if (gce->iType == GC_USER_MESSAGE) { - SESSION_INFO *si = pci->SM_FindSession(gce->ptszID, gce->pszModule); + SESSION_INFO *si = g_chatApi.SM_FindSession(gce->ptszID, gce->pszModule); if (si && si->hContact) SaveLastUsedTimeStamp(si->hContact); } @@ -546,8 +544,6 @@ static INT_PTR ToggleIgnore(WPARAM hContact, LPARAM) extern "C" __declspec(dllexport) int Load(void) { - pci = Chat_GetInterface(); - CoInitialize(nullptr); g_plugin.registerIcon("Recent Contacts", iconList); diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index 503c8b07b0..2a8e500710 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" // globals -CHAT_MANAGER *pci; - pfnDoTrayIcon oldDoTrayIcon; pfnDoPopup oldDoPopup; @@ -130,23 +128,23 @@ static void OnLoadSettings() int Chat_Load() { CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Messaging") L"/" LPGENW("Group chats"), FONTMODE_SKIP, g_plugin.m_hLang }; - pci = Chat_GetInterface(&data); + Chat_CustomizeApi(&data); - pci->OnCreateModule = OnCreateModule; - pci->OnDestroyModule = OnDestroyModule; - pci->OnLoadSettings = OnLoadSettings; + g_chatApi.OnCreateModule = OnCreateModule; + g_chatApi.OnDestroyModule = OnDestroyModule; + g_chatApi.OnLoadSettings = OnLoadSettings; - pci->OnSetStatus = OnSetStatus; + g_chatApi.OnSetStatus = OnSetStatus; - pci->OnReplaceSession = OnReplaceSession; + g_chatApi.OnReplaceSession = OnReplaceSession; - pci->OnFlashWindow = OnFlashWindow; - pci->OnFlashHighlight = OnFlashHighlight; - pci->ShowRoom = ShowRoom; + g_chatApi.OnFlashWindow = OnFlashWindow; + g_chatApi.OnFlashHighlight = OnFlashHighlight; + g_chatApi.ShowRoom = ShowRoom; - oldDoPopup = pci->DoPopup; pci->DoPopup = DoPopup; - oldDoTrayIcon = pci->DoTrayIcon; pci->DoTrayIcon = DoTrayIcon; - pci->ReloadSettings(); + oldDoPopup = g_chatApi.DoPopup; g_chatApi.DoPopup = DoPopup; + oldDoTrayIcon = g_chatApi.DoTrayIcon; g_chatApi.DoTrayIcon = DoTrayIcon; + g_chatApi.ReloadSettings(); return 0; } diff --git a/plugins/Scriver/src/chat_manager.cpp b/plugins/Scriver/src/chat_manager.cpp index 0bfadfeb7e..c76d4e3179 100644 --- a/plugins/Scriver/src/chat_manager.cpp +++ b/plugins/Scriver/src/chat_manager.cpp @@ -31,7 +31,7 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO *cu if (currSession == prevSession) pszCurrent = pszOriginal; - 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)) { @@ -50,7 +50,7 @@ char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui) if (!ui || !si) return '\0'; - 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) { switch (si->iStatusCount - ti->iIconIndex - 1) { case 0: return '\0'; diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp index 9f19428273..4d2efeb4db 100644 --- a/plugins/Scriver/src/chat_options.cpp +++ b/plugins/Scriver/src/chat_options.cpp @@ -309,7 +309,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_WIZFINISH: - pci->ReloadSettings(); + g_chatApi.ReloadSettings(); Chat_UpdateOptions(); break; @@ -514,7 +514,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM else if (((LPNMHDR)lParam)->idFrom == 0) { switch (((LPNMHDR)lParam)->code) { case PSN_WIZFINISH: - pci->ReloadSettings(); + g_chatApi.ReloadSettings(); Chat_UpdateOptions(); break; @@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); db_unset(0, CHAT_MODULE, "LogDirectory"); } - pci->SM_InvalidateLogDirectories(); + g_chatApi.SM_InvalidateLogDirectories(); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); if (iLen > 0) { @@ -609,7 +609,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopUpInactiveOnly", 1) != 0; g_Settings.bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; - pci->MM_FontsChanged(); + g_chatApi.MM_FontsChanged(); return TRUE; } } diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index cf8ab79cda..afd499701b 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -83,7 +83,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); mir_free(pszText); replaceStrW(m_wszSearchResult, nullptr); @@ -116,9 +116,9 @@ void CChatRoomDlg::FixTabIcons() HICON hIcon; if (!(m_si->wState & GC_EVENT_HIGHLIGHT)) { if (m_si->wState & STATE_TALK) - hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineTalkIcon; + hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? g_chatApi.MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : g_chatApi.MM_FindModule(m_si->pszModule)->hOfflineTalkIcon; else - hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineIcon; + hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? g_chatApi.MM_FindModule(m_si->pszModule)->hOnlineIcon : g_chatApi.MM_FindModule(m_si->pszModule)->hOfflineIcon; } else hIcon = g_dat.hMsgIcon; @@ -157,7 +157,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) m_btnNickList.Enable(true); m_btnFilter.Enable(true); if (m_si->iType == GCW_CHATROOM) - m_btnChannelMgr.Enable(pci->MM_FindModule(m_si->pszModule)->bChanMgr); + m_btnChannelMgr.Enable(g_chatApi.MM_FindModule(m_si->pszModule)->bChanMgr); } int toolbarTopY = bToolbar ? h - m_pParent->iSplitterY - toolbarHeight : h - m_pParent->iSplitterY; @@ -309,7 +309,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) if (!pButton->Enabled()) return; - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); if (mi == nullptr) return; @@ -327,7 +327,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) cmdList = tcmdlist_append(cmdList, pszRtf, 20, FALSE); CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf))); - pci->DoRtfToTags(ptszText, 0, nullptr); + g_chatApi.DoRtfToTags(ptszText, 0, nullptr); ptszText.Trim(); ptszText.Replace(L"%", L"%%"); @@ -437,7 +437,7 @@ void CChatRoomDlg::UpdateNickList() m_nickList.SendMsg(WM_SETREDRAW, FALSE, 0); m_nickList.SendMsg(LB_RESETCONTENT, 0, 0); for (int index = 0; index < m_si->nUsersInNicklist; index++) { - USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); + USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); if (ui) { char szIndicator = SM_GetStatusIndicator(m_si, ui); if (szIndicator > '\0') { @@ -459,7 +459,7 @@ void CChatRoomDlg::UpdateOptions() m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2")); m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2")); { - MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *pInfo = g_chatApi.MM_FindModule(m_si->pszModule); if (pInfo) { m_btnBold.Enable(pInfo->bBold); m_btnItalic.Enable(pInfo->bItalics); @@ -510,7 +510,7 @@ void CChatRoomDlg::UpdateOptions() void CChatRoomDlg::UpdateStatusBar() { - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); wchar_t szTemp[512]; mir_snwprintf(szTemp, L"%s : %s", mi->ptszModDispName, m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L""); @@ -533,7 +533,7 @@ void CChatRoomDlg::UpdateStatusBar() void CChatRoomDlg::UpdateTitle() { - MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule); TitleBarData tbd = {}; tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon; @@ -819,7 +819,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) if (wParam == VK_RETURN) { int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0); if (index != LB_ERR) { - USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); + USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0); } break; @@ -858,7 +858,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) // string we have int iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0); for (int 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_SETCURSEL, i, 0); @@ -935,7 +935,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: if (!MeasureMenuItem(wParam, lParam)) { @@ -962,7 +962,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (dis->CtlID == IDC_SRMM_NICKLIST) { int index = dis->itemID; - USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); + USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); if (ui) { int x_offset = 2; @@ -976,9 +976,9 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SetBkMode(dis->hDC, TRANSPARENT); if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) - FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush); + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush); else //if (dis->itemState & ODS_INACTIVE) - FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush); + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); @@ -986,7 +986,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) IcoLib_ReleaseIcon(hIcon); x_offset += 18; } - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); x_offset += 12; if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); @@ -1013,7 +1013,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg != WM_ACTIVATE) SetFocus(m_message.GetHwnd()); - pci->SetActiveSession(m_si); + g_chatApi.SetActiveSession(m_si); if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0) db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0); @@ -1041,13 +1041,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetCursorPos(&p); ScreenToClient(m_nickList.GetHwnd(), &p); int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y))); - USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); + USERINFO *ui = g_chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); if (ui != nullptr) { static wchar_t ptszBuf[1024]; mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui->pszNick, TranslateT("Unique ID"), ui->pszUID, - TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status)); + TranslateT("Status"), g_chatApi.TM_WordToString(parentdat->pStatuses, ui->Status)); lpttd->lpszText = ptszBuf; } } diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index f1db66c333..cb2632db08 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -153,7 +153,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.pBlob = (PBYTE)item->sendBuffer; MessageWindowEvent evt = { item->hSendId, hContact, &dbei }; - NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt); + NotifyEventHooks(g_chatApi.hevPreCreate, 0, (LPARAM)&evt); item->sendBuffer = (char *)dbei.pBlob; db_event_add(hContact, &dbei); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 5e819d1322..61acf8f9be 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -70,14 +70,14 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact) mwpd.hMenu = hSubMenu; mwpd.selection = 0; mwpd.pt = pt; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); int selection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), nullptr); // Second notification mwpd.selection = selection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd); switch (selection) { case IDM_UNDO: diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 356d3d5fdf..be31a7bfe0 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -218,7 +218,7 @@ void CSend::svcSendMsgExit(const char* szMessage) } int res = GC_RESULT_NOSESSION; - int cnt = pci->SM_GetCount(m_pszProto); + int cnt = g_chatApi.SM_GetCount(m_pszProto); // loop on all gc session to get the right (save) ptszID for the chatroom from m_hContact GC_INFO gci = { 0 }; diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index b50e5f7ac8..395ff7907d 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////// CMPlugin g_plugin; -CHAT_MANAGER *pci; MGLOBAL g_myGlobals; HNETLIBUSER g_hNetlibUser; @@ -265,8 +264,6 @@ ATOM g_clsTargetHighlighter = 0; extern "C" __declspec(dllexport) int Load(void) { - pci = Chat_GetInterface(); - /// hook events HookEvent(ME_SYSTEM_MODULESLOADED, hook_ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, hook_SystemPreShutdown); 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) { diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 4802e65965..5e766f0bb7 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -10,7 +10,6 @@ There is no warranty. #include "stdafx.h" CMPlugin g_plugin; -CHAT_MANAGER *pci; LIST XSN_Users(10, NumericKeySortT); HGENMENU hChangeSound = nullptr; @@ -144,7 +143,7 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam) if (gce->iType != GC_EVENT_MESSAGE) return 0; - MCONTACT hContact = pci->FindRoom(gce->pszModule, gce->ptszID); + MCONTACT hContact = g_chatApi.FindRoom(gce->pszModule, gce->ptszID); if (hContact != 0) { ptrW nick(db_get_wsa(hContact, gce->pszModule, "MyNick")); if (nick == NULL || gce->ptszText == nullptr) @@ -234,8 +233,6 @@ static int OnPreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load() { - pci = Chat_GetInterface(); - CreateServiceFunction("XSoundNotify/ContactMenuCommand", ShowDialog); hChangeSoundDlgList = WindowList_Create(); -- cgit v1.2.3