summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h6
-rw-r--r--libs/win32/mir_app.libbin168570 -> 168840 bytes
-rw-r--r--libs/win64/mir_app.libbin163768 -> 164038 bytes
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp5
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp8
-rw-r--r--plugins/Scriver/src/chat_main.cpp26
-rw-r--r--plugins/Scriver/src/chat_manager.cpp4
-rw-r--r--plugins/Scriver/src/chat_options.cpp8
-rw-r--r--plugins/Scriver/src/chat_window.cpp40
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/input.cpp4
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp3
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp50
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp43
-rw-r--r--plugins/TabSRMM/src/chat_manager.cpp8
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp16
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp58
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp40
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp2
-rw-r--r--plugins/TabSRMM/src/muchighlight.cpp2
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp2
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp2
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp5
-rw-r--r--protocols/Discord/src/dispatch.cpp10
-rw-r--r--protocols/Discord/src/main.cpp3
-rw-r--r--protocols/Discord/src/server.cpp2
-rw-r--r--protocols/Discord/src/utils.cpp2
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp4
-rw-r--r--protocols/IRCG/src/main.cpp3
-rw-r--r--protocols/IRCG/src/scripting.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber.cpp4
-rw-r--r--protocols/SkypeWeb/src/main.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp2
-rw-r--r--protocols/Tox/src/main.cpp4
-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
-rw-r--r--src/mir_app/src/chat_clist.cpp8
-rw-r--r--src/mir_app/src/chat_log.cpp32
-rw-r--r--src/mir_app/src/chat_manager.cpp218
-rw-r--r--src/mir_app/src/chat_opts.cpp18
-rw-r--r--src/mir_app/src/chat_svc.cpp146
-rw-r--r--src/mir_app/src/chat_tools.cpp126
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/miranda.h4
-rw-r--r--src/mir_app/src/srmm_base.cpp24
-rw-r--r--src/mir_app/src/srmm_util.cpp2
57 files changed, 516 insertions, 554 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 82aff081a3..c50ffbd692 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -359,11 +359,9 @@ struct CHAT_MANAGER
void (*OnFlashHighlight)(SESSION_INFO*, int bInactive);
};
-#ifndef MIR_APP_EXPORTS
-extern CHAT_MANAGER *pci;
-#endif
+extern MIR_APP_EXPORT CHAT_MANAGER g_chatApi;
-EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = nullptr);
+EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pData);
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 7de33447fd..5dba355917 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index abf7ac5050..8a6fbcce4a 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
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 <char>::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_Data> 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();
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index aa31c69f5f..2ee6930721 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -252,9 +252,9 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
continue;
CMStringW wszOldNick;
- SESSION_INFO *si = pci->SM_FindSession(it->wszUsername, m_szModuleName);
+ SESSION_INFO *si = g_chatApi.SM_FindSession(it->wszUsername, m_szModuleName);
if (si != nullptr) {
- USERINFO *ui = pci->UM_FindUser(si->pUsers, wszUserId);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, wszUserId);
if (ui != nullptr)
wszOldNick = ui->pszNick;
}
@@ -300,9 +300,9 @@ void CDiscordProto::OnCommandRoleDeleted(const JSONNode &pRoot)
if (it->guildId != pGuild->id)
continue;
- SESSION_INFO *si = pci->SM_FindSession(it->wszUsername, m_szModuleName);
+ SESSION_INFO *si = g_chatApi.SM_FindSession(it->wszUsername, m_szModuleName);
if (si != nullptr) {
- pci->TM_RemoveAll(&si->pStatuses);
+ g_chatApi.TM_RemoveAll(&si->pStatuses);
BuildStatusList(pGuild, it->wszUsername);
}
}
@@ -358,7 +358,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
else {
debugLogA("store a message into the group channel id %lld", channelId);
- SESSION_INFO *si = pci->SM_FindSession(pUser->wszUsername, m_szModuleName);
+ SESSION_INFO *si = g_chatApi.SM_FindSession(pUser->wszUsername, m_szModuleName);
if (si == nullptr) {
debugLogA("message to unknown channel %lld ignored", channelId);
return;
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp
index e72f02b6a8..1dc83a4ce3 100644
--- a/protocols/Discord/src/main.cpp
+++ b/protocols/Discord/src/main.cpp
@@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CHAT_MANAGER *pci;
CMPlugin g_plugin;
HWND g_hwndHeartbeat;
@@ -59,8 +58,6 @@ IconItem g_iconList[] =
extern "C" int __declspec(dllexport) Load(void)
{
- pci = Chat_GetInterface();
-
g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
g_plugin.registerIcon("Discord", g_iconList);
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 5a3a41f99b..1fc868642f 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -65,7 +65,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
SESSION_INFO *si = nullptr;
if (!pUser->bIsPrivate) {
- si = pci->SM_FindSession(pUser->wszUsername, m_szModuleName);
+ si = g_chatApi.SM_FindSession(pUser->wszUsername, m_szModuleName);
if (si == nullptr) {
debugLogA("nessage to unknown channal %lld ignored", pUser->channelId);
return;
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index cd890f2514..e1867992db 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -265,7 +265,7 @@ void CDiscordProto::ParseSpecialChars(SESSION_INFO *si, CMStringW &str)
if (wszWord[1] == '!')
iStart++;
- USERINFO *ui = pci->UM_FindUser(si->pUsers, wszWord.c_str() + iStart);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, wszWord.c_str() + iStart);
if (ui != nullptr)
str.Replace(L"<" + wszWord + L">", CMStringW('@') + ui->pszNick);
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 081d6d6e0a..25e0c78060 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -96,7 +96,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD)
CMStringW name = GetWord(ppro->m_channelsToWho, 0);
if (name.IsEmpty()) {
ppro->m_channelsToWho = L"";
- int count = pci->SM_GetCount(ppro->m_szModuleName);
+ int count = g_chatApi.SM_GetCount(ppro->m_szModuleName);
for (int i = 0; i < count; i++) {
GC_INFO gci = { 0 };
gci.Flags = GCF_BYINDEX | GCF_NAME | GCF_TYPE | GCF_COUNT;
@@ -2353,7 +2353,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*)
}
if (m_rejoinChannels) {
- int count = pci->SM_GetCount(m_szModuleName);
+ int count = g_chatApi.SM_GetCount(m_szModuleName);
for (int i = 0; i < count; i++) {
GC_INFO gci = { 0 };
gci.Flags = GCF_BYINDEX | GCF_DATA | GCF_NAME | GCF_TYPE;
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index d2b9722c68..086cb11dd3 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "version.h"
CMPlugin g_plugin;
-CHAT_MANAGER *pci;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -67,8 +66,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
extern "C" int __declspec(dllexport) Load()
{
- pci = Chat_GetInterface();
-
InitIcons();
InitServers();
InitContactMenus();
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index 8de2060953..3926b6aefc 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -162,7 +162,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
}
else if (sRequest == "channellist") {
CMStringW S = L"";
- int n = pci->SM_GetCount(m_szModuleName);
+ int n = g_chatApi.SM_GetCount(m_szModuleName);
if (n >= 0) {
int j = 0;
while (j < n) {
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 369f2c5f76..556a479c96 100755
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HMODULE hMsftedit;
CMPlugin g_plugin;
-CHAT_MANAGER *pci;
int g_cbCountries;
CountryListEntry *g_countries;
@@ -151,9 +150,6 @@ static int OnModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load()
{
- // set the memory, lists & utf8 managers
- pci = Chat_GetInterface();
-
char mirVer[100];
Miranda_GetVersionText(mirVer, _countof(mirVer));
mir_wstrcpy(szCoreVersion, _A2T(mirVer));
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index 1f280d8763..cb8fe9e898 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
CMPlugin g_plugin;
-CHAT_MANAGER *pci;
char g_szMirVer[100];
HANDLE g_hCallEvent;
@@ -62,7 +61,6 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
- pci = Chat_GetInterface();
Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
CSkypeProto::InitIcons();
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 1e0401e648..b19d812c29 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -34,7 +34,7 @@ void CSkypeProto::InitGroupChatModule()
MCONTACT CSkypeProto::FindChatRoom(const char *chatname)
{
- SESSION_INFO *si = pci->SM_FindSession(_A2T(chatname), m_szModuleName);
+ SESSION_INFO *si = g_chatApi.SM_FindSession(_A2T(chatname), m_szModuleName);
return si ? si->hContact : 0;
}
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index a4d2df911a..329f6ffb51 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -1,7 +1,6 @@
#include "stdafx.h"
CMPlugin g_plugin;
-CHAT_MANAGER *pci;
HANDLE hProfileFolderPath;
@@ -49,10 +48,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
- pci = Chat_GetInterface();
-
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
-
return 0;
}
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);
}
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index 8fac7d27f1..339db5cca4 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -40,7 +40,7 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p
}
}
- MCONTACT hContact = chatApi.FindRoom(pszModule, pszRoom);
+ MCONTACT hContact = g_chatApi.FindRoom(pszModule, pszRoom);
if (hContact) { //contact exist, make sure it is in the right group
if (pszGroup[0]) {
ptrW grpName(db_get_wsa(hContact, "CList", "Group"));
@@ -85,7 +85,7 @@ BOOL SetAllOffline(BOOL, const char *pszModule)
{
for (auto &hContact : Contacts(pszModule)) {
char *szProto = GetContactProto(hContact);
- if (!chatApi.MM_FindModule(szProto))
+ if (!g_chatApi.MM_FindModule(szProto))
continue;
int i = db_get_b(hContact, szProto, "ChatRoom", 0);
if (i != 0) {
@@ -103,7 +103,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
return 0;
char *szProto = GetContactProto(hContact);
- if (chatApi.MM_FindModule(szProto) == nullptr)
+ if (g_chatApi.MM_FindModule(szProto) == nullptr)
return 0;
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
@@ -118,7 +118,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
si->pDlg->CloseTab();
return 1;
}
- chatApi.ShowRoom(si);
+ g_chatApi.ShowRoom(si);
}
return 1;
}
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 95d40df71c..46b9d5be4a 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -294,7 +294,7 @@ wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time)
char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
SESSION_INFO *si = streamData->si;
- MODULEINFO *mi = chatApi.MM_FindModule(si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(si->pszModule);
// guesstimate amount of memory for the RTF
CMStringA buf;
@@ -324,16 +324,16 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
}
if (g_Settings->bTimeStampEventColour) {
- LOGFONT &lf = chatApi.aFonts[0].lf;
+ LOGFONT &lf = g_chatApi.aFonts[0].lf;
// colored timestamps
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
int iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
- buf.AppendFormat("\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY);
+ buf.AppendFormat("\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / g_chatApi.logPixelSY);
}
else {
int iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
- buf.AppendFormat("\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / chatApi.logPixelSY);
+ buf.AppendFormat("\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / g_chatApi.logPixelSY);
}
}
else buf.AppendFormat("%s ", Log_SetStyle(0));
@@ -389,8 +389,8 @@ char* Log_CreateRtfHeader()
// get the number of pixels per logical inch
HDC hdc = GetDC(nullptr);
- chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
+ g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(nullptr, hdc);
// ### RTF HEADER
@@ -398,13 +398,13 @@ char* Log_CreateRtfHeader()
// font table
buf.Append("{\\rtf1\\ansi\\deff0{\\fonttbl");
for (int i = 0; i < OPTIONS_FONTCOUNT; i++)
- buf.AppendFormat("{\\f%u\\fnil\\fcharset%u%S;}", i, chatApi.aFonts[i].lf.lfCharSet, chatApi.aFonts[i].lf.lfFaceName);
+ buf.AppendFormat("{\\f%u\\fnil\\fcharset%u%S;}", i, g_chatApi.aFonts[i].lf.lfCharSet, g_chatApi.aFonts[i].lf.lfFaceName);
// colour table
buf.Append("}{\\colortbl ;");
for (int i = 0; i < OPTIONS_FONTCOUNT; i++)
- buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(chatApi.aFonts[i].color), GetGValue(chatApi.aFonts[i].color), GetBValue(chatApi.aFonts[i].color));
+ buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(g_chatApi.aFonts[i].color), GetGValue(g_chatApi.aFonts[i].color), GetBValue(g_chatApi.aFonts[i].color));
// new paragraph
buf.Append("}\\pard");
@@ -413,11 +413,11 @@ char* Log_CreateRtfHeader()
int iIndent = 0;
if (g_Settings->dwIconFlags) {
- iIndent += (14 * 1440) / chatApi.logPixelSX;
+ iIndent += (14 * 1440) / g_chatApi.logPixelSX;
buf.AppendFormat("\\tx%u", iIndent);
}
if (g_Settings->bShowTime) {
- int iSize = (g_Settings->LogTextIndent * 1440) / chatApi.logPixelSX;
+ int iSize = (g_Settings->LogTextIndent * 1440) / g_chatApi.logPixelSX;
buf.AppendFormat("\\tx%u", iIndent + iSize);
if (g_Settings->bLogIndentEnabled)
iIndent += iSize;
@@ -455,7 +455,7 @@ void LoadMsgLogBitmaps(void)
pLogIconBmpBits[i] = (char*)mir_alloc(size);
size_t rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
- HICON hIcon = chatApi.hIcons[i];
+ HICON hIcon = g_chatApi.hIcons[i];
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL);
@@ -473,18 +473,18 @@ void LoadMsgLogBitmaps(void)
ReleaseDC(nullptr, hdc);
DeleteObject(hBkgBrush);
- if (chatApi.logPixelSY == 0) {
+ if (g_chatApi.logPixelSY == 0) {
hdc = GetDC(nullptr);
- chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
+ g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(nullptr, hdc);
}
for (int i = 0; i < OPTIONS_FONTCOUNT; i++) {
- LOGFONT &F = chatApi.aFonts[i].lf;
+ LOGFONT &F = g_chatApi.aFonts[i].lf;
mir_snprintf(CHAT_rtfFontsGlobal[i], RTFCACHELINESIZE,
"\\f%u\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u", i, i + 1,
- F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / chatApi.logPixelSY);
+ F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / g_chatApi.logPixelSY);
}
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 10bdf56d93..345331ebb0 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -49,21 +49,21 @@ CHAT_MANAGER::CHAT_MANAGER() :
arSessions(g_arSessions)
{}
-CHAT_MANAGER chatApi;
+MIR_APP_EXPORT CHAT_MANAGER g_chatApi;
/////////////////////////////////////////////////////////////////////////////////////////
static void SetActiveSession(SESSION_INFO *si)
{
if (si) {
- replaceStrW(chatApi.szActiveWndID, si->ptszID);
- replaceStr(chatApi.szActiveWndModule, si->pszModule);
+ replaceStrW(g_chatApi.szActiveWndID, si->ptszID);
+ replaceStr(g_chatApi.szActiveWndModule, si->pszModule);
}
}
static SESSION_INFO* GetActiveSession(void)
{
- SESSION_INFO *si = SM_FindSession(chatApi.szActiveWndID, chatApi.szActiveWndModule);
+ SESSION_INFO *si = SM_FindSession(g_chatApi.szActiveWndID, g_chatApi.szActiveWndModule);
if (si)
return si;
@@ -92,15 +92,15 @@ static void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false)
// contact may have been deleted here already, since function may be called after deleting
// contact so the handle may be invalid, therefore db_get_b shall return 0
if (si->hContact && db_get_b(si->hContact, si->pszModule, "ChatRoom", 0) != 0) {
- chatApi.SetOffline(si->hContact, (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) ? TRUE : FALSE);
+ g_chatApi.SetOffline(si->hContact, (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) ? TRUE : FALSE);
db_set_s(si->hContact, si->pszModule, "Topic", "");
db_set_s(si->hContact, si->pszModule, "StatusBar", "");
db_unset(si->hContact, "CList", "StatusMsg");
}
- chatApi.UM_RemoveAll(&si->pUsers);
- chatApi.TM_RemoveAll(&si->pStatuses);
- chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ g_chatApi.UM_RemoveAll(&si->pUsers);
+ g_chatApi.TM_RemoveAll(&si->pStatuses);
+ g_chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
si->iStatusCount = 0;
si->nUsersInNicklist = 0;
@@ -172,13 +172,13 @@ BOOL SM_SetOffline(const char *pszModule, SESSION_INFO *si)
return TRUE;
}
- chatApi.UM_RemoveAll(&si->pUsers);
+ g_chatApi.UM_RemoveAll(&si->pUsers);
si->pMe = nullptr;
si->nUsersInNicklist = 0;
if (si->iType != GCW_SERVER)
si->bInitDone = false;
- if (chatApi.OnOfflineSession)
- chatApi.OnOfflineSession(si);
+ if (g_chatApi.OnOfflineSession)
+ g_chatApi.OnOfflineSession(si);
return TRUE;
}
@@ -187,11 +187,11 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO *ui)
if (!ui || !si)
return nullptr;
- STATUSINFO *ti = chatApi.TM_FindStatus(si->pStatuses, chatApi.TM_WordToString(si->pStatuses, ui->Status));
+ STATUSINFO *ti = g_chatApi.TM_FindStatus(si->pStatuses, g_chatApi.TM_WordToString(si->pStatuses, ui->Status));
if (ti != nullptr)
- return chatApi.hIcons[ICON_STATUS0 + ti->iIconIndex];
+ return g_chatApi.hIcons[ICON_STATUS0 + ti->iIconIndex];
- return chatApi.hIcons[ICON_STATUS0];
+ return g_chatApi.hIcons[ICON_STATUS0];
}
BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted)
@@ -200,7 +200,7 @@ BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool
if (si == nullptr)
return TRUE;
- LOGINFO *li = chatApi.LM_AddEvent(&si->pLog, &si->pLogEnd);
+ LOGINFO *li = g_chatApi.LM_AddEvent(&si->pLog, &si->pLogEnd);
si->iEventCount++;
li->iType = gce->iType;
@@ -214,7 +214,7 @@ BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool
li->bIsHighlighted = bIsHighlighted;
if (g_Settings->iEventLimit > 0 && si->iEventCount > g_Settings->iEventLimit + 20) {
- chatApi.LM_TrimLog(&si->pLog, &si->pLogEnd, si->iEventCount - g_Settings->iEventLimit);
+ g_chatApi.LM_TrimLog(&si->pLog, &si->pLogEnd, si->iEventCount - g_Settings->iEventLimit);
si->bTrimmed = true;
si->iEventCount = g_Settings->iEventLimit;
return FALSE;
@@ -231,7 +231,7 @@ BOOL SM_MoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *psz
if (si == nullptr)
return FALSE;
- chatApi.UM_SortUser(&si->pUsers, pszUID);
+ g_chatApi.UM_SortUser(&si->pUsers, pszUID);
return TRUE;
}
@@ -244,15 +244,15 @@ BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *p
if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
continue;
- USERINFO *ui = chatApi.UM_FindUser(si->pUsers, pszUID);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, pszUID);
if (ui) {
si->nUsersInNicklist--;
- if (chatApi.OnRemoveUser)
- chatApi.OnRemoveUser(si, ui);
+ if (g_chatApi.OnRemoveUser)
+ g_chatApi.OnRemoveUser(si, ui);
if (si->pMe == ui)
si->pMe = nullptr;
- chatApi.UM_RemoveUser(&si->pUsers, pszUID);
+ g_chatApi.UM_RemoveUser(&si->pUsers, pszUID);
if (si->pDlg)
si->pDlg->UpdateNickList();
@@ -268,7 +268,7 @@ BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *p
static USERINFO* SM_GetUserFromIndex(const wchar_t *pszID, const char *pszModule, int index)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- return (si == nullptr) ? nullptr : chatApi.UM_FindUserFromIndex(si->pUsers, index);
+ return (si == nullptr) ? nullptr : g_chatApi.UM_FindUserFromIndex(si->pUsers, index);
}
BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus)
@@ -277,7 +277,7 @@ BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *p
if (si == nullptr)
return FALSE;
- USERINFO *ui = chatApi.UM_GiveStatus(si->pUsers, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
+ USERINFO *ui = g_chatApi.UM_GiveStatus(si->pUsers, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
if (ui) {
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->pDlg)
@@ -292,7 +292,7 @@ BOOL SM_SetContactStatus(const wchar_t *pszID, const char *pszModule, const wcha
if (si == nullptr)
return FALSE;
- USERINFO *ui = chatApi.UM_SetContactStatus(si->pUsers, pszUID, wStatus);
+ USERINFO *ui = g_chatApi.UM_SetContactStatus(si->pUsers, pszUID, wStatus);
if (ui) {
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->pDlg)
@@ -307,7 +307,7 @@ BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *p
if (si == nullptr)
return FALSE;
- USERINFO *ui = chatApi.UM_TakeStatus(si->pUsers, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
+ USERINFO *ui = g_chatApi.UM_TakeStatus(si->pUsers, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
if (ui) {
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->pDlg)
@@ -353,8 +353,8 @@ BOOL SM_SetStatus(const char *pszModule, SESSION_INFO *si, int wStatus)
db_set_w(si->hContact, si->pszModule, "Status", (WORD)wStatus);
}
- if (chatApi.OnSetStatus)
- chatApi.OnSetStatus(si, wStatus);
+ if (g_chatApi.OnSetStatus)
+ g_chatApi.OnSetStatus(si, wStatus);
return TRUE;
}
@@ -366,14 +366,14 @@ BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT *gce)
for (auto &si : g_arSessions) {
if ((!pszID || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
- USERINFO *ui = chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
if (ui) {
replaceStrW(ui->pszNick, gce->ptszText);
SM_MoveUser(si->ptszID, si->pszModule, ui->pszUID);
if (si->pDlg)
si->pDlg->UpdateNickList();
- if (chatApi.OnChangeNick)
- chatApi.OnChangeNick(si);
+ if (g_chatApi.OnChangeNick)
+ g_chatApi.OnChangeNick(si);
}
if (pszID)
@@ -535,13 +535,13 @@ static MODULEINFO* MM_AddModule(const char *pszModule)
if (pszModule == nullptr)
return nullptr;
- if (chatApi.MM_FindModule(pszModule))
+ if (g_chatApi.MM_FindModule(pszModule))
return nullptr;
MODULEINFO *node = (MODULEINFO*)mir_calloc(g_cbModuleInfo);
replaceStr(node->pszModule, pszModule);
- if (chatApi.OnCreateModule)
- chatApi.OnCreateModule(node);
+ if (g_chatApi.OnCreateModule)
+ g_chatApi.OnCreateModule(node);
g_arModules.insert(node);
return node;
@@ -552,14 +552,14 @@ static void MM_IconsChanged()
LoadChatIcons();
for (auto &mi : g_arModules)
- if (chatApi.OnCreateModule) // recreate icons
- chatApi.OnCreateModule(mi);
+ if (g_chatApi.OnCreateModule) // recreate icons
+ g_chatApi.OnCreateModule(mi);
}
static void MM_FontsChanged()
{
for (auto &mi : g_arModules)
- mi->pszHeader = chatApi.Log_CreateRtfHeader();
+ mi->pszHeader = g_chatApi.Log_CreateRtfHeader();
}
static MODULEINFO* MM_FindModule(const char *pszModule)
@@ -573,8 +573,8 @@ static MODULEINFO* MM_FindModule(const char *pszModule)
static BOOL MM_RemoveAll(void)
{
for (auto &mi : g_arModules) {
- if (chatApi.OnDestroyModule)
- chatApi.OnDestroyModule(mi);
+ if (g_chatApi.OnDestroyModule)
+ g_chatApi.OnDestroyModule(mi);
mir_free(mi->pszModule);
mir_free(mi->ptszModDispName);
@@ -593,7 +593,7 @@ STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, in
if (!ppStatusList || !pszStatus)
return nullptr;
- if (!chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
+ if (!g_chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
STATUSINFO *node = (STATUSINFO*)mir_calloc(sizeof(STATUSINFO));
replaceStrW(node->pszGroup, pszStatus);
node->iIconIndex = *iCount;
@@ -719,7 +719,7 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
pLast = nullptr;
- while (ui && chatApi.UM_CompareItem(ui, node->pszNick, node->Status) <= 0) {
+ while (ui && g_chatApi.UM_CompareItem(ui, node->pszNick, node->Status) <= 0) {
pLast = ui;
ui = ui->next;
}
@@ -748,7 +748,7 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar
return nullptr;
USERINFO *ui = *ppUserList, *pLast = nullptr;
- while (ui && chatApi.UM_CompareItem(ui, pszNick, wStatus) <= 0) {
+ while (ui && g_chatApi.UM_CompareItem(ui, pszNick, wStatus) <= 0) {
pLast = ui;
ui = ui->next;
}
@@ -971,13 +971,13 @@ static BOOL LM_RemoveAll(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd)
return TRUE;
}
-MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit)
+MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pInit)
{
if (pInit == nullptr)
- return &chatApi;
+ return &g_chatApi;
// wipe out old junk
- memset(PBYTE(&chatApi) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnCreateModule));
+ memset(PBYTE(&g_chatApi) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnCreateModule));
if (g_cbSession) { // reallocate old sessions
mir_cslock lck(csChat);
@@ -1011,72 +1011,72 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit)
g_iFontMode = pInit->iFontMode;
g_iChatLang = pInit->iLangId;
- chatApi.SetActiveSession = SetActiveSession;
- chatApi.GetActiveSession = GetActiveSession;
- chatApi.SM_FindSession = SM_FindSession;
- chatApi.SM_GetStatusIcon = SM_GetStatusIcon;
- chatApi.SM_BroadcastMessage = SM_BroadcastMessage;
- chatApi.SM_AddCommand = SM_AddCommand;
- chatApi.SM_GetPrevCommand = SM_GetPrevCommand;
- chatApi.SM_GetNextCommand = SM_GetNextCommand;
- chatApi.SM_GetCount = SM_GetCount;
- chatApi.SM_FindSessionByIndex = SM_FindSessionByIndex;
- chatApi.SM_GetUserFromIndex = SM_GetUserFromIndex;
- chatApi.SM_InvalidateLogDirectories = SM_InvalidateLogDirectories;
-
- chatApi.MM_AddModule = MM_AddModule;
- chatApi.MM_FindModule = MM_FindModule;
- chatApi.MM_FontsChanged = MM_FontsChanged;
- chatApi.MM_IconsChanged = MM_IconsChanged;
- chatApi.MM_RemoveAll = MM_RemoveAll;
-
- chatApi.TM_FindStatus = TM_FindStatus;
- chatApi.TM_WordToString = TM_WordToString;
- chatApi.TM_RemoveAll = TM_RemoveAll;
-
- chatApi.UM_SetStatusEx = UM_SetStatusEx;
- chatApi.UM_AddUser = UM_AddUser;
- chatApi.UM_SortUser = UM_SortUser;
- chatApi.UM_FindUser = UM_FindUser;
- chatApi.UM_FindUserFromIndex = UM_FindUserFromIndex;
- chatApi.UM_GiveStatus = UM_GiveStatus;
- chatApi.UM_SetContactStatus = UM_SetContactStatus;
- chatApi.UM_TakeStatus = UM_TakeStatus;
- chatApi.UM_FindUserAutoComplete = UM_FindUserAutoComplete;
- chatApi.UM_RemoveUser = UM_RemoveUser;
- chatApi.UM_RemoveAll = UM_RemoveAll;
- chatApi.UM_CompareItem = UM_CompareItem;
-
- chatApi.LM_AddEvent = LM_AddEvent;
- chatApi.LM_TrimLog = LM_TrimLog;
- chatApi.LM_RemoveAll = LM_RemoveAll;
-
- chatApi.SetOffline = SetOffline;
- chatApi.SetAllOffline = SetAllOffline;
- chatApi.AddEvent = AddEvent;
- chatApi.FindRoom = FindRoom;
- chatApi.DoRtfToTags = DoRtfToTags;
-
- chatApi.Log_CreateRTF = Log_CreateRTF;
- chatApi.Log_CreateRtfHeader = Log_CreateRtfHeader;
- chatApi.LoadMsgDlgFont = LoadMsgDlgFont;
- chatApi.MakeTimeStamp = MakeTimeStamp;
-
- chatApi.DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
- chatApi.DoTrayIcon = DoTrayIcon;
- chatApi.DoPopup = DoPopup;
- chatApi.ShowPopup = ShowPopup;
- chatApi.LogToFile = LogToFile;
- chatApi.GetChatLogsFilename = GetChatLogsFilename;
- chatApi.Log_SetStyle = Log_SetStyle;
-
- chatApi.IsHighlighted = IsHighlighted;
- chatApi.RemoveFormatting = RemoveFormatting;
- chatApi.ReloadSettings = LoadGlobalSettings;
-
- chatApi.pLogIconBmpBits = pLogIconBmpBits;
+ g_chatApi.SetActiveSession = SetActiveSession;
+ g_chatApi.GetActiveSession = GetActiveSession;
+ g_chatApi.SM_FindSession = SM_FindSession;
+ g_chatApi.SM_GetStatusIcon = SM_GetStatusIcon;
+ g_chatApi.SM_BroadcastMessage = SM_BroadcastMessage;
+ g_chatApi.SM_AddCommand = SM_AddCommand;
+ g_chatApi.SM_GetPrevCommand = SM_GetPrevCommand;
+ g_chatApi.SM_GetNextCommand = SM_GetNextCommand;
+ g_chatApi.SM_GetCount = SM_GetCount;
+ g_chatApi.SM_FindSessionByIndex = SM_FindSessionByIndex;
+ g_chatApi.SM_GetUserFromIndex = SM_GetUserFromIndex;
+ g_chatApi.SM_InvalidateLogDirectories = SM_InvalidateLogDirectories;
+
+ g_chatApi.MM_AddModule = MM_AddModule;
+ g_chatApi.MM_FindModule = MM_FindModule;
+ g_chatApi.MM_FontsChanged = MM_FontsChanged;
+ g_chatApi.MM_IconsChanged = MM_IconsChanged;
+ g_chatApi.MM_RemoveAll = MM_RemoveAll;
+
+ g_chatApi.TM_FindStatus = TM_FindStatus;
+ g_chatApi.TM_WordToString = TM_WordToString;
+ g_chatApi.TM_RemoveAll = TM_RemoveAll;
+
+ g_chatApi.UM_SetStatusEx = UM_SetStatusEx;
+ g_chatApi.UM_AddUser = UM_AddUser;
+ g_chatApi.UM_SortUser = UM_SortUser;
+ g_chatApi.UM_FindUser = UM_FindUser;
+ g_chatApi.UM_FindUserFromIndex = UM_FindUserFromIndex;
+ g_chatApi.UM_GiveStatus = UM_GiveStatus;
+ g_chatApi.UM_SetContactStatus = UM_SetContactStatus;
+ g_chatApi.UM_TakeStatus = UM_TakeStatus;
+ g_chatApi.UM_FindUserAutoComplete = UM_FindUserAutoComplete;
+ g_chatApi.UM_RemoveUser = UM_RemoveUser;
+ g_chatApi.UM_RemoveAll = UM_RemoveAll;
+ g_chatApi.UM_CompareItem = UM_CompareItem;
+
+ g_chatApi.LM_AddEvent = LM_AddEvent;
+ g_chatApi.LM_TrimLog = LM_TrimLog;
+ g_chatApi.LM_RemoveAll = LM_RemoveAll;
+
+ g_chatApi.SetOffline = SetOffline;
+ g_chatApi.SetAllOffline = SetAllOffline;
+ g_chatApi.AddEvent = AddEvent;
+ g_chatApi.FindRoom = FindRoom;
+ g_chatApi.DoRtfToTags = DoRtfToTags;
+
+ g_chatApi.Log_CreateRTF = Log_CreateRTF;
+ g_chatApi.Log_CreateRtfHeader = Log_CreateRtfHeader;
+ g_chatApi.LoadMsgDlgFont = LoadMsgDlgFont;
+ g_chatApi.MakeTimeStamp = MakeTimeStamp;
+
+ g_chatApi.DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
+ g_chatApi.DoTrayIcon = DoTrayIcon;
+ g_chatApi.DoPopup = DoPopup;
+ g_chatApi.ShowPopup = ShowPopup;
+ g_chatApi.LogToFile = LogToFile;
+ g_chatApi.GetChatLogsFilename = GetChatLogsFilename;
+ g_chatApi.Log_SetStyle = Log_SetStyle;
+
+ g_chatApi.IsHighlighted = IsHighlighted;
+ g_chatApi.RemoveFormatting = RemoveFormatting;
+ g_chatApi.ReloadSettings = LoadGlobalSettings;
+
+ g_chatApi.pLogIconBmpBits = pLogIconBmpBits;
RegisterFonts();
OptionsInit();
- return &chatApi;
+ return &g_chatApi;
}
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index b532848027..0be395a93c 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -78,16 +78,16 @@ static void LoadColors()
void LoadLogFonts(void)
{
for (int i=0; i < OPTIONS_FONTCOUNT; i++)
- LoadMsgDlgFont(i, &chatApi.aFonts[i].lf, &chatApi.aFonts[i].color);
+ LoadMsgDlgFont(i, &g_chatApi.aFonts[i].lf, &g_chatApi.aFonts[i].color);
LoadColors();
- if (chatApi.hListBkgBrush != nullptr)
- DeleteObject(chatApi.hListBkgBrush);
- chatApi.hListBkgBrush = CreateSolidBrush(g_Settings->crUserListBGColor);
+ if (g_chatApi.hListBkgBrush != nullptr)
+ DeleteObject(g_chatApi.hListBkgBrush);
+ g_chatApi.hListBkgBrush = CreateSolidBrush(g_Settings->crUserListBGColor);
- if (chatApi.hListSelectedBkgBrush != nullptr)
- DeleteObject(chatApi.hListSelectedBkgBrush);
- chatApi.hListSelectedBkgBrush = CreateSolidBrush(g_Settings->crUserListSelectedBGColor);
+ if (g_chatApi.hListSelectedBkgBrush != nullptr)
+ DeleteObject(g_chatApi.hListSelectedBkgBrush);
+ g_chatApi.hListSelectedBkgBrush = CreateSolidBrush(g_Settings->crUserListSelectedBGColor);
}
void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
@@ -235,8 +235,8 @@ void LoadGlobalSettings(void)
LoadColors();
- if (chatApi.OnLoadSettings)
- chatApi.OnLoadSettings();
+ if (g_chatApi.OnLoadSettings)
+ g_chatApi.OnLoadSettings();
InitSetting(&g_Settings->pszTimeStamp, "HeaderTime", L"[%H:%M]");
InitSetting(&g_Settings->pszTimeStampLog, "LogTimestamp", L"[%d %b %y %H:%M]");
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index b700fa3be2..db317f7791 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -51,26 +51,26 @@ static HANDLE
void LoadChatIcons(void)
{
- chatApi.hIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE);
- chatApi.hIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE);
- chatApi.hIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE);
- chatApi.hIcons[ICON_INFO] = LoadIconEx("log_info", FALSE);
- chatApi.hIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE);
- chatApi.hIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE);
- chatApi.hIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE);
- chatApi.hIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE);
- chatApi.hIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE);
- chatApi.hIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE);
- chatApi.hIcons[ICON_PART] = LoadIconEx("log_part", FALSE);
- chatApi.hIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE);
- chatApi.hIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE);
- chatApi.hIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE);
- chatApi.hIcons[ICON_STATUS0] = LoadIconEx("status0", FALSE);
- chatApi.hIcons[ICON_STATUS1] = LoadIconEx("status1", FALSE);
- chatApi.hIcons[ICON_STATUS2] = LoadIconEx("status2", FALSE);
- chatApi.hIcons[ICON_STATUS3] = LoadIconEx("status3", FALSE);
- chatApi.hIcons[ICON_STATUS4] = LoadIconEx("status4", FALSE);
- chatApi.hIcons[ICON_STATUS5] = LoadIconEx("status5", FALSE);
+ g_chatApi.hIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE);
+ g_chatApi.hIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE);
+ g_chatApi.hIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE);
+ g_chatApi.hIcons[ICON_INFO] = LoadIconEx("log_info", FALSE);
+ g_chatApi.hIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE);
+ g_chatApi.hIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE);
+ g_chatApi.hIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE);
+ g_chatApi.hIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE);
+ g_chatApi.hIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE);
+ g_chatApi.hIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE);
+ g_chatApi.hIcons[ICON_PART] = LoadIconEx("log_part", FALSE);
+ g_chatApi.hIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE);
+ g_chatApi.hIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE);
+ g_chatApi.hIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE);
+ g_chatApi.hIcons[ICON_STATUS0] = LoadIconEx("status0", FALSE);
+ g_chatApi.hIcons[ICON_STATUS1] = LoadIconEx("status1", FALSE);
+ g_chatApi.hIcons[ICON_STATUS2] = LoadIconEx("status2", FALSE);
+ g_chatApi.hIcons[ICON_STATUS3] = LoadIconEx("status3", FALSE);
+ g_chatApi.hIcons[ICON_STATUS4] = LoadIconEx("status4", FALSE);
+ g_chatApi.hIcons[ICON_STATUS5] = LoadIconEx("status5", FALSE);
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
@@ -87,7 +87,7 @@ static int FontsChanged(WPARAM, LPARAM)
SetIndentSize();
g_Settings->bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
- chatApi.MM_FontsChanged();
+ g_chatApi.MM_FontsChanged();
Chat_UpdateOptions();
return 0;
}
@@ -97,7 +97,7 @@ static int IconsChanged(WPARAM, LPARAM)
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
- chatApi.MM_IconsChanged();
+ g_chatApi.MM_IconsChanged();
Chat_UpdateOptions();
return 0;
}
@@ -106,10 +106,10 @@ static int PreShutdown(WPARAM, LPARAM)
{
if (g_Settings != nullptr) {
SM_RemoveAll();
- chatApi.MM_RemoveAll();
+ g_chatApi.MM_RemoveAll();
- DeleteObject(chatApi.hListBkgBrush);
- DeleteObject(chatApi.hListSelectedBkgBrush);
+ DeleteObject(g_chatApi.hListBkgBrush);
+ DeleteObject(g_chatApi.hListSelectedBkgBrush);
}
return 0;
}
@@ -158,7 +158,7 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
return GC_ERROR;
mir_cslock lck(csChat);
- MODULEINFO *mi = chatApi.MM_AddModule(gcr->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_AddModule(gcr->pszModule);
if (mi == nullptr)
return GC_ERROR;
@@ -171,9 +171,9 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0;
mi->iMaxText = gcr->iMaxText;
- mi->pszHeader = chatApi.Log_CreateRtfHeader();
+ mi->pszHeader = g_chatApi.Log_CreateRtfHeader();
- chatApi.SetAllOffline(TRUE, gcr->pszModule);
+ g_chatApi.SetAllOffline(TRUE, gcr->pszModule);
return 0;
}
@@ -188,23 +188,23 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
void *pItemData) // Set user defined data for this session. Retrieve it by using the Chat_GetUserInfo() call
{
mir_cslockfull lck(csChat);
- MODULEINFO *mi = chatApi.MM_FindModule(pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(pszModule);
if (mi == nullptr)
return nullptr;
// try to restart a session first
SESSION_INFO *si = SM_FindSession(ptszID, pszModule);
if (si != nullptr) {
- chatApi.UM_RemoveAll(&si->pUsers);
- chatApi.TM_RemoveAll(&si->pStatuses);
+ g_chatApi.UM_RemoveAll(&si->pUsers);
+ g_chatApi.TM_RemoveAll(&si->pStatuses);
lck.unlock();
si->iStatusCount = 0;
si->nUsersInNicklist = 0;
si->pMe = nullptr;
- if (chatApi.OnReplaceSession)
- chatApi.OnReplaceSession(si);
+ if (g_chatApi.OnReplaceSession)
+ g_chatApi.OnReplaceSession(si);
return si;
}
@@ -213,7 +213,7 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
si->ptszID = mir_wstrdup(ptszID);
si->pszModule = mir_strdup(pszModule);
- chatApi.arSessions.insert(si);
+ g_chatApi.arSessions.insert(si);
lck.unlock();
// set the defaults
@@ -237,8 +237,8 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
else
db_set_s(si->hContact, si->pszModule, "StatusBar", "");
- if (chatApi.OnCreateSession)
- chatApi.OnCreateSession(si, mi);
+ if (g_chatApi.OnCreateSession)
+ g_chatApi.OnCreateSession(si, mi);
return si;
}
@@ -278,7 +278,7 @@ static INT_PTR __stdcall stubRoomControl(void *param)
return GC_EVENT_ERROR;
SetInitDone(si);
- chatApi.SetActiveSession(si);
+ g_chatApi.SetActiveSession(si);
break;
case WINDOW_VISIBLE:
@@ -288,7 +288,7 @@ static INT_PTR __stdcall stubRoomControl(void *param)
SetInitDone(si);
if (p->command != SESSION_INITDONE || db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) == 0)
- chatApi.ShowRoom(si);
+ g_chatApi.ShowRoom(si);
break;
case SESSION_OFFLINE:
@@ -316,7 +316,7 @@ static INT_PTR __stdcall stubRoomControl(void *param)
if (si == nullptr)
return GC_EVENT_ERROR;
- chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ g_chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
si->iEventCount = 0;
si->LastTime = 0;
if (si->pDlg)
@@ -369,13 +369,13 @@ static void AddUser(GCEVENT *gce)
WORD status = TM_StringToWord(si->pStatuses, gce->ptszStatus);
- USERINFO *ui = chatApi.UM_AddUser(si->pStatuses, &si->pUsers, gce->ptszUID, gce->ptszNick, status);
+ USERINFO *ui = g_chatApi.UM_AddUser(si->pStatuses, &si->pUsers, gce->ptszUID, gce->ptszNick, status);
if (ui == nullptr)
return;
si->nUsersInNicklist++;
- if (chatApi.OnAddUser)
- chatApi.OnAddUser(si, ui);
+ if (g_chatApi.OnAddUser)
+ g_chatApi.OnAddUser(si, ui);
ui->pszNick = mir_wstrdup(gce->ptszNick);
if (gce->bIsMe)
@@ -386,8 +386,8 @@ static void AddUser(GCEVENT *gce)
if (si->pDlg)
si->pDlg->UpdateNickList();
- if (chatApi.OnNewUser)
- chatApi.OnNewUser(si, ui);
+ if (g_chatApi.OnNewUser)
+ g_chatApi.OnNewUser(si, ui);
}
static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
@@ -398,11 +398,11 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
if (!si->bInitDone || mir_strcmpi(si->pszModule, gce->pszModule))
continue;
- if (!chatApi.UM_FindUser(si->pUsers, gce->ptszUID))
+ if (!g_chatApi.UM_FindUser(si->pUsers, gce->ptszUID))
continue;
- if (chatApi.OnEventBroadcast)
- chatApi.OnEventBroadcast(si, gce);
+ if (g_chatApi.OnEventBroadcast)
+ g_chatApi.OnEventBroadcast(si, gce);
if (si->pDlg && si->bInitDone) {
if (SM_AddEvent(si->ptszID, si->pszModule, gce, FALSE))
@@ -412,11 +412,11 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
}
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- chatApi.DoSoundsFlashPopupTrayStuff(si, gce, FALSE, bManyFix);
+ g_chatApi.DoSoundsFlashPopupTrayStuff(si, gce, FALSE, bManyFix);
bManyFix++;
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
- chatApi.LogToFile(si, gce);
+ g_chatApi.LogToFile(si, gce);
}
return 0;
@@ -447,8 +447,8 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
else
db_unset(si->hContact, si->pszModule, "Topic");
- if (chatApi.OnSetTopic)
- chatApi.OnSetTopic(si);
+ if (g_chatApi.OnSetTopic)
+ g_chatApi.OnSetTopic(si);
if (db_get_b(0, CHAT_MODULE, "TopicOnClist", 0)) {
if (pwszNew != nullptr)
@@ -461,37 +461,37 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
case GC_EVENT_ADDSTATUS:
SM_GiveStatus(gce->ptszID, gce->pszModule, gce->ptszUID, gce->ptszStatus);
- bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_REMOVESTATUS:
SM_TakeStatus(gce->ptszID, gce->pszModule, gce->ptszUID, gce->ptszStatus);
- bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
if (!gce->bIsMe && gce->ptszID && gce->ptszText) {
SESSION_INFO *si = SM_FindSession(gce->ptszID, gce->pszModule);
- bIsHighlighted = chatApi.IsHighlighted(si, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(si, gce);
}
break;
case GC_EVENT_NICK:
SM_ChangeNick(gce->ptszID, gce->pszModule, gce);
- bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_JOIN:
AddUser(gce);
- bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_PART:
case GC_EVENT_QUIT:
case GC_EVENT_KICK:
bRemoveFlag = TRUE;
- bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
+ bIsHighlighted = g_chatApi.IsHighlighted(nullptr, gce);
break;
}
@@ -503,7 +503,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
pMod = gce->pszModule;
}
else if (gce->iType == GC_EVENT_NOTICE || gce->iType == GC_EVENT_INFORMATION) {
- SESSION_INFO *si = chatApi.GetActiveSession();
+ SESSION_INFO *si = g_chatApi.GetActiveSession();
if (si && !mir_strcmp(si->pszModule, gce->pszModule)) {
pWnd = si->ptszID;
pMod = si->pszModule;
@@ -533,7 +533,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
if (si && (si->bInitDone || gce->iType == GC_EVENT_TOPIC || (gce->iType == GC_EVENT_JOIN && gce->bIsMe))) {
if (gce->ptszNick == nullptr && gce->ptszUID != nullptr) {
- USERINFO *ui = chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, gce->ptszUID);
if (ui != nullptr)
gce->ptszNick = ui->pszNick;
}
@@ -547,10 +547,10 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
}
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- chatApi.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ g_chatApi.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
- chatApi.LogToFile(si, gce);
+ g_chatApi.LogToFile(si, gce);
}
if (!bRemoveFlag)
@@ -591,8 +591,8 @@ MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const
if (ti)
si->iStatusCount++;
- if (chatApi.OnAddStatus)
- chatApi.OnAddStatus(si, ti);
+ if (g_chatApi.OnAddStatus)
+ g_chatApi.OnAddStatus(si, ti);
return 0;
}
@@ -625,7 +625,7 @@ MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, c
if ((wszId && mir_wstrcmpi(si->ptszID, wszId)) || mir_strcmpi(si->pszModule, szModule))
continue;
- USERINFO *ui = chatApi.UM_FindUser(si->pUsers, wszOldId);
+ USERINFO *ui = g_chatApi.UM_FindUser(si->pUsers, wszOldId);
if (ui)
replaceStrW(ui->pszUID, wszNewId);
if (wszId)
@@ -691,7 +691,7 @@ MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, in
if ((wszId && mir_wstrcmpi(si->ptszID, wszId)) || mir_strcmpi(si->pszModule, szModule))
continue;
- chatApi.UM_SetStatusEx(si->pUsers, wszText, flags);
+ g_chatApi.UM_SetStatusEx(si->pUsers, wszText, flags);
if (si->pDlg)
RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_LIST), nullptr, nullptr, RDW_INVALIDATE);
if (wszId)
@@ -702,7 +702,7 @@ MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, in
MIR_APP_DLL(int) Chat_SetUserInfo(const char *szModule, const wchar_t *wszId, void *pItemData)
{
- if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule)) {
+ if (SESSION_INFO *si = g_chatApi.SM_FindSession(wszId, szModule)) {
si->pItemData = pItemData;
return 0;
}
@@ -745,7 +745,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, LeaveChat);
- chatApi.SetAllOffline(TRUE, nullptr);
+ g_chatApi.SetAllOffline(TRUE, nullptr);
return 0;
}
@@ -762,8 +762,8 @@ int LoadChatModule(void)
hevSendEvent = CreateHookableEvent(ME_GC_EVENT);
hevBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
- chatApi.hevPreCreate = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
- chatApi.hevWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
+ g_chatApi.hevPreCreate = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
+ g_chatApi.hevWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
HookEvent(ME_FONT_RELOAD, FontsChanged);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
@@ -780,8 +780,8 @@ void UnloadChatModule(void)
if (!bInited)
return;
- mir_free(chatApi.szActiveWndID);
- mir_free(chatApi.szActiveWndModule);
+ mir_free(g_chatApi.szActiveWndID);
+ mir_free(g_chatApi.szActiveWndModule);
FreeMsgLogBitmaps();
OptionsUnInit();
@@ -792,8 +792,8 @@ void UnloadChatModule(void)
DestroyHookableEvent(hevBuildMenuEvent);
DestroyHookableEvent(hHookEvent);
- DestroyHookableEvent(chatApi.hevPreCreate);
- DestroyHookableEvent(chatApi.hevWinPopup);
+ DestroyHookableEvent(g_chatApi.hevPreCreate);
+ DestroyHookableEvent(g_chatApi.hevWinPopup);
DestroyMenu(g_hMenu);
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index ee89291d70..dfd627a4de 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -85,43 +85,43 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
switch (gce->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
- chatApi.AddEvent(si->hContact, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), GC_FAKE_EVENT, 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), GC_FAKE_EVENT, 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_MESSAGE:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_MESSAGE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_MESSAGE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_ACTION:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_ACTION], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_ACTION], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_JOIN:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_JOIN], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has joined %s"), gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_JOIN], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has joined %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_PART:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_PART], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has left %s"), gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_PART], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has left %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_QUIT:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_QUIT], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has disconnected"), gce->ptszNick);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_QUIT], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has disconnected"), gce->ptszNick);
break;
case GC_EVENT_NICK:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_NICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_NICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_KICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_KICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_NOTICE:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_NOTICE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Notice from %s"), gce->ptszNick);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_NOTICE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Notice from %s"), gce->ptszNick);
break;
case GC_EVENT_TOPIC:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_TOPIC], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Topic change in %s"), si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_TOPIC], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Topic change in %s"), si->ptszName);
break;
case GC_EVENT_INFORMATION:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_INFO], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Information in %s"), si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_INFO], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Information in %s"), si->ptszName);
break;
case GC_EVENT_ADDSTATUS:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_ADDSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s enables '%s' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_ADDSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s enables '%s' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_REMOVESTATUS:
- chatApi.AddEvent(si->hContact, chatApi.hIcons[ICON_REMSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s disables '%s' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
+ g_chatApi.AddEvent(si->hContact, g_chatApi.hIcons[ICON_REMSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s disables '%s' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
}
@@ -133,7 +133,7 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
static void __stdcall ShowRoomFromPopup(void *pi)
{
SESSION_INFO *si = (SESSION_INFO*)pi;
- chatApi.ShowRoom(si);
+ g_chatApi.ShowRoom(si);
}
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -210,58 +210,58 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
switch (gce->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
- chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, chatApi.aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, g_chatApi.aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
- chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, chatApi.aFonts[16].color, L"%s %s", gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, g_chatApi.aFonts[16].color, L"%s %s", gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_MESSAGE:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, chatApi.aFonts[9].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, g_chatApi.aFonts[9].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_ACTION], si->pszModule, si->ptszName, chatApi.aFonts[15].color, L"%s %s", gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_ACTION], si->pszModule, si->ptszName, g_chatApi.aFonts[15].color, L"%s %s", gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_JOIN:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_JOIN], si->pszModule, si->ptszName, chatApi.aFonts[3].color, TranslateT("%s has joined"), gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_JOIN], si->pszModule, si->ptszName, g_chatApi.aFonts[3].color, TranslateT("%s has joined"), gce->ptszNick);
break;
case GC_EVENT_PART:
if (!gce->ptszText)
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, chatApi.aFonts[4].color, TranslateT("%s has left"), gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, g_chatApi.aFonts[4].color, TranslateT("%s has left"), gce->ptszNick);
else
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, chatApi.aFonts[4].color, TranslateT("%s has left (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, g_chatApi.aFonts[4].color, TranslateT("%s has left (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
if (!gce->ptszText)
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, chatApi.aFonts[5].color, TranslateT("%s has disconnected"), gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, g_chatApi.aFonts[5].color, TranslateT("%s has disconnected"), gce->ptszNick);
else
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, chatApi.aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, g_chatApi.aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_NICK], si->pszModule, si->ptszName, chatApi.aFonts[7].color, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_NICK], si->pszModule, si->ptszName, g_chatApi.aFonts[7].color, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
if (!gce->ptszText)
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, chatApi.aFonts[6].color, TranslateT("%s kicked %s"), (char *)gce->ptszStatus, gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, g_chatApi.aFonts[6].color, TranslateT("%s kicked %s"), (char *)gce->ptszStatus, gce->ptszNick);
else
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, chatApi.aFonts[6].color, TranslateT("%s kicked %s (%s)"), (char *)gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, g_chatApi.aFonts[6].color, TranslateT("%s kicked %s (%s)"), (char *)gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_NOTICE], si->pszModule, si->ptszName, chatApi.aFonts[8].color, TranslateT("Notice from %s: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_NOTICE], si->pszModule, si->ptszName, g_chatApi.aFonts[8].color, TranslateT("Notice from %s: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_TOPIC:
if (!gce->ptszNick)
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, chatApi.aFonts[11].color, TranslateT("The topic is '%s'"), RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, g_chatApi.aFonts[11].color, TranslateT("The topic is '%s'"), RemoveFormatting(gce->ptszText));
else
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, chatApi.aFonts[11].color, TranslateT("The topic is '%s' (set by %s)"), RemoveFormatting(gce->ptszText), gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, g_chatApi.aFonts[11].color, TranslateT("The topic is '%s' (set by %s)"), RemoveFormatting(gce->ptszText), gce->ptszNick);
break;
case GC_EVENT_INFORMATION:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_INFO], si->pszModule, si->ptszName, chatApi.aFonts[12].color, L"%s", RemoveFormatting(gce->ptszText));
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_INFO], si->pszModule, si->ptszName, g_chatApi.aFonts[12].color, L"%s", RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ADDSTATUS:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_ADDSTATUS], si->pszModule, si->ptszName, chatApi.aFonts[13].color, TranslateT("%s enables '%s' status for %s"), gce->ptszText, (char *)gce->ptszStatus, gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_ADDSTATUS], si->pszModule, si->ptszName, g_chatApi.aFonts[13].color, TranslateT("%s enables '%s' status for %s"), gce->ptszText, (char *)gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
- chatApi.ShowPopup(si->hContact, si, chatApi.hIcons[ICON_REMSTATUS], si->pszModule, si->ptszName, chatApi.aFonts[14].color, TranslateT("%s disables '%s' status for %s"), gce->ptszText, (char *)gce->ptszStatus, gce->ptszNick);
+ g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_REMSTATUS], si->pszModule, si->ptszName, g_chatApi.aFonts[14].color, TranslateT("%s disables '%s' status for %s"), gce->ptszText, (char *)gce->ptszStatus, gce->ptszNick);
break;
}
@@ -295,23 +295,23 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
- chatApi.DoTrayIcon(si, gce);
+ g_chatApi.DoTrayIcon(si, gce);
if (bInactive || !g_Settings->bPopupInactiveOnly)
- chatApi.DoPopup(si, gce);
- if (chatApi.OnFlashHighlight)
- chatApi.OnFlashHighlight(si, bInactive);
+ g_chatApi.DoPopup(si, gce);
+ if (g_chatApi.OnFlashHighlight)
+ g_chatApi.OnFlashHighlight(si, bInactive);
return TRUE;
}
// do blinking icons in tray
if (bInactive || !g_Settings->bTrayIconInactiveOnly)
- chatApi.DoTrayIcon(si, gce);
+ g_chatApi.DoTrayIcon(si, gce);
// stupid thing to not create multiple popups for a QUIT event for instance
if (bManyFix == 0) {
// do popups
if (bInactive || !g_Settings->bPopupInactiveOnly)
- chatApi.DoPopup(si, gce);
+ g_chatApi.DoPopup(si, gce);
// do sounds and flashing
const char *szSound = nullptr;
@@ -333,8 +333,8 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
si->wState |= STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", ID_STATUS_OFFLINE);
}
- if (chatApi.OnFlashWindow)
- chatApi.OnFlashWindow(si, bInactive);
+ if (g_chatApi.OnFlashWindow)
+ g_chatApi.OnFlashWindow(si, bInactive);
break;
}
@@ -413,7 +413,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
CreateDirectoryTreeW(tszFolder);
wchar_t szTime[100];
- mir_wstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
+ mir_wstrncpy(szTime, g_chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _wfopen(si->pszLogFileName, L"ab+");
if (hFile == nullptr)
@@ -441,12 +441,12 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
case GC_EVENT_MESSAGE:
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_snwprintf(szBuffer, L"%s: %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s: %s", gce->ptszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
p = '*';
- mir_snwprintf(szBuffer, L"%s %s", gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, L"%s %s", gce->ptszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_JOIN:
p = '>';
@@ -457,14 +457,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (!gce->ptszText)
mir_snwprintf(szBuffer, TranslateT("%s has left"), pszNick);
else
- mir_snwprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has left (%s)"), pszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
p = '<';
if (!gce->ptszText)
mir_snwprintf(szBuffer, TranslateT("%s has disconnected"), pszNick);
else
- mir_snwprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s has disconnected (%s)"), pszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
p = '^';
@@ -475,22 +475,22 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (!gce->ptszText)
mir_snwprintf(szBuffer, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- mir_snwprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
p = 'o';
- mir_snwprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("Notice from %s: %s"), gce->ptszNick, g_chatApi.RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_TOPIC:
p = '#';
if (!gce->ptszNick)
- mir_snwprintf(szBuffer, TranslateT("The topic is '%s'"), chatApi.RemoveFormatting(gce->ptszText));
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s'"), g_chatApi.RemoveFormatting(gce->ptszText));
else
- mir_snwprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
+ mir_snwprintf(szBuffer, TranslateT("The topic is '%s' (set by %s)"), g_chatApi.RemoveFormatting(gce->ptszText), gce->ptszNick);
break;
case GC_EVENT_INFORMATION:
p = '!';
- wcsncpy_s(szBuffer, chatApi.RemoveFormatting(gce->ptszText), _TRUNCATE);
+ wcsncpy_s(szBuffer, g_chatApi.RemoveFormatting(gce->ptszText), _TRUNCATE);
break;
case GC_EVENT_ADDSTATUS:
p = '+';
@@ -613,7 +613,7 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
// check whether relevant parts of the timestamp have changed and
// we have to reparse the filename
- wchar_t *tszNow = chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
+ wchar_t *tszNow = g_chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
if (mir_wstrcmp(tszOldTimeStamp, tszNow)) {
wcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
@@ -622,34 +622,34 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
if (si->pszLogFileName[0] == 0) {
REPLACEVARSARRAY rva[11];
rva[0].key.w = L"d";
- rva[0].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
+ rva[0].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%#d", tTime));
// day 01-31
rva[1].key.w = L"dd";
- rva[1].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
+ rva[1].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%d", tTime));
// month 1-12
rva[2].key.w = L"m";
- rva[2].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
+ rva[2].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%#m", tTime));
// month 01-12
rva[3].key.w = L"mm";
- rva[3].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
+ rva[3].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%m", tTime));
// month text short
rva[4].key.w = L"mon";
- rva[4].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
+ rva[4].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%b", tTime));
// month text
rva[5].key.w = L"month";
- rva[5].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
+ rva[5].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%B", tTime));
// year 01-99
rva[6].key.w = L"yy";
- rva[6].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
+ rva[6].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%y", tTime));
// year 1901-9999
rva[7].key.w = L"yyyy";
- rva[7].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
+ rva[7].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%Y", tTime));
// weekday short
rva[8].key.w = L"wday";
- rva[8].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
+ rva[8].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%a", tTime));
// weekday
rva[9].key.w = L"weekday";
- rva[9].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
+ rva[9].value.w = mir_wstrdup(g_chatApi.MakeTimeStamp(L"%A", tTime));
// end of array
rva[10].key.w = nullptr;
rva[10].value.w = nullptr;
@@ -662,8 +662,8 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
else ptszVarPath = g_Settings->pszLogDir;
wchar_t *tszParsedName = Utils_ReplaceVarsW(ptszVarPath, si->hContact, rva);
- if (chatApi.OnGetLogName)
- chatApi.OnGetLogName(si, tszParsedName);
+ if (g_chatApi.OnGetLogName)
+ g_chatApi.OnGetLogName(si, tszParsedName);
else
PathToAbsoluteW(tszParsedName, si->pszLogFileName);
mir_free(tszParsedName);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 80b82ab300..6c61e2026e 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -281,7 +281,7 @@ Profile_GetPathW @293
Profile_SetDefault @294
FindDatabasePlugin @296
RegisterDatabasePlugin @298
-Chat_GetInterface @299
+Chat_CustomizeApi @299
Chat_Event @300
Chat_GetInfo @301
Chat_NewSession @302
@@ -613,3 +613,4 @@ UnregisterPlugin @633
?addFont@CMPluginBase@@QAEHPAUFontIDW@@@Z @642 NONAME
?addTTB@CMPluginBase@@QAEPAXPBUTTBButton@@@Z @643 NONAME
?g_CLI@@3UCLIST_INTERFACE@@A @644 NONAME
+?g_chatApi@@3UCHAT_MANAGER@@A @645 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 2f15988949..c0b7131851 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -281,7 +281,7 @@ Profile_GetPathW @293
Profile_SetDefault @294
FindDatabasePlugin @296
RegisterDatabasePlugin @298
-Chat_GetInterface @299
+Chat_CustomizeApi @299
Chat_Event @300
Chat_GetInfo @301
Chat_NewSession @302
@@ -613,3 +613,4 @@ UnregisterPlugin @633
?addFont@CMPluginBase@@QEAAHPEAUFontIDW@@@Z @642 NONAME
?addTTB@CMPluginBase@@QEAAPEAXPEBUTTBButton@@@Z @643 NONAME
?g_CLI@@3UCLIST_INTERFACE@@A @644 NONAME
+?g_chatApi@@3UCHAT_MANAGER@@A @645 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index d49ebbab17..3798094951 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -48,10 +48,6 @@ typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *);
extern pfnDwmExtendFrameIntoClientArea dwmExtendFrameIntoClientArea;
extern pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
-/**** chat.cpp *************************************************************************/
-
-extern struct CHAT_MANAGER chatApi;
-
/**** database.cpp *********************************************************************/
extern MDatabaseCommon *currDb;
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index c5ec59056b..b189320ce3 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -66,7 +66,7 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_IN
if (si) {
m_hContact = si->hContact;
- MODULEINFO *mi = chatApi.MM_FindModule(si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(si->pszModule);
if (mi != nullptr) {
if (mi->bColor) {
m_iFG = 4;
@@ -256,7 +256,7 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
case IDM_CLEAR:
m_log.SetText(L"");
- chatApi.LM_RemoveAll(&m_si->pLog, &m_si->pLogEnd);
+ g_chatApi.LM_RemoveAll(&m_si->pLog, &m_si->pLogEnd);
m_si->iEventCount = 0;
m_si->LastTime = 0;
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
@@ -425,7 +425,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
CMStringW wszBuf;
- USERINFO *ui1 = chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ USERINFO *ui1 = g_chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
wchar_t *p = (wchar_t*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
@@ -439,7 +439,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
wszBuf.Format(L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui1->pszNick,
TranslateT("Unique ID"), ui1->pszUID,
- TranslateT("Status"), chatApi.TM_WordToString(parentdat->pStatuses, ui1->Status));
+ TranslateT("Status"), g_chatApi.TM_WordToString(parentdat->pStatuses, ui1->Status));
ti.lpszText = wszBuf.GetBuffer();
}
@@ -466,7 +466,7 @@ static void CALLBACK ChatTimerProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD)
return;
}
- USERINFO *ui1 = chatApi.SM_GetUserFromIndex(si->ptszID, si->pszModule, si->currentHovered);
+ USERINFO *ui1 = g_chatApi.SM_GetUserFromIndex(si->ptszID, si->pszModule, si->currentHovered);
if (ui1) {
CMStringW wszBuf;
if (ProtoServiceExists(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
@@ -480,7 +480,7 @@ static void CALLBACK ChatTimerProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD)
wszBuf.Format(L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s",
TranslateT("Nick"), ui1->pszNick,
TranslateT("Unique ID"), ui1->pszUID,
- TranslateT("Status"), chatApi.TM_WordToString(si->pStatuses, ui1->Status));
+ TranslateT("Status"), g_chatApi.TM_WordToString(si->pStatuses, ui1->Status));
CLCINFOTIP ti = { sizeof(ti) };
if (CallService("mToolTip/ShowTipW", (WPARAM)wszBuf.c_str(), (LPARAM)&ti))
@@ -591,7 +591,7 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam
int items = m_si->nUsersInNicklist - index;
if (rc.bottom - rc.top > items * height) {
rc.top = items * height;
- FillRect(dc, &rc, chatApi.hListBkgBrush);
+ FillRect(dc, &rc, g_chatApi.hListBkgBrush);
}
}
return 1;
@@ -612,7 +612,7 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam
else ScreenToClient(m_nickList.GetHwnd(), &pt);
int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)));
- USERINFO *ui = chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
+ USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
if (ui != nullptr) {
if (pt.x == -1 && pt.y == -1)
pt.y += height - 4;
@@ -844,9 +844,9 @@ void CSrmmBaseDialog::onClick_History(CCtrlButton *pButton)
return;
if (m_si != nullptr) {
- MODULEINFO *pInfo = chatApi.MM_FindModule(m_si->pszModule);
+ MODULEINFO *pInfo = g_chatApi.MM_FindModule(m_si->pszModule);
if (pInfo)
- ShellExecute(m_hwnd, nullptr, chatApi.GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW);
+ ShellExecute(m_hwnd, nullptr, g_chatApi.GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW);
}
else CallService(MS_HISTORY_SHOWCONTACTHISTORY, m_hContact, 0);
}
@@ -865,7 +865,7 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList)
ScreenToClient(pList->GetHwnd(), &hti.pt);
int item = LOWORD(pList->SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = chatApi.UM_FindUserFromIndex(m_si->pUsers, item);
+ USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si->pUsers, item);
if (ui == nullptr)
return;
@@ -967,7 +967,7 @@ void CSrmmBaseDialog::RefreshButtonStatus(void)
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- MODULEINFO *mi = chatApi.MM_FindModule(m_si->pszModule);
+ MODULEINFO *mi = g_chatApi.MM_FindModule(m_si->pszModule);
if (mi == nullptr)
return;
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp
index ab5b9a1ae1..0cf6bd4b0c 100644
--- a/src/mir_app/src/srmm_util.cpp
+++ b/src/mir_app/src/srmm_util.cpp
@@ -33,7 +33,7 @@ MIR_APP_DLL(DWORD) CALLBACK Srmm_LogStreamCallback(DWORD_PTR dwCookie, LPBYTE pb
// create the RTF
if (lstrdat->buffer == nullptr) {
lstrdat->bufferOffset = 0;
- lstrdat->buffer = chatApi.Log_CreateRTF(lstrdat);
+ lstrdat->buffer = g_chatApi.Log_CreateRTF(lstrdat);
lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer);
}