summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-27 14:52:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-27 14:52:20 +0300
commit66ab99eb5b5c47a01e1cc6613af07426abbeb19b (patch)
tree6b3a84cf91b9e383f348355d702e4b38ff1be1e8 /src/core
parent38d70bf8d8d08cc687263b83ab598279d36a9c56 (diff)
unused variable CHAT_MANAGER *pci removed and replaced with g_chatApi
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp34
-rw-r--r--src/core/stdmsg/src/chat_options.cpp6
-rw-r--r--src/core/stdmsg/src/chat_window.cpp48
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stdmsg/src/globals.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp4
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp2
-rw-r--r--src/core/stdmsg/src/tabs.cpp6
8 files changed, 51 insertions, 53 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index 26b834617e..38d36978ad 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -27,12 +27,12 @@ pfnDoPopup oldDoPopup;
SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
{
- int i = pci->arSessions.indexOf(si);
+ int i = g_chatApi.arSessions.indexOf(si);
if (i == -1)
return nullptr;
for (i--; i >= 0; i--) {
- SESSION_INFO *p = pci->arSessions[i];
+ SESSION_INFO *p = g_chatApi.arSessions[i];
if (p->pDlg)
return p;
}
@@ -42,11 +42,11 @@ SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
{
- int i = pci->arSessions.indexOf(si);
+ int i = g_chatApi.arSessions.indexOf(si);
if (i == -1)
return nullptr;
- for (auto &p : pci->arSessions)
+ for (auto &p : g_chatApi.arSessions)
if (p->pDlg)
return p;
@@ -55,8 +55,6 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
/////////////////////////////////////////////////////////////////////////////////////////
-CHAT_MANAGER *pci;
-
HMENU g_hMenu = nullptr;
BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
@@ -130,7 +128,7 @@ static void OnLoadSettings()
DeleteObject(g_Settings.MessageAreaFont);
LOGFONT lf;
- pci->LoadMsgDlgFont(17, &lf, &g_Settings.MessageAreaColor);
+ g_chatApi.LoadMsgDlgFont(17, &lf, &g_Settings.MessageAreaColor);
g_Settings.MessageAreaFont = CreateFontIndirect(&lf);
g_Settings.iX = db_get_dw(0, CHAT_MODULE, "roomx", -1);
@@ -234,20 +232,20 @@ void Load_ChatModule()
RegisterFonts();
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message sessions") L"/" LPGENW("Chat module"), FONTMODE_USE };
- pci = Chat_GetInterface(&data);
+ Chat_CustomizeApi(&data);
- pci->OnCreateModule = OnCreateModule;
- pci->OnDestroyModule = OnDestroyModule;
- pci->OnReplaceSession = OnReplaceSession;
+ g_chatApi.OnCreateModule = OnCreateModule;
+ g_chatApi.OnDestroyModule = OnDestroyModule;
+ g_chatApi.OnReplaceSession = OnReplaceSession;
- pci->OnLoadSettings = OnLoadSettings;
- pci->OnFlashWindow = OnFlashWindow;
- pci->OnFlashHighlight = OnFlashHighlight;
- pci->ShowRoom = ShowRoom;
+ g_chatApi.OnLoadSettings = OnLoadSettings;
+ 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();
g_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU));
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp
index 10b645db68..1b20b5aee1 100644
--- a/src/core/stdmsg/src/chat_options.cpp
+++ b/src/core/stdmsg/src/chat_options.cpp
@@ -375,7 +375,7 @@ public:
if (PopupInstalled)
SaveBranch(branch6, _countof(branch6));
- pci->ReloadSettings();
+ g_chatApi.ReloadSettings();
Chat_UpdateOptions();
}
@@ -510,7 +510,7 @@ public:
db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText);
else
db_unset(0, CHAT_MODULE, "LogDirectory");
- pci->SM_InvalidateLogDirectories();
+ g_chatApi.SM_InvalidateLogDirectories();
pszText = rtrimw(edtLogTimestamp.GetText());
if (*pszText)
@@ -553,7 +553,7 @@ public:
else
db_unset(0, CHAT_MODULE, "NicklistRowDist");
- pci->ReloadSettings();
+ g_chatApi.ReloadSettings();
Chat_UpdateOptions();
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 66be4aaba6..828961afc8 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -97,7 +97,7 @@ void CChatRoomDlg::OnActivate()
g_Settings.iHeight = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
UpdateTitle();
- pci->SetActiveSession(m_si);
+ g_chatApi.SetActiveSession(m_si);
UpdateStatusBar();
if (KillTimer(m_hwnd, TIMERID_FLASHWND))
@@ -142,14 +142,14 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
if (pszRtf == nullptr)
return;
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
if (mi == nullptr)
return;
- 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)));
- pci->DoRtfToTags(ptszText, 0, nullptr);
+ g_chatApi.DoRtfToTags(ptszText, 0, nullptr);
ptszText.Trim();
ptszText.Replace(L"%", L"%%");
@@ -202,7 +202,7 @@ int CChatRoomDlg::GetImageId() const
if (m_si->wState & GC_EVENT_HIGHLIGHT)
return 0;
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
return (m_si->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex;
}
@@ -280,7 +280,7 @@ void CChatRoomDlg::UpdateOptions()
m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE));
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
EnableWindow(m_btnBold.GetHwnd(), mi->bBold);
EnableWindow(m_btnItalic.GetHwnd(), mi->bItalics);
EnableWindow(m_btnUnderline.GetHwnd(), mi->bUnderline);
@@ -291,7 +291,7 @@ void CChatRoomDlg::UpdateOptions()
HICON hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
if (!hIcon) {
- pci->MM_IconsChanged();
+ g_chatApi.MM_IconsChanged();
hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
}
@@ -329,7 +329,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 *ptszDispName = mi->ptszModDispName;
int x = 12;
x += Chat_GetTextPixelSize(ptszDispName, (HFONT)SendMessage(m_pOwner->m_hwndStatus, WM_GETFONT, 0, 0), TRUE);
@@ -340,7 +340,7 @@ void CChatRoomDlg::UpdateStatusBar()
// stupid hack to make icons show. I dunno why this is needed currently
HICON hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
if (!hIcon) {
- pci->MM_IconsChanged();
+ g_chatApi.MM_IconsChanged();
hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
}
@@ -423,8 +423,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;
@@ -686,7 +686,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (g_Settings.bTabsEnable)
SendMessage(GetParent(GetParent(m_hwnd)), GC_SWITCHNEXTTAB, 0, 0);
else
- pci->ShowRoom(SM_GetNextWindow(m_si));
+ g_chatApi.ShowRoom(SM_GetNextWindow(m_si));
return TRUE;
}
@@ -694,7 +694,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (g_Settings.bTabsEnable)
SendMessage(GetParent(GetParent(m_hwnd)), GC_SWITCHPREVTAB, 0, 0);
else
- pci->ShowRoom(SM_GetPrevWindow(m_si));
+ g_chatApi.ShowRoom(SM_GetPrevWindow(m_si));
return TRUE;
}
@@ -738,7 +738,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
wchar_t *pszSelName = (wchar_t *)mir_alloc(sizeof(wchar_t)*(end - start + 1));
mir_wstrncpy(pszSelName, pszText + start, end - start + 1);
- wchar_t *pszName = pci->UM_FindUserAutoComplete(m_si->pUsers, szTabSave, pszSelName);
+ wchar_t *pszName = g_chatApi.UM_FindUserAutoComplete(m_si->pUsers, szTabSave, pszSelName);
if (pszName == nullptr) {
pszName = szTabSave;
m_message.SendMsg(EM_SETSEL, start, end);
@@ -802,7 +802,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);
m_message.SendMsg(WM_SETREDRAW, FALSE, 0);
@@ -827,7 +827,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
}
if (wParam == VK_DOWN && isCtrl && !isAlt) {
- char *lpPrevCmd = pci->SM_GetNextCommand(m_si->ptszID, m_si->pszModule);
+ char *lpPrevCmd = g_chatApi.SM_GetNextCommand(m_si->ptszID, m_si->pszModule);
m_message.SendMsg(WM_SETREDRAW, FALSE, 0);
if (lpPrevCmd) {
@@ -1017,7 +1017,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
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);
}
CSuper::DlgProc(uMsg, wParam, lParam); // call built-in resizer
@@ -1031,7 +1031,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:
{
@@ -1060,7 +1060,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;
@@ -1074,16 +1074,16 @@ 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 hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
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 hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
@@ -1131,13 +1131,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/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index 726eb7a9dc..8532ae8249 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -97,7 +97,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz
dbei.pBlob = (PBYTE)p->szMsg;
MessageWindowEvent evt = { id, hContact, &dbei };
- NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt);
+ NotifyEventHooks(g_chatApi.hevPreCreate, 0, (LPARAM)&evt);
p->szMsg = (char*)dbei.pBlob;
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 08a91a5d3b..968e845c0d 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -42,7 +42,7 @@ static int IconsChanged(WPARAM, LPARAM)
static int OnShutdown(WPARAM, LPARAM)
{
- for (auto &si : pci->arSessions)
+ for (auto &si : g_chatApi.arSessions)
if (si->pDlg)
si->pDlg->Close();
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index a0828b0c32..e8e95ecff8 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -891,7 +891,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
}
// First notification
- NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
// Someone added items?
if (GetMenuItemCount(mwpd.hMenu) > 0) {
@@ -902,7 +902,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
// Second notification
mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(g_chatApi.hevWinPopup, 0, (LPARAM)&mwpd);
switch (mwpd.selection) {
case IDM_UNDO:
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 20622ddd70..c7aee9c376 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -556,7 +556,7 @@ public:
db_set_b(0, CHAT_MODULE, "TabCloseOnDblClick", m_chkTabsClose.GetState());
db_set_b(0, CHAT_MODULE, "TabRestore", m_chkTabsRestore.GetState());
- pci->ReloadSettings();
+ g_chatApi.ReloadSettings();
if (bOldValue != db_get_b(0, CHAT_MODULE, "Tabs", 1)) {
if (g_pTabDialog != nullptr)
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 8aa3608d1b..1b4f8867be 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -81,7 +81,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SESSION_INFO *si = pDlg->getChat();
if (si != nullptr) {
bool bOnline = db_get_w(si->hContact, si->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE;
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(si->pszModule);
bDragging = true;
iBeginIndex = idx;
ImageList_BeginDrag(Clist_GetImageList(), bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
@@ -196,7 +196,7 @@ void CTabbedWindow::OnInitDialog()
// restore previous tabs
if (g_Settings.bTabRestore) {
for (auto &p : arSavedTabs) {
- SESSION_INFO *si = pci->SM_FindSession(p->m_id, p->m_szModule);
+ SESSION_INFO *si = g_chatApi.SM_FindSession(p->m_id, p->m_szModule);
if (si)
AddPage(si);
}
@@ -414,7 +414,7 @@ void CTabbedWindow::TabClicked()
FixTabIcons(pDlg);
if (!s->pDlg) {
- pci->ShowRoom(s);
+ g_chatApi.ShowRoom(s);
SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
}