summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdclist/src/clistmenus.cpp2
-rw-r--r--src/core/stdclist/src/clistopts.cpp2
-rw-r--r--src/core/stdclist/src/cluiopts.cpp66
-rw-r--r--src/core/stdclist/src/init.cpp17
-rw-r--r--src/core/stdfile/src/file.cpp6
-rw-r--r--src/core/stdfile/src/main.cpp4
-rw-r--r--src/core/stdidle/src/main.cpp3
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp4
-rw-r--r--src/core/stdmsg/src/chat_window.cpp4
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp2
-rw-r--r--src/core/stdmsg/src/msglog.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp10
-rw-r--r--src/core/stdmsg/src/srmm.cpp4
-rw-r--r--src/core/stdmsg/src/tabs.cpp4
-rw-r--r--src/core/stduseronline/src/main.cpp3
-rw-r--r--src/core/stduseronline/src/useronline.cpp4
-rw-r--r--src/mir_app/src/auth.cpp4
-rw-r--r--src/mir_app/src/chat_clist.cpp12
-rw-r--r--src/mir_app/src/chat_manager.cpp4
-rw-r--r--src/mir_app/src/chat_tools.cpp4
-rw-r--r--src/mir_app/src/clc.cpp170
-rw-r--r--src/mir_app/src/clcfiledrop.cpp10
-rw-r--r--src/mir_app/src/clcidents.cpp4
-rw-r--r--src/mir_app/src/clcitems.cpp60
-rw-r--r--src/mir_app/src/clcmsgs.cpp60
-rw-r--r--src/mir_app/src/clcutils.cpp82
-rw-r--r--src/mir_app/src/clistcore.cpp142
-rw-r--r--src/mir_app/src/clistevents.cpp32
-rw-r--r--src/mir_app/src/clistgroups.cpp2
-rw-r--r--src/mir_app/src/clistmod.cpp34
-rw-r--r--src/mir_app/src/clistsettings.cpp28
-rw-r--r--src/mir_app/src/clisttray.cpp254
-rw-r--r--src/mir_app/src/clui.cpp128
-rw-r--r--src/mir_app/src/cluiservices.cpp24
-rw-r--r--src/mir_app/src/contact.cpp2
-rw-r--r--src/mir_app/src/contacts.cpp2
-rw-r--r--src/mir_app/src/ei_services.cpp20
-rw-r--r--src/mir_app/src/keyboard.cpp6
-rw-r--r--src/mir_app/src/menu_clist.cpp22
-rw-r--r--src/mir_app/src/menu_groups.cpp24
-rw-r--r--src/mir_app/src/menu_tray.cpp2
-rw-r--r--src/mir_app/src/meta_addto.cpp2
-rw-r--r--src/mir_app/src/meta_edit.cpp2
-rw-r--r--src/mir_app/src/meta_menu.cpp2
-rw-r--r--src/mir_app/src/meta_services.cpp4
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/miranda.h2
48 files changed, 634 insertions, 649 deletions
diff --git a/src/core/stdclist/src/clistmenus.cpp b/src/core/stdclist/src/clistmenus.cpp
index afdb4c8da7..9ac72f36e2 100644
--- a/src/core/stdclist/src/clistmenus.cpp
+++ b/src/core/stdclist/src/clistmenus.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static INT_PTR CloseAction(WPARAM, LPARAM)
{
if (Miranda_OkToExit())
- DestroyWindow(pcli->hwndContactList);
+ DestroyWindow(g_CLI.hwndContactList);
return(0);
}
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp
index 623787e931..65e6f790fb 100644
--- a/src/core/stdclist/src/clistopts.cpp
+++ b/src/core/stdclist/src/clistopts.cpp
@@ -178,7 +178,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
Clist_TrayIconIconsChanged();
Clist_LoadContactTree(); /* this won't do job properly since it only really works when changes happen */
- pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); /* force reshuffle */
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); /* force reshuffle */
return TRUE;
}
break;
diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp
index f4607ada42..6d1f00ddd3 100644
--- a/src/core/stdclist/src/cluiopts.cpp
+++ b/src/core/stdclist/src/cluiopts.cpp
@@ -168,11 +168,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
db_set_ws(NULL, "CList", "TitleText", title);
- SetWindowText(pcli->hwndContactList, title);
+ SetWindowText(g_CLI.hwndContactList, title);
}
- pcli->pfnLoadCluiGlobalOpts();
- SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST,
+ g_CLI.pfnLoadCluiGlobalOpts();
+ SetWindowPos(g_CLI.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) {
@@ -180,50 +180,50 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
// See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp
WINDOWPLACEMENT p;
p.length = sizeof(p);
- GetWindowPlacement(pcli->hwndContactList, &p);
- ShowWindow(pcli->hwndContactList, SW_HIDE);
- SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE,
- GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_APPWINDOW | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE);
- SetWindowPlacement(pcli->hwndContactList, &p);
+ GetWindowPlacement(g_CLI.hwndContactList, &p);
+ ShowWindow(g_CLI.hwndContactList, SW_HIDE);
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE,
+ GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) & ~WS_EX_APPWINDOW | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE);
+ SetWindowPlacement(g_CLI.hwndContactList, &p);
}
else
- SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);
if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) {
HWND hProgMan = FindWindow(L"Progman", nullptr);
if (hProgMan)
- SetParent(pcli->hwndContactList, hProgMan);
+ SetParent(g_CLI.hwndContactList, hProgMan);
}
else
- SetParent(pcli->hwndContactList, nullptr);
+ SetParent(g_CLI.hwndContactList, nullptr);
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
- int style = GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
- SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, style);
+ int style = GetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE, style);
}
else {
- SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
- GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX));
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE,
+ GetWindowLongPtr(g_CLI.hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX));
}
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
- SetMenu(pcli->hwndContactList, nullptr);
+ SetMenu(g_CLI.hwndContactList, nullptr);
else
- SetMenu(pcli->hwndContactList, pcli->hMenuMain);
+ SetMenu(g_CLI.hwndContactList, g_CLI.hMenuMain);
- SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
- RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
+ SetWindowPos(g_CLI.hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ RedrawWindow(g_CLI.hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
- if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
- ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW);
+ if (IsIconic(g_CLI.hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
+ ShowWindow(g_CLI.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW);
if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
- SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
- SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
+ SetLayeredWindowAttributes(g_CLI.hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
else
- SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+ SetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_CLI.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
- SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
+ SendMessage(g_CLI.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
return TRUE;
}
@@ -283,22 +283,22 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
db_set_b(NULL, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
- pcli->pfnLoadCluiGlobalOpts();
+ g_CLI.pfnLoadCluiGlobalOpts();
if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
- HWND parent = GetParent(pcli->hwndStatus);
+ HWND parent = GetParent(g_CLI.hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
- ShowWindow(pcli->hwndStatus, SW_HIDE);
- DestroyWindow(pcli->hwndStatus);
+ ShowWindow(g_CLI.hwndStatus, SW_HIDE);
+ DestroyWindow(g_CLI.hwndStatus);
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
+ g_CLI.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
- ShowWindow(pcli->hwndStatus, SW_SHOW);
+ ShowWindow(g_CLI.hwndStatus, SW_SHOW);
else
- ShowWindow(pcli->hwndStatus, SW_HIDE);
- SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
+ ShowWindow(g_CLI.hwndStatus, SW_HIDE);
+ SendMessage(g_CLI.hwndContactList, WM_SIZE, 0, 0);
return TRUE;
}
break;
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp
index 94d4517491..fc49caac7a 100644
--- a/src/core/stdclist/src/init.cpp
+++ b/src/core/stdclist/src/init.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
CMPlugin g_plugin;
-CLIST_INTERFACE* pcli = nullptr, coreCli;
+CLIST_INTERFACE coreCli;
HIMAGELIST himlCListClc = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -99,7 +99,7 @@ static int OnOptsInit(WPARAM wParam, LPARAM lParam)
static INT_PTR GetStatusMode(WPARAM, LPARAM)
{
- return pcli->currentDesiredStatusMode;
+ return g_CLI.currentDesiredStatusMode;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -107,16 +107,15 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM)
extern "C" __declspec(dllexport) int CListInitialise()
{
- pcli = Clist_GetInterface();
-
g_bSortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
- coreCli = *pcli;
- pcli->hInst = g_plugin.getInst();
- pcli->pfnPaintClc = PaintClc;
- pcli->pfnLoadClcOptions = LoadClcOptions;
- pcli->pfnCompareContacts = CompareContacts;
+ Clist_GetInterface();
+ coreCli = g_CLI;
+ g_CLI.hInst = g_plugin.getInst();
+ g_CLI.pfnPaintClc = PaintClc;
+ g_CLI.pfnLoadClcOptions = LoadClcOptions;
+ g_CLI.pfnCompareContacts = CompareContacts;
CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 9ce90ca28a..fa85763130 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -114,7 +114,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
cle.flags |= CLEF_UNICODE;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
cle.pszService = "SRFile/RecvFile";
- pcli->pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
}
}
@@ -306,9 +306,9 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam)
ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type == ACKTYPE_FILE) {
int iEvent = 0;
- while (CLISTEVENT *cle = pcli->pfnGetEvent(ack->hContact, iEvent++))
+ while (CLISTEVENT *cle = g_CLI.pfnGetEvent(ack->hContact, iEvent++))
if (cle->lParam == (LPARAM)ack->hProcess)
- pcli->pfnRemoveEvent(ack->hContact, cle->hDbEvent);
+ g_CLI.pfnRemoveEvent(ack->hContact, cle->hDbEvent);
}
return 0;
}
diff --git a/src/core/stdfile/src/main.cpp b/src/core/stdfile/src/main.cpp
index 27a00db40a..b4b4146518 100644
--- a/src/core/stdfile/src/main.cpp
+++ b/src/core/stdfile/src/main.cpp
@@ -25,8 +25,6 @@ int LoadSendRecvFileModule(void);
CMPlugin g_plugin;
-CLIST_INTERFACE* pcli;
-
ITaskbarList3 * pTaskbarInterface;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -56,8 +54,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRFILE
extern "C" int __declspec(dllexport) Load(void)
{
- pcli = Clist_GetInterface();
-
if ( IsWinVer7Plus())
CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
diff --git a/src/core/stdidle/src/main.cpp b/src/core/stdidle/src/main.cpp
index 89268caadf..747808bb8e 100644
--- a/src/core/stdidle/src/main.cpp
+++ b/src/core/stdidle/src/main.cpp
@@ -25,7 +25,6 @@ int LoadIdleModule(void);
void UnloadIdleModule(void);
CMPlugin g_plugin;
-CLIST_INTERFACE* pcli;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -54,8 +53,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_IDLE,
extern "C" int __declspec(dllexport) Load(void)
{
- pcli = Clist_GetInterface();
-
LoadIdleModule();
return 0;
}
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index 9a3885baa6..26b834617e 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -75,10 +75,10 @@ static void OnCreateModule(MODULEINFO *mi)
{
OnDestroyModule(mi);
- mi->OnlineIconIndex = pcli->pfnIconFromStatusMode(mi->pszModule, ID_STATUS_ONLINE, 0);
+ mi->OnlineIconIndex = g_CLI.pfnIconFromStatusMode(mi->pszModule, ID_STATUS_ONLINE, 0);
mi->hOnlineIcon = ImageList_GetIcon(Clist_GetImageList(), mi->OnlineIconIndex, ILD_TRANSPARENT);
- mi->OfflineIconIndex = pcli->pfnIconFromStatusMode(mi->pszModule, ID_STATUS_OFFLINE, 0);
+ mi->OfflineIconIndex = g_CLI.pfnIconFromStatusMode(mi->pszModule, ID_STATUS_OFFLINE, 0);
mi->hOfflineIcon = ImageList_GetIcon(Clist_GetImageList(), mi->OfflineIconIndex, ILD_TRANSPARENT);
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index f6e101eb5f..66be4aaba6 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -104,8 +104,8 @@ void CChatRoomDlg::OnActivate()
FlashWindow(m_pOwner->GetHwnd(), FALSE);
if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
- if (pcli->pfnGetEvent(m_hContact, 0))
- pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
+ if (g_CLI.pfnGetEvent(m_hContact, 0))
+ g_CLI.pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
}
void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton)
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index e65ea3f177..5bfcb1f191 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -455,7 +455,7 @@ void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter)
int CSrmmWindow::GetImageId() const
{
- return (WORD)pcli->pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
+ return (WORD)g_CLI.pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
}
void CSrmmWindow::NotifyTyping(int mode)
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index b06bdb9b64..029d72a8e2 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -215,7 +215,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat)
if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
db_event_markRead(dat->hContact, dat->hDbEvent);
- pcli->pfnRemoveEvent(dat->hContact, dat->hDbEvent);
+ g_CLI.pfnRemoveEvent(dat->hContact, dat->hDbEvent);
}
else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
db_event_markRead(dat->hContact, dat->hDbEvent);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index c141710293..9f4532041b 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -90,7 +90,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
return 0;
- pcli->pfnRemoveEvent(hContact, 1);
+ g_CLI.pfnRemoveEvent(hContact, 1);
/* does a window for the contact exist? */
HWND hwnd = Srmm_FindWindow(hContact);
if (hwnd) {
@@ -127,7 +127,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = toolTip;
- pcli->pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
return 0;
}
@@ -200,7 +200,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
mir_snwprintf(szTip, TranslateT("%s is typing a message"), Clist_GetContactDisplayName(hContact));
if (g_dat.bShowTypingClist) {
- pcli->pfnRemoveEvent(hContact, 1);
+ g_CLI.pfnRemoveEvent(hContact, 1);
CLISTEVENT cle = {};
cle.hContact = hContact;
@@ -209,7 +209,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_TYPING);
cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = szTip;
- pcli->pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
IcoLib_ReleaseIcon(cle.hIcon);
}
@@ -304,7 +304,7 @@ static void RestoreUnreadMessageAlerts(void)
mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(e->hContact));
cle.hContact = e->hContact;
cle.hDbEvent = e->hEvent;
- pcli->pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
}
}
diff --git a/src/core/stdmsg/src/srmm.cpp b/src/core/stdmsg/src/srmm.cpp
index 2cdff71f91..d5004f291b 100644
--- a/src/core/stdmsg/src/srmm.cpp
+++ b/src/core/stdmsg/src/srmm.cpp
@@ -26,8 +26,6 @@ void SplitmsgShutdown(void);
CMPlugin g_plugin;
-CLIST_INTERFACE *pcli;
-
/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx = {
@@ -54,8 +52,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM,
extern "C" int __declspec(dllexport) Load(void)
{
- pcli = Clist_GetInterface();
-
Load_ChatModule();
return LoadSendRecvMessageModule();
}
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index b7cfae1650..8aa3608d1b 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -408,8 +408,8 @@ void CTabbedWindow::TabClicked()
if (s->wState & GC_EVENT_HIGHLIGHT) {
s->wState &= ~GC_EVENT_HIGHLIGHT;
- if (pcli->pfnGetEvent(s->hContact, 0))
- pcli->pfnRemoveEvent(s->hContact, GC_FAKE_EVENT);
+ if (g_CLI.pfnGetEvent(s->hContact, 0))
+ g_CLI.pfnRemoveEvent(s->hContact, GC_FAKE_EVENT);
}
FixTabIcons(pDlg);
diff --git a/src/core/stduseronline/src/main.cpp b/src/core/stduseronline/src/main.cpp
index 248bf8077e..4794c2dc21 100644
--- a/src/core/stduseronline/src/main.cpp
+++ b/src/core/stduseronline/src/main.cpp
@@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadUserOnlineModule(void);
CMPlugin g_plugin;
-CLIST_INTERFACE* pcli;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -53,8 +52,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_USERON
extern "C" int __declspec(dllexport) Load(void)
{
- pcli = Clist_GetInterface();
-
LoadUserOnlineModule();
return 0;
}
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp
index 163b705835..8a0980bbae 100644
--- a/src/core/stduseronline/src/useronline.cpp
+++ b/src/core/stduseronline/src/useronline.cpp
@@ -42,7 +42,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
int lastEvent = (int)db_get_dw(hContact, MODULENAME, "LastEvent", 0);
if (lastEvent) {
- pcli->pfnRemoveEvent(hContact, lastEvent);
+ g_CLI.pfnRemoveEvent(hContact, lastEvent);
db_set_dw(hContact, MODULENAME, "LastEvent", 0);
}
}
@@ -62,7 +62,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_USERONLINE, false);
cle.pszService = "UserOnline/Description";
cle.szTooltip.w = tooltip;
- pcli->pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
IcoLib_ReleaseIcon(cle.hIcon, 0);
db_set_dw(cle.hContact, MODULENAME, "LastEvent", (DWORD)cle.hDbEvent);
Skin_PlaySound(MODULENAME);
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
index 2a13dfc960..7eb89bc2b0 100644
--- a/src/mir_app/src/auth.cpp
+++ b/src/mir_app/src/auth.cpp
@@ -329,7 +329,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cle.pszService = MS_AUTH_SHOWREQUEST;
- cli.pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
}
else if (dbei.eventType == EVENTTYPE_ADDED) {
Skin_PlaySound("AddedEvent");
@@ -340,7 +340,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cle.pszService = MS_AUTH_SHOWADDED;
- cli.pfnAddEvent(&cle);
+ g_CLI.pfnAddEvent(&cle);
}
return 0;
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index b78094d782..8fac7d27f1 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -114,7 +114,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
SESSION_INFO *si = SM_FindSession(roomid, szProto);
if (si) {
- if (si->pDlg != nullptr && !cli.pfnGetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
+ if (si->pDlg != nullptr && !g_CLI.pfnGetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
si->pDlg->CloseTab();
return 1;
}
@@ -209,13 +209,13 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t*
CreateServiceFunction(cle.pszService, &EventDoubleclicked);
if (type) {
- if (!cli.pfnGetEvent(hContact, 0))
- cli.pfnAddEvent(&cle);
+ if (!g_CLI.pfnGetEvent(hContact, 0))
+ g_CLI.pfnAddEvent(&cle);
}
else {
- if (cli.pfnGetEvent(hContact, 0))
- cli.pfnRemoveEvent(hContact, GC_FAKE_EVENT);
- cli.pfnAddEvent(&cle);
+ if (g_CLI.pfnGetEvent(hContact, 0))
+ g_CLI.pfnRemoveEvent(hContact, GC_FAKE_EVENT);
+ g_CLI.pfnAddEvent(&cle);
}
return TRUE;
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 36a871e7ff..10bdf56d93 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -76,8 +76,8 @@ static SESSION_INFO* GetActiveSession(void)
static void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false)
{
- if (cli.pfnGetEvent(si->hContact, 0))
- cli.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
+ if (g_CLI.pfnGetEvent(si->hContact, 0))
+ g_CLI.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 71d0a830ea..ee89291d70 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -151,8 +151,8 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
case WM_CONTEXTMENU:
SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
if (si->hContact)
- if (cli.pfnGetEvent(si->hContact, 0))
- cli.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
+ if (g_CLI.pfnGetEvent(si->hContact, 0))
+ g_CLI.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
if (si->pDlg && KillTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND))
FlashWindow(si->pDlg->GetHwnd(), FALSE);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index a7ebcd0bb9..3eb5bebf8e 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -42,8 +42,8 @@ void FreeDisplayNameCache(void);
MIR_APP_DLL(void) Clist_InitAutoRebuild(HWND hWnd)
{
- if (!cli.bAutoRebuild && hWnd) {
- cli.bAutoRebuild = true;
+ if (!g_CLI.bAutoRebuild && hWnd) {
+ g_CLI.bAutoRebuild = true;
PostMessage(hWnd, CLM_AUTOREBUILD, 0, 0);
}
}
@@ -83,7 +83,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "MyHandle")) {
- cli.pfnInvalidateDisplayNameCacheEntry(hContact);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(hContact);
Clist_Broadcast(INTM_NAMECHANGED, hContact, lParam);
}
else if (!strcmp(cws->szSetting, "Group"))
@@ -142,7 +142,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam)
}
}
- cli.pfnCluiProtocolStatusChanged(lParam, ack->szModule);
+ g_CLI.pfnCluiProtocolStatusChanged(lParam, ack->szModule);
if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
// if we're going offline, kill all contacts scheduled for deletion
@@ -239,7 +239,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
ClcData *dat = (ClcData *)GetWindowLongPtr(hwnd, 0);
if (uMsg >= CLM_FIRST && uMsg < CLM_LAST)
- return cli.pfnProcessExternalMessages(hwnd, dat, uMsg, wParam, lParam);
+ return g_CLI.pfnProcessExternalMessages(hwnd, dat, uMsg, wParam, lParam);
switch (uMsg) {
case WM_CREATE:
@@ -264,11 +264,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
dat->infoTipTimeout = db_get_w(0, "CLC", "InfoTipHoverTime", 750);
dat->extraColumnSpacing = 20;
dat->bNeedsResort = true;
- cli.pfnLoadClcOptions(hwnd, dat, TRUE);
+ g_CLI.pfnLoadClcOptions(hwnd, dat, TRUE);
if (!IsWindowVisible(hwnd))
SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, nullptr);
else {
- cli.pfnRebuildEntireList(hwnd, dat);
+ g_CLI.pfnRebuildEntireList(hwnd, dat);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_LISTREBUILT;
nm.hdr.hwndFrom = hwnd;
@@ -282,24 +282,24 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (dat->bNoVScrollbar)
ShowScrollBar(hwnd, SB_VERT, FALSE);
else
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
}
break;
case INTM_RELOADOPTIONS:
- cli.pfnLoadClcOptions(hwnd, dat, FALSE);
+ g_CLI.pfnLoadClcOptions(hwnd, dat, FALSE);
Clist_SaveStateAndRebuildList(hwnd, dat);
break;
case WM_THEMECHANGED:
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_SIZE:
Clist_EndRename(dat, 1);
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
{
// creating imagelist containing blue line for highlight
RECT rc;
@@ -362,7 +362,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
KillTimer(hwnd, TIMERID_RENAME);
case WM_SETFOCUS:
case WM_ENABLE:
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_GETFONT:
@@ -412,7 +412,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
case INTM_CONTACTADDED:
- cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
+ g_CLI.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
Clist_NotifyNewContact(hwnd, wParam);
SortClcByTimer(hwnd);
break;
@@ -430,7 +430,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0) {
if (Clist_FindItem(hwnd, dat, wParam, nullptr, nullptr, nullptr))
break;
- cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
+ g_CLI.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
Clist_NotifyNewContact(hwnd, wParam);
}
else Clist_DeleteItemFromTree(hwnd, wParam);
@@ -453,7 +453,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
Clist_DeleteItemFromTree(hwnd, wParam);
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0)) {
NMCLISTCONTROL nm;
- cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
+ g_CLI.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
@@ -492,9 +492,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
group = nullptr;
if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr)) {
if (shouldShow && db_is_contact(wParam)) {
- if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
+ if (dat->selection >= 0 && g_CLI.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
- cli.pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0);
+ g_CLI.pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0);
Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr);
if (contact) {
contact->iImage = (WORD)lParam;
@@ -507,7 +507,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (contact->iImage == (WORD)lParam)
break;
if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
+ if (dat->selection >= 0 && g_CLI.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
Clist_RemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
}
@@ -523,7 +523,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr))
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_CLI.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
}
@@ -545,7 +545,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
contact->proto = GetContactProto(wParam);
- cli.pfnInvalidateDisplayNameCacheEntry(wParam);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(wParam);
mir_wstrncpy(contact->szText, Clist_GetContactDisplayName(wParam), _countof(contact->szText));
SortClcByTimer(hwnd);
break;
@@ -560,12 +560,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
contact->flags &= ~CONTACTF_NOTONLIST;
else
contact->flags |= CONTACTF_NOTONLIST;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
case INTM_INVALIDATE:
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case INTM_APPARENTMODECHANGED:
@@ -582,7 +582,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
contact->flags |= CONTACTF_VISTO;
else if (apparentMode)
contact->flags |= CONTACTF_VISTO | CONTACTF_INVISTO;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
@@ -599,12 +599,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (db_get_dw(wParam, szProto, "IdleTS", 0))
contact->flags |= CONTACTF_IDLE;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
case WM_PRINTCLIENT:
- cli.pfnPaintClc(hwnd, dat, (HDC)wParam, nullptr);
+ g_CLI.pfnPaintClc(hwnd, dat, (HDC)wParam, nullptr);
break;
case WM_NCPAINT:
@@ -625,11 +625,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
- /* we get so many cli.pfnInvalidateRect()'s that there is no point painting,
+ /* we get so many g_CLI.pfnInvalidateRect()'s that there is no point painting,
Windows in theory shouldn't queue up WM_PAINTs in this case but it does so
we'll just ignore them */
if (IsWindowVisible(hwnd))
- cli.pfnPaintClc(hwnd, dat, hdc, &ps.rcPaint);
+ g_CLI.pfnPaintClc(hwnd, dat, hdc, &ps.rcPaint);
EndPaint(hwnd, &ps);
}
break;
@@ -654,7 +654,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case SB_THUMBTRACK: desty = HIWORD(wParam); noSmooth = 1; break; //noone has more than 4000 contacts, right?
default: return 0;
}
- cli.pfnScrollTo(hwnd, dat, desty, noSmooth);
+ g_CLI.pfnScrollTo(hwnd, dat, desty, noSmooth);
}
break;
@@ -667,7 +667,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
UINT scrollLines;
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
scrollLines = 3;
- cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short)HIWORD(wParam) * dat->rowHeight * (signed)scrollLines / WHEEL_DELTA, 0);
+ g_CLI.pfnScrollTo(hwnd, dat, dat->yScroll - (short)HIWORD(wParam) * dat->rowHeight * (signed)scrollLines / WHEEL_DELTA, 0);
return 0;
case WM_KEYDOWN:
@@ -686,7 +686,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case VK_PRIOR: dat->selection -= pageSize; selMoved = 1; break;
case VK_NEXT: dat->selection += pageSize; selMoved = 1; break;
case VK_HOME: dat->selection = 0; selMoved = 1; break;
- case VK_END: dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break;
+ case VK_END: dat->selection = g_CLI.pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break;
case VK_LEFT: changeGroupExpand = 1; break;
case VK_RIGHT: changeGroupExpand = 2; break;
@@ -694,7 +694,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
Clist_DoSelectionDefaultAction(hwnd, dat);
return 0;
- case VK_F2: cli.pfnBeginRenameSelection(hwnd, dat); return 0;
+ case VK_F2: g_CLI.pfnBeginRenameSelection(hwnd, dat); return 0;
case VK_DELETE: Clist_DeleteFromContactList(hwnd, dat); return 0;
default:
@@ -710,30 +710,30 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (changeGroupExpand) {
if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
- hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
+ hit = g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
if (hit == -1)
return 0;
if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) {
if (group == &dat->list)
return 0;
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, -1);
+ dat->selection = g_CLI.pfnGetRowsPriorTo(&dat->list, group, -1);
selMoved = 1;
}
else {
if (contact->type == CLCIT_GROUP)
- cli.pfnSetGroupExpand(hwnd, dat, contact->group, changeGroupExpand == 2);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, contact->group, changeGroupExpand == 2);
return 0;
}
}
if (selMoved) {
if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
- if (dat->selection >= cli.pfnGetGroupContentsCount(&dat->list, 1))
- dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1;
+ if (dat->selection >= g_CLI.pfnGetGroupContentsCount(&dat->list, 1))
+ dat->selection = g_CLI.pfnGetGroupContentsCount(&dat->list, 1) - 1;
if (dat->selection < 0)
dat->selection = 0;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
return 0;
@@ -753,13 +753,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) {
NMCLISTCONTROL nm;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
break;
if (contact->type != CLCIT_CONTACT)
break;
contact->flags ^= CONTACTF_CHECKED;
Clist_RecalculateGroupCheckboxes(dat);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
nm.hdr.code = CLN_CHECKCHANGED;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -783,7 +783,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (dat->szQuickSearch[0]) {
int index;
- index = cli.pfnFindRowByText(hwnd, dat, dat->szQuickSearch, 1);
+ index = g_CLI.pfnFindRowByText(hwnd, dat, dat->szQuickSearch, 1);
if (index != -1)
dat->selection = index;
else {
@@ -791,11 +791,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
Clist_SaveStateAndRebuildList(hwnd, dat);
}
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
}
else
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_SYSKEYDOWN:
@@ -804,7 +804,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
dat->iHotTrack = -1;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
ReleaseCapture();
if (wParam == VK_F10 && GetKeyState(VK_SHIFT) & 0x8000)
break;
@@ -814,11 +814,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case WM_TIMER:
switch (wParam) {
case TIMERID_RENAME:
- cli.pfnBeginRenameSelection(hwnd, dat);
+ g_CLI.pfnBeginRenameSelection(hwnd, dat);
break;
case TIMERID_DRAGAUTOSCROLL:
- cli.pfnScrollTo(hwnd, dat, dat->yScroll + dat->dragAutoScrolling * dat->rowHeight * 2, 0);
+ g_CLI.pfnScrollTo(hwnd, dat, dat->yScroll + dat->dragAutoScrolling * dat->rowHeight * 2, 0);
break;
case TIMERID_INFOTIP:
@@ -836,7 +836,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
it.rcItem.left = 0;
it.rcItem.right = clRect.right;
- hit = cli.pfnHitTest(hwnd, dat, it.ptCursor.x, it.ptCursor.y, &contact, nullptr, nullptr);
+ hit = g_CLI.pfnHitTest(hwnd, dat, it.ptCursor.x, it.ptCursor.y, &contact, nullptr, nullptr);
if (hit == -1)
break;
if (contact->type != CLCIT_GROUP && contact->type != CLCIT_CONTACT)
@@ -847,8 +847,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
POINT ptClientOffset = { 0 };
ClientToScreen(hwnd, &ptClientOffset);
it.isTreeFocused = GetFocus() == hwnd;
- it.rcItem.top = cli.pfnGetRowTopY(dat, hit) - dat->yScroll;
- it.rcItem.bottom = it.rcItem.top + cli.pfnGetRowHeight(dat, hit);
+ it.rcItem.top = g_CLI.pfnGetRowTopY(dat, hit) - dat->yScroll;
+ it.rcItem.bottom = it.rcItem.top + g_CLI.pfnGetRowHeight(dat, hit);
OffsetRect(&it.rcItem, ptClientOffset.x, ptClientOffset.y);
it.isGroup = contact->type == CLCIT_GROUP;
it.hItem = (contact->type == CLCIT_GROUP) ? (HANDLE)contact->groupId : (HANDLE)contact->hContact;
@@ -860,16 +860,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case TIMERID_REBUILDAFTER:
KillTimer(hwnd, TIMERID_REBUILDAFTER);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
Clist_SaveStateAndRebuildList(hwnd, dat);
- cli.bAutoRebuild = false;
+ g_CLI.bAutoRebuild = false;
break;
case TIMERID_DELAYEDRESORTCLC:
KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
- cli.pfnSortCLC(hwnd, dat, 1);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnSortCLC(hwnd, dat, 1);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
break;
}
break;
@@ -888,7 +888,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (!dat->bFilterSearch)
dat->szQuickSearch[0] = 0;
- hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, &group, &hitFlags);
+ hit = g_CLI.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, &group, &hitFlags);
if (hit != -1) {
if (hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) {
SetCapture(hwnd);
@@ -903,15 +903,15 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (hitFlags & CLCHT_ONITEMICON) {
ClcGroup *selgroup;
ClcContact *selcontact;
- dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, &selgroup);
- cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
+ dat->selection = g_CLI.pfnGetRowByIndex(dat, dat->selection, &selcontact, &selgroup);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
if (dat->selection != -1) {
dat->selection =
- cli.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ g_CLI.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
if (dat->selection == -1)
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, contact->group, -1);
+ dat->selection = g_CLI.pfnGetRowsPriorTo(&dat->list, contact->group, -1);
}
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
UpdateWindow(hwnd);
break;
}
@@ -922,7 +922,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (contact->type == CLCIT_GROUP)
Clist_SetGroupChildCheckboxes(contact->group, contact->flags & CONTACTF_CHECKED);
Clist_RecalculateGroupCheckboxes(dat);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
nm.hdr.code = CLN_CHECKCHANGED;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -947,7 +947,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (hitFlags & (CLCHT_ONITEMCHECK | CLCHT_ONITEMEXTRA))
break;
dat->selection = hit;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
Clist_EnsureVisible(hwnd, dat, hit, 0);
UpdateWindow(hwnd);
@@ -966,7 +966,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
if (GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000)
break;
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
+ dat->iHotTrack = g_CLI.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
if (iOldHotTrack != dat->iHotTrack) {
if (iOldHotTrack == -1)
SetCapture(hwnd);
@@ -1000,14 +1000,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
pt.y = (short)HIWORD(lParam);
HCURSOR hNewCursor = LoadCursor(nullptr, IDC_NO);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->dragAutoScrolling) {
KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL);
dat->dragAutoScrolling = 0;
}
int target = GetDropTargetInformation(hwnd, dat, pt);
if (dat->dragStage & DRAGSTAGEF_OUTSIDE && target != DROPTARGET_OUTSIDE) {
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DRAGSTOP;
@@ -1024,10 +1024,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case DROPTARGET_ONCONTACT:
break;
case DROPTARGET_ONGROUP:
- hNewCursor = LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
+ hNewCursor = LoadCursor(g_CLI.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
break;
case DROPTARGET_INSERTION:
- hNewCursor = LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
+ hNewCursor = LoadCursor(g_CLI.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
break;
case DROPTARGET_OUTSIDE:
if (pt.x >= 0 && pt.x < clRect.right
@@ -1044,7 +1044,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
}
dat->dragStage |= DRAGSTAGEF_OUTSIDE;
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DRAGGING;
@@ -1058,9 +1058,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
default:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, nullptr, &group);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, nullptr, &group);
if (group->parent)
- hNewCursor = LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
+ hNewCursor = LoadCursor(g_CLI.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
break;
}
SetCursor(hNewCursor);
@@ -1073,7 +1073,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
SetCursor((HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR));
if (dat->exStyle & CLS_EX_TRACKSELECT) {
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
+ dat->iHotTrack = g_CLI.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
if (dat->iHotTrack == -1)
ReleaseCapture();
}
@@ -1092,8 +1092,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case DROPTARGET_ONGROUP:
{
ClcContact *contactn, *contacto;
- cli.pfnGetRowByIndex(dat, dat->selection, &contactn, nullptr);
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->selection, &contactn, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, nullptr);
if (contacto->type == CLCIT_CONTACT) //dropee is a contact
Clist_ContactChangeGroup(contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
@@ -1105,11 +1105,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
break;
case DROPTARGET_INSERTION:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
{
ClcContact *destcontact;
ClcGroup *destgroup;
- if (cli.pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup) == -1 || destgroup != contact->group->parent)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup) == -1 || destgroup != contact->group->parent)
Clist_GroupMoveBefore(contact->groupId, 0);
else {
if (destcontact->type == CLCIT_GROUP)
@@ -1119,7 +1119,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
}
break;
case DROPTARGET_OUTSIDE:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
{
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DROPPED;
@@ -1132,7 +1132,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
}
break;
default:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group);
if (!group->parent)
break;
if (contact->type == CLCIT_GROUP) { //dropee is a group
@@ -1145,7 +1145,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
}
}
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
dat->iDragItem = -1;
dat->iInsertionMark = -1;
break;
@@ -1157,8 +1157,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
KillTimer(hwnd, TIMERID_RENAME);
KillTimer(hwnd, TIMERID_INFOTIP);
- dat->selection = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ dat->selection = g_CLI.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
@@ -1181,18 +1181,18 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1 && pt.y == -1) {
- dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
+ dat->selection = g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
if (dat->selection != -1)
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
pt.x = dat->iconXSpace + 15;
- pt.y = cli.pfnGetRowTopY(dat, dat->selection) - dat->yScroll + (int)(cli.pfnGetRowHeight(dat, dat->selection) * .7);
+ pt.y = g_CLI.pfnGetRowTopY(dat, dat->selection) - dat->yScroll + (int)(g_CLI.pfnGetRowHeight(dat, dat->selection) * .7);
hitFlags = (dat->selection == -1) ? CLCHT_NOWHERE : CLCHT_ONITEMLABEL;
}
else {
ScreenToClient(hwnd, &pt);
- dat->selection = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, nullptr, &hitFlags);
+ dat->selection = g_CLI.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, nullptr, &hitFlags);
}
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
@@ -1222,7 +1222,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
return Menu_DrawItem(lParam);
case WM_COMMAND:
- hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
+ hit = g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
if (hit == -1)
break;
@@ -1238,7 +1238,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
Clist_GroupCreate(contact->groupId, nullptr);
break;
case POPUP_RENAMEGROUP:
- cli.pfnBeginRenameSelection(hwnd, dat);
+ g_CLI.pfnBeginRenameSelection(hwnd, dat);
break;
case POPUP_DELETEGROUP:
Clist_GroupDelete(contact->groupId);
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp
index 1065de73de..572bdf1305 100644
--- a/src/mir_app/src/clcfiledrop.cpp
+++ b/src/mir_app/src/clcfiledrop.cpp
@@ -74,7 +74,7 @@ static MCONTACT HContactFromPoint(HWND hwnd, ClcData *dat, int x, int y, int *hi
{
DWORD hitFlags;
ClcContact *contact;
- int hit = cli.pfnHitTest(hwnd, dat, x, y, &contact, nullptr, &hitFlags);
+ int hit = g_CLI.pfnHitTest(hwnd, dat, x, y, &contact, nullptr, &hitFlags);
if (hit == -1 || !(hitFlags & (CLCHT_ONITEMLABEL | CLCHT_ONITEMICON)) || contact->type != CLCIT_CONTACT)
return 0;
@@ -107,7 +107,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec
*pdwEffect = DROPEFFECT_NONE;
return S_OK;
}
- cli.pfnTrayIconPauseAutoHide(0, 0);
+ g_CLI.pfnTrayIconPauseAutoHide(0, 0);
ClcData *dat = (ClcData*)GetWindowLongPtr(hwndCurrentDrag, 0);
shortPt.x = pt.x;
shortPt.y = pt.y;
@@ -116,7 +116,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec
if (shortPt.y < dat->dragAutoScrollHeight || shortPt.y >= clRect.bottom - dat->dragAutoScrollHeight) {
*pdwEffect |= DROPEFFECT_SCROLL;
- cli.pfnScrollTo(hwndCurrentDrag, dat, dat->yScroll + (shortPt.y < dat->dragAutoScrollHeight ? -1 : 1) * dat->rowHeight * 2, 0);
+ g_CLI.pfnScrollTo(hwndCurrentDrag, dat, dat->yScroll + (shortPt.y < dat->dragAutoScrollHeight ? -1 : 1) * dat->rowHeight * 2, 0);
}
hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, &hit);
if (hContact == 0) {
@@ -128,7 +128,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec
if (dat->selection != hit) {
dat->selection = hit;
- cli.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
if (pDropTargetHelper) pDropTargetHelper->Show(FALSE);
UpdateWindow(hwndCurrentDrag);
if (pDropTargetHelper) pDropTargetHelper->Show(TRUE);
@@ -166,7 +166,7 @@ HRESULT CDropTarget::DragLeave(void)
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
dat->bShowSelAlways = false;
dat->selection = originalSelection;
- cli.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
}
hwndCurrentDrag = nullptr;
return S_OK;
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp
index 0a56e15131..e624598861 100644
--- a/src/mir_app/src/clcidents.cpp
+++ b/src/mir_app/src/clcidents.cpp
@@ -112,13 +112,13 @@ MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcConta
index++;
ClcContact *cc = group->cl[group->scanIndex];
- ClcContact *res = cli.pfnFindItem(dwItem, cc);
+ ClcContact *res = g_CLI.pfnFindItem(dwItem, cc);
if (res != nullptr) {
if (isVisible) {
if (!nowVisible)
*isVisible = 0;
else {
- int posY = cli.pfnGetRowTopY(dat, index+1);
+ int posY = g_CLI.pfnGetRowTopY(dat, index+1);
if (posY < dat->yScroll)
*isVisible = 0;
else {
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index ad290a31eb..2d11498bb0 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ClcContact* fnAddItemToGroup(ClcGroup *group, int iAboveItem)
{
- ClcContact* newItem = cli.pfnCreateClcContact();
+ ClcContact* newItem = g_CLI.pfnCreateClcContact();
newItem->type = CLCIT_DIVIDER;
newItem->flags = 0;
newItem->szText[0] = '\0';
@@ -85,7 +85,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags
if (groupId == 0)
return nullptr;
- ClcContact *cc = cli.pfnAddItemToGroup(group, i);
+ ClcContact *cc = g_CLI.pfnAddItemToGroup(group, i);
cc->type = CLCIT_GROUP;
mir_wstrncpy(cc->szText, pThisField, _countof(cc->szText));
cc->groupId = (WORD)(pNextField ? 0 : groupId);
@@ -130,7 +130,7 @@ void FreeGroup(ClcGroup *group)
return;
for (auto &it : group->cl) {
- cli.pfnFreeContact(it);
+ g_CLI.pfnFreeContact(it);
mir_free(it);
}
group->cl.destroy();
@@ -153,7 +153,7 @@ ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const wchar_t *pszT
if (group->cl[i]->type != CLCIT_INFO)
break;
- ClcContact *cc = cli.pfnAddItemToGroup(group, i);
+ ClcContact *cc = g_CLI.pfnAddItemToGroup(group, i);
iInfoItemUniqueHandle = LOWORD(iInfoItemUniqueHandle + 1);
if (iInfoItemUniqueHandle == 0)
++iInfoItemUniqueHandle;
@@ -184,7 +184,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact
ClcCacheEntry *pce = Clist_GetCacheEntry(hContact);
replaceStrW(pce->tszGroup, nullptr);
- ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1);
+ ClcContact *cc = g_CLI.pfnAddItemToGroup(group, index + 1);
cc->type = CLCIT_CONTACT;
cc->iImage = Clist_GetContactIcon(hContact);
cc->hContact = hContact;
@@ -228,7 +228,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
if (tszGroup == nullptr)
group = &dat->list;
else {
- group = cli.pfnAddGroup(hwnd, dat, tszGroup, (DWORD)-1, 0, 0);
+ group = g_CLI.pfnAddGroup(hwnd, dat, tszGroup, (DWORD)-1, 0, 0);
if (group == nullptr) {
if (!(style & CLS_HIDEEMPTYGROUPS))
return;
@@ -255,9 +255,9 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
size_t len = mir_wstrlen(szGroupName);
if (!wcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\')
- cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
+ g_CLI.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
- group = cli.pfnAddGroup(hwnd, dat, tszGroup, groupFlags, i, 1);
+ group = g_CLI.pfnAddGroup(hwnd, dat, tszGroup, groupFlags, i, 1);
}
}
@@ -268,7 +268,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
return;
}
}
- cli.pfnAddContactToGroup(dat, group, hContact);
+ g_CLI.pfnAddContactToGroup(dat, group, hContact);
if (updateTotalCount)
group->totalMembers++;
}
@@ -283,10 +283,10 @@ MIR_APP_DLL(ClcGroup*) Clist_RemoveItemFromGroup(HWND hwnd, ClcGroup *group, Clc
if (updateTotalCount)
group->totalMembers--;
- cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
}
- cli.pfnFreeContact(group->cl[iContact]);
+ g_CLI.pfnFreeContact(group->cl[iContact]);
mir_free(group->cl[iContact]);
group->cl.remove(iContact);
@@ -356,11 +356,11 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == nullptr)
break;
- cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
+ g_CLI.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
}
for (auto &hContact : Contacts()) {
- int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, nullptr, dat);
+ int nHiddenStatus = g_CLI.pfnGetContactHiddenStatus(hContact, nullptr, dat);
if (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus) {
ClcCacheEntry *pce = Clist_GetCacheEntry(hContact);
if (pce->szProto == nullptr)
@@ -371,7 +371,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
if (tszGroupName == nullptr)
group = &dat->list;
else {
- group = cli.pfnAddGroup(hwnd, dat, tszGroupName, (DWORD)-1, 0, 0);
+ group = g_CLI.pfnAddGroup(hwnd, dat, tszGroupName, (DWORD)-1, 0, 0);
if (group == nullptr && style & CLS_SHOWHIDDEN)
group = &dat->list;
}
@@ -385,18 +385,18 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch));
if (wcsstr(lowered_name, lowered_search))
- cli.pfnAddContactToGroup(dat, group, hContact);
+ g_CLI.pfnAddContactToGroup(dat, group, hContact);
}
else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
char *szProto = GetContactProto(hContact);
if (szProto == nullptr) {
- if (!Clist_IsHiddenMode(dat, ID_STATUS_OFFLINE) || cli.pfnIsVisibleContact(pce, group))
- cli.pfnAddContactToGroup(dat, group, hContact);
+ if (!Clist_IsHiddenMode(dat, ID_STATUS_OFFLINE) || g_CLI.pfnIsVisibleContact(pce, group))
+ g_CLI.pfnAddContactToGroup(dat, group, hContact);
}
- else if (!Clist_IsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) || cli.pfnIsVisibleContact(pce, group))
- cli.pfnAddContactToGroup(dat, group, hContact);
+ else if (!Clist_IsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) || g_CLI.pfnIsVisibleContact(pce, group))
+ g_CLI.pfnAddContactToGroup(dat, group, hContact);
}
- else cli.pfnAddContactToGroup(dat, group, hContact);
+ else g_CLI.pfnAddContactToGroup(dat, group, hContact);
}
}
}
@@ -427,7 +427,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
}
}
- cli.pfnSortCLC(hwnd, dat, 0);
+ g_CLI.pfnSortCLC(hwnd, dat, 0);
ExtraIcon_SetAll();
}
@@ -469,7 +469,7 @@ static int __cdecl ContactSortProc(const void* p1, const void* p2)
{
ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
- int result = cli.pfnCompareContacts(contact1[0], contact2[0]);
+ int result = g_CLI.pfnCompareContacts(contact1[0], contact2[0]);
if (result)
return result;
//nothing to distinguish them, so make sure they stay in the same order
@@ -540,7 +540,7 @@ static void SortGroup(ClcData *dat, ClcGroup *group, int useInsertionSort)
prevContactOnline = 1;
else {
if (prevContactOnline) {
- ClcContact *cc = cli.pfnAddItemToGroup(group, i);
+ ClcContact *cc = g_CLI.pfnAddItemToGroup(group, i);
cc->type = CLCIT_DIVIDER;
mir_wstrcpy(cc->szText, TranslateT("Offline"));
}
@@ -557,7 +557,7 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
if (dat->bNeedsResort) {
MCONTACT hSelItem;
ClcContact *selcontact;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) == -1)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) == -1)
hSelItem = 0;
else
hSelItem = Clist_ContactToHItem(selcontact);
@@ -584,13 +584,13 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr))
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_CLI.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
}
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
}
dat->bNeedsResort = false;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
struct SavedContactState_t
@@ -663,7 +663,7 @@ MIR_APP_DLL(void) Clist_SaveStateAndRebuildList(HWND hwnd, ClcData *dat)
}
FreeGroup(&dat->list);
- cli.pfnRebuildEntireList(hwnd, dat);
+ g_CLI.pfnRebuildEntireList(hwnd, dat);
group = &dat->list;
group->scanIndex = 0;
@@ -709,14 +709,14 @@ MIR_APP_DLL(void) Clist_SaveStateAndRebuildList(HWND hwnd, ClcData *dat)
group = contact->group;
}
- ClcContact *cc = cli.pfnAddInfoItemToGroup(group, it->contact.flags, L"");
+ ClcContact *cc = g_CLI.pfnAddInfoItemToGroup(group, it->contact.flags, L"");
*cc = it->contact;
}
dat->bLockScrollbar = false;
Clist_RecalculateGroupCheckboxes(dat);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_LISTREBUILT;
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp
index c8b9f0a493..427f352e10 100644
--- a/src/mir_app/src/clcmsgs.cpp
+++ b/src/mir_app/src/clcmsgs.cpp
@@ -35,9 +35,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
switch (msg) {
case CLM_ADDCONTACT:
- cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 0);
- cli.pfnRecalcScrollBar(hwnd, dat);
- cli.pfnSortCLC(hwnd, dat, 1);
+ g_CLI.pfnAddContactToTree(hwnd, dat, wParam, 1, 0);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnSortCLC(hwnd, dat, 1);
break;
case CLM_ADDGROUP:
@@ -46,8 +46,8 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
wchar_t *szName = Clist_GroupGetName(wParam, &groupFlags);
if (szName == nullptr)
break;
- cli.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
}
break;
@@ -68,11 +68,11 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
ClcContact *cc;
if (msg == CLM_ADDINFOITEMA) {
WCHAR* wszText = mir_a2u((char*)cii->pszText);
- cc = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
+ cc = g_CLI.pfnAddInfoItemToGroup(group, cii->flags, wszText);
mir_free(wszText);
}
- else cc = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ else cc = g_CLI.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
return (LRESULT)cc->hContact | HCONTACT_ISINFO;
}
@@ -82,13 +82,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_DELETEITEM:
Clist_DeleteItemFromTree(hwnd, wParam);
- cli.pfnSortCLC(hwnd, dat, 1);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnSortCLC(hwnd, dat, 1);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
break;
case CLM_EDITLABEL:
SendMessage(hwnd, CLM_SELECTITEM, wParam, 0);
- cli.pfnBeginRenameSelection(hwnd, dat);
+ g_CLI.pfnBeginRenameSelection(hwnd, dat);
break;
case CLM_ENDEDITLABELNOW:
@@ -100,14 +100,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
break;
for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
- cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
- Clist_EnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact)), 0);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
+ Clist_EnsureVisible(hwnd, dat, g_CLI.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact)), 0);
break;
case CLM_EXPAND:
if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
if (contact->type == CLCIT_GROUP)
- cli.pfnSetGroupExpand(hwnd, dat, contact->group, lParam);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, contact->group, lParam);
break;
case CLM_FINDCONTACT:
@@ -129,7 +129,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
return (contact->flags & CONTACTF_CHECKED) != 0;
case CLM_GETCOUNT:
- return cli.pfnGetGroupContentsCount(&dat->list, 0);
+ return g_CLI.pfnGetGroupContentsCount(&dat->list, 0);
case CLM_GETEDITCONTROL:
return (LRESULT)dat->hwndRenameEdit;
@@ -143,7 +143,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_SETEXTRASPACE:
dat->extraColumnSpacing = (int)wParam;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
return 0;
case CLM_GETEXTRACOLUMNS:
@@ -274,7 +274,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
return dat->scrollTime;
case CLM_GETSELECTION:
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
return 0;
return Clist_ContactToHItem(contact);
@@ -286,7 +286,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_HITTEST:
DWORD hitFlags;
{
- int hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
+ int hit = g_CLI.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
if (wParam)
*(PDWORD)wParam = hitFlags;
if (hit == -1)
@@ -299,8 +299,8 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
break;
for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
- cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
- dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
+ g_CLI.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
+ dat->selection = g_CLI.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
break;
@@ -312,7 +312,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
dat->hBmpBackground = (HBITMAP)lParam;
dat->backgroundBmpUse = wParam;
dat->bkChanged = 1;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETBKCOLOR:
@@ -322,7 +322,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
}
dat->bkColour = wParam;
dat->bkChanged = 1;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETCHECKMARK:
@@ -333,7 +333,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
else
contact->flags &= ~CONTACTF_CHECKED;
Clist_RecalculateGroupCheckboxes(dat);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETEXTRACOLUMNS:
@@ -341,7 +341,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
return 0;
dat->extraColumnsCount = wParam;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETEXTRAIMAGE:
@@ -350,14 +350,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, &bVisible)) {
contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
if (bVisible)
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
}
break;
case CLM_SETEXTRAIMAGELIST:
dat->himlExtraColumns = (HIMAGELIST)lParam;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETFONT:
@@ -377,7 +377,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
ReleaseDC(hwnd, hdc);
}
if (LOWORD(lParam))
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETGREYOUTFLAGS:
@@ -406,13 +406,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
mir_wstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
- cli.pfnSortCLC(hwnd, dat, 1);
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnSortCLC(hwnd, dat, 1);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETLEFTMARGIN:
dat->leftMargin = wParam;
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETOFFLINEMODES:
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index c8ce0a8b68..00e920c3aa 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -115,9 +115,9 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac
*flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE;
return -1;
}
- int hit = cli.pfnRowHitTest(dat, dat->yScroll + testy);
+ int hit = g_CLI.pfnRowHitTest(dat, dat->yScroll + testy);
if (hit != -1)
- hit = cli.pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
+ hit = g_CLI.pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
if (hit == -1) {
if (flags)
*flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
@@ -205,7 +205,7 @@ void fnScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth)
RECT clRect;
GetClientRect(hwnd, &clRect);
- int maxy = cli.pfnGetRowTotalHeight(dat) - clRect.bottom;
+ int maxy = g_CLI.pfnGetRowTotalHeight(dat) - clRect.bottom;
if (desty > maxy)
desty = maxy;
if (desty < 0)
@@ -227,7 +227,7 @@ void fnScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth)
if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr)
ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
previousy = dat->yScroll;
SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
UpdateWindow(hwnd);
@@ -238,13 +238,13 @@ void fnScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth)
if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr)
ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
}
MIR_APP_DLL(void) Clist_EnsureVisible(HWND hwnd, ClcData *dat, int iItem, int partialOk)
{
- int itemy = cli.pfnGetRowTopY(dat, iItem), itemh = cli.pfnGetRowHeight(dat, iItem), newY = 0;
+ int itemy = g_CLI.pfnGetRowTopY(dat, iItem), itemh = g_CLI.pfnGetRowHeight(dat, iItem), newY = 0;
int moved = 0;
RECT clRect;
@@ -270,7 +270,7 @@ MIR_APP_DLL(void) Clist_EnsureVisible(HWND hwnd, ClcData *dat, int iItem, int pa
}
}
if (moved)
- cli.pfnScrollTo(hwnd, dat, newY, 0);
+ g_CLI.pfnScrollTo(hwnd, dat, newY, 0);
}
void fnRecalcScrollBar(HWND hwnd, ClcData *dat)
@@ -285,7 +285,7 @@ void fnRecalcScrollBar(HWND hwnd, ClcData *dat)
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
si.nMin = 0;
- si.nMax = cli.pfnGetRowTotalHeight(dat)-1;
+ si.nMax = g_CLI.pfnGetRowTotalHeight(dat)-1;
si.nPage = clRect.bottom;
si.nPos = dat->yScroll;
@@ -295,7 +295,7 @@ void fnRecalcScrollBar(HWND hwnd, ClcData *dat)
}
else SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- cli.pfnScrollTo(hwnd, dat, dat->yScroll, 1);
+ g_CLI.pfnScrollTo(hwnd, dat, dat->yScroll, 1);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_LISTSIZECHANGE;
@@ -320,22 +320,22 @@ void fnSetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, int newState)
return;
group->expanded = newState != 0;
}
- cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
- contentCount = cli.pfnGetGroupContentsCount(group, 1);
- groupy = cli.pfnGetRowsPriorTo(&dat->list, group, -1);
+ g_CLI.pfnInvalidateRect(hwnd, nullptr, FALSE);
+ contentCount = g_CLI.pfnGetGroupContentsCount(group, 1);
+ groupy = g_CLI.pfnGetRowsPriorTo(&dat->list, group, -1);
if (dat->selection > groupy && dat->selection < groupy + contentCount)
dat->selection = groupy;
GetClientRect(hwnd, &clRect);
newY = dat->yScroll;
- posY = cli.pfnGetRowBottomY(dat, groupy + contentCount);
+ posY = g_CLI.pfnGetRowBottomY(dat, groupy + contentCount);
if (posY >= newY + clRect.bottom)
newY = posY - clRect.bottom;
- posY = cli.pfnGetRowTopY(dat, groupy);
+ posY = g_CLI.pfnGetRowTopY(dat, groupy);
if (newY > posY)
newY = posY;
- cli.pfnRecalcScrollBar(hwnd, dat);
+ g_CLI.pfnRecalcScrollBar(hwnd, dat);
if (group->expanded)
- cli.pfnScrollTo(hwnd, dat, newY, 0);
+ g_CLI.pfnScrollTo(hwnd, dat, newY, 0);
nm.hdr.code = CLN_EXPANDED;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -353,11 +353,11 @@ MIR_APP_DLL(void) Clist_DoSelectionDefaultAction(HWND hwnd, ClcData *dat)
dat->szQuickSearch[0] = 0;
ClcContact *contact;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
return;
if (contact->type == CLCIT_GROUP)
- cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
if (contact->type == CLCIT_CONTACT)
Clist_ContactDoubleClicked(contact->hContact);
@@ -393,8 +393,8 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
- cli.pfnSetGroupExpand(hwnd, dat, group, 1);
- return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
+ g_CLI.pfnSetGroupExpand(hwnd, dat, group, 1);
+ return g_CLI.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
}
if (cc->type == CLCIT_GROUP) {
if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || cc->group->expanded) {
@@ -421,7 +421,7 @@ MIR_APP_DLL(void) Clist_EndRename(ClcData *dat, int save)
GetWindowText(hwndEdit, text, _countof(text));
ClcContact *contact;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) != -1) {
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) != -1) {
if (mir_wstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
@@ -434,7 +434,7 @@ MIR_APP_DLL(void) Clist_EndRename(ClcData *dat, int save)
Clist_GroupRename(contact->groupId, text);
}
else if (contact->type == CLCIT_CONTACT) {
- cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
wchar_t* otherName = Clist_GetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
if (!text[0] || !mir_wstrcmp(otherName, text))
db_unset(contact->hContact, "CList", "MyHandle");
@@ -455,7 +455,7 @@ MIR_APP_DLL(void) Clist_DeleteFromContactList(HWND hwnd, ClcData *dat)
return;
dat->szQuickSearch[0] = 0;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
+ if (g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
return;
switch (contact->type) {
@@ -507,7 +507,7 @@ void fnBeginRenameSelection(HWND hwnd, ClcData *dat)
ClcGroup *group;
ClcContact *contact;
- dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
+ dat->selection = g_CLI.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
if (dat->selection == -1 || (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP))
return;
@@ -516,8 +516,8 @@ void fnBeginRenameSelection(HWND hwnd, ClcData *dat)
POINT pt;
Clist_CalcEipPosition(dat, contact, group, &pt);
- int h = cli.pfnGetRowHeight(dat, dat->selection);
- dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, nullptr, cli.hInst, nullptr);
+ int h = g_CLI.pfnGetRowHeight(dat, dat->selection);
+ dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, nullptr, g_CLI.hInst, nullptr);
mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM)(contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
@@ -531,7 +531,7 @@ MIR_APP_DLL(void) Clist_CalcEipPosition(ClcData *dat, ClcContact *, ClcGroup *gr
int indent;
for (indent = 0; group->parent; indent++, group = group->parent);
result->x = indent * dat->groupIndent + dat->iconXSpace - 2;
- result->y = cli.pfnGetRowTopY(dat, dat->selection) - dat->yScroll;
+ result->y = g_CLI.pfnGetRowTopY(dat, dat->selection) - dat->yScroll;
}
int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt)
@@ -546,8 +546,8 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt)
ClcContact *contact, *movecontact;
ClcGroup *group, *movegroup;
DWORD hitFlags;
- int hit = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &movecontact, &movegroup);
+ int hit = g_CLI.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
+ g_CLI.pfnGetRowByIndex(dat, dat->iDragItem, &movecontact, &movegroup);
if (hit == dat->iDragItem)
return DROPTARGET_ONSELF;
if (hit == -1 || movecontact == nullptr || (hitFlags & CLCHT_ONITEMEXTRA))
@@ -558,21 +558,21 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt)
ClcGroup *topgroup = nullptr;
int topItem = -1, bottomItem = -1;
int ok = 0;
- if (pt.y + dat->yScroll < cli.pfnGetRowTopY(dat, hit) + dat->insertionMarkHitHeight) {
+ if (pt.y + dat->yScroll < g_CLI.pfnGetRowTopY(dat, hit) + dat->insertionMarkHitHeight) {
//could be insertion mark (above)
topItem = hit - 1;
bottomItem = hit;
bottomcontact = contact;
- topItem = cli.pfnGetRowByIndex(dat, topItem, &topcontact, &topgroup);
+ topItem = g_CLI.pfnGetRowByIndex(dat, topItem, &topcontact, &topgroup);
ok = 1;
}
- if (pt.y + dat->yScroll >= cli.pfnGetRowBottomY(dat, hit+1) - dat->insertionMarkHitHeight) {
+ if (pt.y + dat->yScroll >= g_CLI.pfnGetRowBottomY(dat, hit+1) - dat->insertionMarkHitHeight) {
//could be insertion mark (below)
topItem = hit;
bottomItem = hit + 1;
topcontact = contact;
topgroup = group;
- bottomItem = cli.pfnGetRowByIndex(dat, bottomItem, &bottomcontact, nullptr);
+ bottomItem = g_CLI.pfnGetRowByIndex(dat, bottomItem, &bottomcontact, nullptr);
ok = 1;
}
if (ok) {
@@ -703,7 +703,7 @@ void fnGetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour)
MIR_APP_DLL(void) Clist_GetFontSetting(int i, LOGFONT *lf, COLORREF *colour)
{
- cli.pfnGetDefaultFontSetting(i, lf, colour);
+ g_CLI.pfnGetDefaultFontSetting(i, lf, colour);
char idstr[20];
mir_snprintf(idstr, "Font%dName", i);
@@ -754,7 +754,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
dat->quickSearchColour = db_get_dw(0, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR);
dat->bUseWindowsColours = db_get_b(0, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) != 0;
- if (cli.hwndContactTree != nullptr && hwnd != cli.hwndContactTree) {
+ if (g_CLI.hwndContactTree != nullptr && hwnd != g_CLI.hwndContactTree) {
dat->bkChanged = true; // block custom background
dat->bkColour = GetSysColor(COLOR_WINDOW);
if (dat->hBmpBackground) {
@@ -843,10 +843,10 @@ MIR_APP_DLL(void) Clist_SetGroupChildCheckboxes(ClcGroup *group, int checked)
for (auto &cc : group->cl) {
if (cc->type == CLCIT_GROUP) {
Clist_SetGroupChildCheckboxes(cc->group, checked);
- cli.pfnSetContactCheckboxes(cc, checked);
+ g_CLI.pfnSetContactCheckboxes(cc, checked);
}
else if (cc->type == CLCIT_CONTACT)
- cli.pfnSetContactCheckboxes(cc, checked);
+ g_CLI.pfnSetContactCheckboxes(cc, checked);
}
}
@@ -857,9 +857,9 @@ MIR_APP_DLL(void) Clist_InvalidateItem(HWND hwnd, ClcData *dat, int iItem)
RECT rc;
GetClientRect(hwnd, &rc);
- rc.top = cli.pfnGetRowTopY(dat, iItem) - dat->yScroll;
- rc.bottom = rc.top + cli.pfnGetRowHeight(dat, iItem);
- cli.pfnInvalidateRect(hwnd, &rc, FALSE);
+ rc.top = g_CLI.pfnGetRowTopY(dat, iItem) - dat->yScroll;
+ rc.bottom = rc.top + g_CLI.pfnGetRowHeight(dat, iItem);
+ g_CLI.pfnInvalidateRect(hwnd, &rc, FALSE);
}
///////////////////////////////////////////////////////////////////////////////
@@ -877,7 +877,7 @@ int fnGetRowBottomY(ClcData *dat, int item)
int fnGetRowTotalHeight(ClcData *dat)
{
- return dat->rowHeight * cli.pfnGetGroupContentsCount(&dat->list, 1);
+ return dat->rowHeight * g_CLI.pfnGetGroupContentsCount(&dat->list, 1);
}
int fnGetRowHeight(ClcData *dat, int)
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp
index 7c300e574a..a6454e62f3 100644
--- a/src/mir_app/src/clistcore.cpp
+++ b/src/mir_app/src/clistcore.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int LoadContactListModule2(void);
int LoadCLCModule(void);
-CLIST_INTERFACE cli;
+MIR_APP_DLL(CLIST_INTERFACE) g_CLI;
static wchar_t szTip[MAX_TIP_SIZE+1];
@@ -58,79 +58,79 @@ static int fnIsVisibleContact(ClcCacheEntry*, ClcGroup*)
void InitClistCore()
{
- cli.menuProtos = &g_menuProtos;
+ g_CLI.menuProtos = &g_menuProtos;
- cli.pfnContactListControlWndProc = fnContactListControlWndProc;
+ g_CLI.pfnContactListControlWndProc = fnContactListControlWndProc;
- cli.pfnGetRowsPriorTo = fnGetRowsPriorTo;
- cli.pfnFindItem = fnFindItem;
- cli.pfnGetRowByIndex = fnGetRowByIndex;
- cli.pfnGetContactHiddenStatus = fnGetContactHiddenStatus;
+ g_CLI.pfnGetRowsPriorTo = fnGetRowsPriorTo;
+ g_CLI.pfnFindItem = fnFindItem;
+ g_CLI.pfnGetRowByIndex = fnGetRowByIndex;
+ g_CLI.pfnGetContactHiddenStatus = fnGetContactHiddenStatus;
- cli.pfnAddGroup = fnAddGroup;
- cli.pfnAddItemToGroup = fnAddItemToGroup;
- cli.pfnCreateClcContact = fnCreateClcContact;
+ g_CLI.pfnAddGroup = fnAddGroup;
+ g_CLI.pfnAddItemToGroup = fnAddItemToGroup;
+ g_CLI.pfnCreateClcContact = fnCreateClcContact;
- cli.pfnFreeContact = fnFreeContact;
- cli.pfnAddInfoItemToGroup = fnAddInfoItemToGroup;
- cli.pfnAddContactToGroup = fnAddContactToGroup;
- cli.pfnAddContactToTree = fnAddContactToTree;
- cli.pfnRebuildEntireList = fnRebuildEntireList;
- cli.pfnGetGroupContentsCount = fnGetGroupContentsCount;
- cli.pfnSortCLC = fnSortCLC;
-
- cli.pfnProcessExternalMessages = fnProcessExternalMessages;
-
- cli.pfnPaintClc = fnPaintClc;
-
- cli.pfnHitTest = fnHitTest;
- cli.pfnScrollTo = fnScrollTo;
- cli.pfnRecalcScrollBar = fnRecalcScrollBar;
- cli.pfnSetGroupExpand = fnSetGroupExpand;
- cli.pfnFindRowByText = fnFindRowByText;
- cli.pfnBeginRenameSelection = fnBeginRenameSelection;
- cli.pfnIsVisibleContact = fnIsVisibleContact;
- cli.pfnGetDefaultFontSetting = fnGetDefaultFontSetting;
- cli.pfnLoadClcOptions = fnLoadClcOptions;
- cli.pfnGetRowBottomY = fnGetRowBottomY;
- cli.pfnGetRowHeight = fnGetRowHeight;
- cli.pfnGetRowTopY = fnGetRowTopY;
- cli.pfnGetRowTotalHeight = fnGetRowTotalHeight;
- cli.pfnRowHitTest = fnRowHitTest;
-
- cli.pfnAddEvent = fnAddEvent;
- cli.pfnGetEvent = fnGetEvent;
- cli.pfnGetImlIconIndex = fnGetImlIconIndex;
- cli.pfnRemoveEvent = fnRemoveEvent;
-
- cli.pfnInvalidateDisplayNameCacheEntry = fnInvalidateDisplayNameCacheEntry;
- cli.pfnCreateCacheItem = fnCreateCacheItem;
- cli.pfnCheckCacheItem = fnCheckCacheItem;
- cli.pfnFreeCacheItem = fnFreeCacheItem;
-
- cli.szTip = szTip;
-
- cli.pfnTrayIconInit = fnTrayIconInit;
- cli.pfnTrayIconPauseAutoHide = fnTrayIconPauseAutoHide;
- cli.pfnTrayIconProcessMessage = fnTrayIconProcessMessage;
-
- cli.pfnContactListWndProc = fnContactListWndProc;
- cli.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts;
- cli.pfnCluiProtocolStatusChanged = fnCluiProtocolStatusChanged;
- cli.pfnInvalidateRect = fnInvalidateRect;
- cli.pfnOnCreateClc = fnOnCreateClc;
-
- cli.pfnSetHideOffline = fnSetHideOffline;
-
- cli.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage;
-
- cli.pfnGetIconFromStatusMode = fnGetIconFromStatusMode;
- cli.pfnGetWindowVisibleState = fnGetWindowVisibleState;
- cli.pfnIconFromStatusMode = fnIconFromStatusMode;
- cli.pfnShowHide = fnShowHide;
-
- cli.pfnTrayCalcChanged = fnTrayCalcChanged;
- cli.pfnSetContactCheckboxes = fnSetContactCheckboxes;
+ g_CLI.pfnFreeContact = fnFreeContact;
+ g_CLI.pfnAddInfoItemToGroup = fnAddInfoItemToGroup;
+ g_CLI.pfnAddContactToGroup = fnAddContactToGroup;
+ g_CLI.pfnAddContactToTree = fnAddContactToTree;
+ g_CLI.pfnRebuildEntireList = fnRebuildEntireList;
+ g_CLI.pfnGetGroupContentsCount = fnGetGroupContentsCount;
+ g_CLI.pfnSortCLC = fnSortCLC;
+
+ g_CLI.pfnProcessExternalMessages = fnProcessExternalMessages;
+
+ g_CLI.pfnPaintClc = fnPaintClc;
+
+ g_CLI.pfnHitTest = fnHitTest;
+ g_CLI.pfnScrollTo = fnScrollTo;
+ g_CLI.pfnRecalcScrollBar = fnRecalcScrollBar;
+ g_CLI.pfnSetGroupExpand = fnSetGroupExpand;
+ g_CLI.pfnFindRowByText = fnFindRowByText;
+ g_CLI.pfnBeginRenameSelection = fnBeginRenameSelection;
+ g_CLI.pfnIsVisibleContact = fnIsVisibleContact;
+ g_CLI.pfnGetDefaultFontSetting = fnGetDefaultFontSetting;
+ g_CLI.pfnLoadClcOptions = fnLoadClcOptions;
+ g_CLI.pfnGetRowBottomY = fnGetRowBottomY;
+ g_CLI.pfnGetRowHeight = fnGetRowHeight;
+ g_CLI.pfnGetRowTopY = fnGetRowTopY;
+ g_CLI.pfnGetRowTotalHeight = fnGetRowTotalHeight;
+ g_CLI.pfnRowHitTest = fnRowHitTest;
+
+ g_CLI.pfnAddEvent = fnAddEvent;
+ g_CLI.pfnGetEvent = fnGetEvent;
+ g_CLI.pfnGetImlIconIndex = fnGetImlIconIndex;
+ g_CLI.pfnRemoveEvent = fnRemoveEvent;
+
+ g_CLI.pfnInvalidateDisplayNameCacheEntry = fnInvalidateDisplayNameCacheEntry;
+ g_CLI.pfnCreateCacheItem = fnCreateCacheItem;
+ g_CLI.pfnCheckCacheItem = fnCheckCacheItem;
+ g_CLI.pfnFreeCacheItem = fnFreeCacheItem;
+
+ g_CLI.szTip = szTip;
+
+ g_CLI.pfnTrayIconInit = fnTrayIconInit;
+ g_CLI.pfnTrayIconPauseAutoHide = fnTrayIconPauseAutoHide;
+ g_CLI.pfnTrayIconProcessMessage = fnTrayIconProcessMessage;
+
+ g_CLI.pfnContactListWndProc = fnContactListWndProc;
+ g_CLI.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts;
+ g_CLI.pfnCluiProtocolStatusChanged = fnCluiProtocolStatusChanged;
+ g_CLI.pfnInvalidateRect = fnInvalidateRect;
+ g_CLI.pfnOnCreateClc = fnOnCreateClc;
+
+ g_CLI.pfnSetHideOffline = fnSetHideOffline;
+
+ g_CLI.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage;
+
+ g_CLI.pfnGetIconFromStatusMode = fnGetIconFromStatusMode;
+ g_CLI.pfnGetWindowVisibleState = fnGetWindowVisibleState;
+ g_CLI.pfnIconFromStatusMode = fnIconFromStatusMode;
+ g_CLI.pfnShowHide = fnShowHide;
+
+ g_CLI.pfnTrayCalcChanged = fnTrayCalcChanged;
+ g_CLI.pfnSetContactCheckboxes = fnSetContactCheckboxes;
}
MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void)
@@ -141,5 +141,5 @@ MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void)
g_bReadyToInitClist = false;
}
- return &cli;
+ return &g_CLI;
}
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp
index 192bf7b704..76e4116313 100644
--- a/src/mir_app/src/clistevents.cpp
+++ b/src/mir_app/src/clistevents.cpp
@@ -98,7 +98,7 @@ static void ShowOneEventInTray(int idx)
static void ShowEventsInTray()
{
- int nTrayCnt = cli.trayIconCount;
+ int nTrayCnt = g_CLI.trayIconCount;
if (!g_cliEvents.getCount() || !nTrayCnt)
return;
@@ -110,11 +110,11 @@ static void ShowEventsInTray()
// in case if we have several icons in tray and several events with different protocols
// lets use several icon to show events from protocols in different icons
mir_cslock lck(trayLockCS);
- char **pTrayProtos = (char**)_alloca(sizeof(char*)*cli.trayIconCount);
+ char **pTrayProtos = (char**)_alloca(sizeof(char*)*g_CLI.trayIconCount);
int nTrayProtoCnt = 0;
- for (int i = 0; i < cli.trayIconCount; i++)
- if (cli.trayIcon[i].id != 0 && cli.trayIcon[i].szProto)
- pTrayProtos[nTrayProtoCnt++] = cli.trayIcon[i].szProto;
+ for (int i = 0; i < g_CLI.trayIconCount; i++)
+ if (g_CLI.trayIcon[i].id != 0 && g_CLI.trayIcon[i].szProto)
+ pTrayProtos[nTrayProtoCnt++] = g_CLI.trayIcon[i].szProto;
for (int i = 0; i < g_cliEvents.getCount(); i++) {
char *iEventProto = GetEventProtocol(i);
@@ -147,7 +147,7 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
// decrease eflashes in any case - no need to collect all events
if (e.flags & CLEF_ONLYAFEW)
if (0 >= --e.flashesDone)
- cli.pfnRemoveEvent(e.hContact, e.hDbEvent);
+ g_CLI.pfnRemoveEvent(e.hContact, e.hDbEvent);
}
if (g_cliEvents.getCount() == 0) {
@@ -269,7 +269,7 @@ int EventsProcessContactDoubleClick(MCONTACT hContact)
if (it->hContact == hContact) {
MEVENT hDbEvent = it->hDbEvent;
CallService(it->pszService, 0, (LPARAM)it);
- cli.pfnRemoveEvent(hContact, hDbEvent);
+ g_CLI.pfnRemoveEvent(hContact, hDbEvent);
return 0;
}
}
@@ -286,11 +286,11 @@ MIR_APP_DLL(int) Clist_EventsProcessTrayDoubleClick(int index)
CListEvent *pEvent = nullptr;
{
mir_cslock lck(trayLockCS);
- if (cli.trayIconCount > 1 && index > 0) {
+ if (g_CLI.trayIconCount > 1 && index > 0) {
char *szProto = nullptr;
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == index) {
- szProto = cli.trayIcon[i].szProto;
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == index) {
+ szProto = g_CLI.trayIcon[i].szProto;
if (i == 0)
click_in_first_icon = TRUE;
break;
@@ -323,11 +323,11 @@ MIR_APP_DLL(int) Clist_EventsProcessTrayDoubleClick(int index)
continue;
int j;
- for (j = 0; j < cli.trayIconCount; j++)
- if (cli.trayIcon[j].szProto && !_strcmpi(eventProto, cli.trayIcon[j].szProto))
+ for (j = 0; j < g_CLI.trayIconCount; j++)
+ if (g_CLI.trayIcon[j].szProto && !_strcmpi(eventProto, g_CLI.trayIcon[j].szProto))
break;
- if (j == cli.trayIconCount) {
+ if (j == g_CLI.trayIconCount) {
pEvent = it;
break;
}
@@ -348,7 +348,7 @@ MIR_APP_DLL(int) Clist_EventsProcessTrayDoubleClick(int index)
MCONTACT hContact = pEvent->hContact;
MEVENT hDbEvent = pEvent->hDbEvent;
CallService(pEvent->pszService, 0, (LPARAM)pEvent);
- cli.pfnRemoveEvent(hContact, hDbEvent);
+ g_CLI.pfnRemoveEvent(hContact, hDbEvent);
return 0;
}
@@ -368,7 +368,7 @@ static int CListEventSettingsChanged(WPARAM hContact, LPARAM lParam)
int InitCListEvents(void)
{
- cli.events = &g_cliEvents;
+ g_CLI.events = &g_cliEvents;
disableTrayFlash = db_get_b(0, "CList", "DisableTrayFlash", 0);
disableIconFlash = db_get_b(0, "CList", "NoIconBlink", 0);
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp
index 1474f15630..df58d3d70f 100644
--- a/src/mir_app/src/clistgroups.cpp
+++ b/src/mir_app/src/clistgroups.cpp
@@ -186,7 +186,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
if (db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
wchar_t szQuestion[256 + 100];
mir_snwprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
- if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
+ if (MessageBox(g_CLI.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
}
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index f7e1cd7c0e..c93e0a4ae1 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -103,7 +103,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetStatusModeDescription(int mode, int flags)
HICON fnGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status)
{
- return ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL);
+ return ImageList_GetIcon(hCListImages, g_CLI.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL);
}
int fnIconFromStatusMode(const char *szProto, int status, MCONTACT)
@@ -128,7 +128,7 @@ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT)
MIR_APP_DLL(int) Clist_GetContactIcon(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- return cli.pfnIconFromStatusMode(szProto,
+ return g_CLI.pfnIconFromStatusMode(szProto,
szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
@@ -181,7 +181,7 @@ static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam)
Menu_ReloadProtoMenus();
Clist_TrayIconIconsChanged();
- cli.bAutoRebuild = true;
+ g_CLI.bAutoRebuild = true;
Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
Clist_Broadcast(INTM_INVALIDATE, 0, 0);
return 0;
@@ -229,7 +229,7 @@ static int CListIconsChanged(WPARAM, LPARAM)
}
Clist_TrayIconIconsChanged();
- cli.pfnInvalidateRect(cli.hwndContactList, nullptr, TRUE);
+ g_CLI.pfnInvalidateRect(g_CLI.hwndContactList, nullptr, TRUE);
return 0;
}
@@ -309,7 +309,7 @@ int fnShowHide()
{
BOOL bShow = FALSE;
- int iVisibleState = cli.pfnGetWindowVisibleState(cli.hwndContactList, 0, 0);
+ int iVisibleState = g_CLI.pfnGetWindowVisibleState(g_CLI.hwndContactList, 0, 0);
//bShow is FALSE when we enter the switch.
switch (iVisibleState) {
@@ -324,34 +324,34 @@ int fnShowHide()
case GWVS_VISIBLE: //This is not needed, but goes for readability.
bShow = FALSE;
break;
- case -1: //We can't get here, both cli.hwndContactList and iStepX and iStepY are right.
+ case -1: //We can't get here, both g_CLI.hwndContactList and iStepX and iStepY are right.
return 0;
}
if (bShow == TRUE) {
- ShowWindow(cli.hwndContactList, SW_RESTORE);
+ ShowWindow(g_CLI.hwndContactList, SW_RESTORE);
if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
- SetWindowPos(cli.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ SetWindowPos(g_CLI.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
else
- SetWindowPos(cli.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ SetWindowPos(g_CLI.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- SetForegroundWindow(cli.hwndContactList);
+ SetForegroundWindow(g_CLI.hwndContactList);
db_set_b(0, "CList", "State", SETTING_STATE_NORMAL);
// this forces the window onto the visible screen
RECT rcWindow;
- GetWindowRect(cli.hwndContactList, &rcWindow);
+ GetWindowRect(g_CLI.hwndContactList, &rcWindow);
if (Utils_AssertInsideScreen(&rcWindow) == 1)
- MoveWindow(cli.hwndContactList, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
+ MoveWindow(g_CLI.hwndContactList, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
else { // It needs to be hidden
if (db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ||
db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
- ShowWindow(cli.hwndContactList, SW_HIDE);
+ ShowWindow(g_CLI.hwndContactList, SW_HIDE);
db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
}
else {
- ShowWindow(cli.hwndContactList, SW_MINIMIZE);
+ ShowWindow(g_CLI.hwndContactList, SW_MINIMIZE);
db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED);
}
@@ -372,11 +372,11 @@ MIR_APP_DLL(void) Clist_ChangeContactIcon(MCONTACT hContact, int iIcon)
MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hContact2)
{
- ClcData *dat = (ClcData*)GetWindowLongPtr(cli.hwndContactTree, 0);
+ ClcData *dat = (ClcData*)GetWindowLongPtr(g_CLI.hwndContactTree, 0);
if (dat != nullptr) {
ClcContact *p1, *p2;
- if (Clist_FindItem(cli.hwndContactTree, dat, hContact1, &p1, nullptr, nullptr) && Clist_FindItem(cli.hwndContactTree, dat, hContact2, &p2, nullptr, nullptr))
- return cli.pfnCompareContacts(p1, p2);
+ if (Clist_FindItem(g_CLI.hwndContactTree, dat, hContact1, &p1, nullptr, nullptr) && Clist_FindItem(g_CLI.hwndContactTree, dat, hContact2, &p2, nullptr, nullptr))
+ return g_CLI.pfnCompareContacts(p1, p2);
}
return 0;
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp
index 0bc6ea0435..3cf2daa8a5 100644
--- a/src/mir_app/src/clistsettings.cpp
+++ b/src/mir_app/src/clistsettings.cpp
@@ -30,7 +30,7 @@ static LIST<ClcCacheEntry> clistCache(50, NumericKeySortT);
void FreeDisplayNameCache(void)
{
for (auto &it : clistCache) {
- cli.pfnFreeCacheItem(it);
+ g_CLI.pfnFreeCacheItem(it);
mir_free(it);
}
@@ -87,16 +87,16 @@ MIR_APP_DLL(ClcCacheEntry*) Clist_GetCacheEntry(MCONTACT hContact)
ClcCacheEntry *p;
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
if (idx == -1) {
- p = cli.pfnCreateCacheItem(hContact);
+ p = g_CLI.pfnCreateCacheItem(hContact);
if (p == nullptr)
return nullptr;
clistCache.insert(p);
- cli.pfnInvalidateDisplayNameCacheEntry(hContact);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(hContact);
}
else p = clistCache[idx];
- cli.pfnCheckCacheItem(p);
+ g_CLI.pfnCheckCacheItem(p);
return p;
}
@@ -104,12 +104,12 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact)
{
if (hContact == INVALID_CONTACT_ID) {
FreeDisplayNameCache();
- Clist_InitAutoRebuild(cli.hwndContactTree);
+ Clist_InitAutoRebuild(g_CLI.hwndContactTree);
}
else {
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
if (idx != -1)
- cli.pfnFreeCacheItem(clistCache[idx]);
+ g_CLI.pfnFreeCacheItem(clistCache[idx]);
}
}
@@ -142,7 +142,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode)
int ContactAdded(WPARAM hContact, LPARAM)
{
- Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), ID_STATUS_OFFLINE, 0));
+ Clist_ChangeContactIcon(hContact, g_CLI.pfnIconFromStatusMode(GetContactProto(hContact), ID_STATUS_OFFLINE, 0));
return 0;
}
@@ -152,7 +152,7 @@ int ContactDeleted(WPARAM hContact, LPARAM)
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
if (idx != -1) {
- cli.pfnFreeCacheItem(clistCache[idx]);
+ g_CLI.pfnFreeCacheItem(clistCache[idx]);
mir_free(clistCache[idx]);
clistCache.remove(idx);
}
@@ -160,7 +160,7 @@ int ContactDeleted(WPARAM hContact, LPARAM)
// remove events for a contact
for (auto &it : g_cliEvents.rev_iter())
if (it->hContact == hContact)
- cli.pfnRemoveEvent(hContact, it->hDbEvent);
+ g_CLI.pfnRemoveEvent(hContact, it->hDbEvent);
return 0;
}
@@ -203,22 +203,22 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
replaceStrW(pdnce->tszName, nullptr);
- cli.pfnCheckCacheItem(pdnce);
+ g_CLI.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Status")) {
if (!db_get_b(hContact, "CList", "Hidden", 0))
- Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact));
+ Clist_ChangeContactIcon(hContact, g_CLI.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact));
}
}
else if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0)
- Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
+ Clist_ChangeContactIcon(hContact, g_CLI.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
else if (!strcmp(cws->szSetting, "MyHandle")) {
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
replaceStrW(pdnce->tszName, nullptr);
- cli.pfnCheckCacheItem(pdnce);
+ g_CLI.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Group")) {
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
@@ -232,7 +232,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
else
szProto = cws->value.pszVal;
Clist_ChangeContactIcon(hContact,
- cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
+ g_CLI.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
}
return 0;
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index 95a48da22d..72764cd553 100644
--- a/src/mir_app/src/clisttray.cpp
+++ b/src/mir_app/src/clisttray.cpp
@@ -61,7 +61,7 @@ static HICON lastTaskBarIcon;
static void SetTaskBarIcon(const HICON hIcon, const wchar_t *szNewTip)
{
if (pTaskbarInterface) {
- pTaskbarInterface->SetOverlayIcon(cli.hwndContactList, hIcon, szNewTip);
+ pTaskbarInterface->SetOverlayIcon(g_CLI.hwndContactList, hIcon, szNewTip);
lastTaskBarIcon = hIcon;
}
}
@@ -84,8 +84,8 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c
if (szPrefix && szPrefix[0]) {
if (!db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
- wcsncpy_s(cli.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
- return cli.szTip;
+ wcsncpy_s(g_CLI.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
+ return g_CLI.szTip;
}
tszTip.Append(szPrefix);
}
@@ -118,7 +118,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c
else tszTip.AppendFormat(L"%s %s", pa->tszAccountName, szStatus);
}
- wcsncpy_s(cli.szTip, MAX_TIP_SIZE, tszTip, _TRUNCATE);
+ wcsncpy_s(g_CLI.szTip, MAX_TIP_SIZE, tszTip, _TRUNCATE);
}
else {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
@@ -129,27 +129,27 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c
if (db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
if (ProtoXStatus != nullptr)
- mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
+ mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
- mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
+ else mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"%s%s%s %s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
}
- else mir_wstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE);
+ else mir_wstrncpy(g_CLI.szTip, szPrefix, MAX_TIP_SIZE);
}
else {
if (hasTips()) {
if (ProtoXStatus != nullptr)
- mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
+ mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
else
- mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
+ mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
}
- else mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
+ else mir_snwprintf(g_CLI.szTip, MAX_TIP_SIZE, L"%s %s", pa->tszAccountName, szStatus);
}
}
}
- return cli.szTip;
+ return g_CLI.szTip;
}
MIR_APP_DLL(int) Clist_TrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status)
@@ -158,14 +158,14 @@ MIR_APP_DLL(int) Clist_TrayIconAdd(HWND hwnd, const char *szProto, const char *s
mir_cslock lck(trayLockCS);
int i;
- for (i = 0; i < cli.trayIconCount; i++)
- if (cli.trayIcon[i].id == 0)
+ for (i = 0; i < g_CLI.trayIconCount; i++)
+ if (g_CLI.trayIcon[i].id == 0)
break;
- trayIconInfo_t &p = cli.trayIcon[i];
+ trayIconInfo_t &p = g_CLI.trayIcon[i];
p.id = TRAYICON_ID_BASE + i;
p.szProto = (char*)szProto;
- p.hBaseIcon = cli.pfnGetIconFromStatusMode(0, szIconProto ? szIconProto : p.szProto, status);
+ p.hBaseIcon = g_CLI.pfnGetIconFromStatusMode(0, szIconProto ? szIconProto : p.szProto, status);
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
nid.hWnd = hwnd;
@@ -176,14 +176,14 @@ MIR_APP_DLL(int) Clist_TrayIconAdd(HWND hwnd, const char *szProto, const char *s
Clist_TrayIconMakeTooltip(nullptr, p.szProto);
if (!hasTips())
- mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
- replaceStrW(p.ptszToolTip, cli.szTip);
+ mir_wstrncpy(nid.szTip, g_CLI.szTip, _countof(nid.szTip));
+ replaceStrW(p.ptszToolTip, g_CLI.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
p.isBase = 1;
- if (cli.trayIconCount == 1)
- SetTaskBarIcon(cli.trayIcon[0].hBaseIcon, cli.szTip);
+ if (g_CLI.trayIconCount == 1)
+ SetTaskBarIcon(g_CLI.trayIcon[0].hBaseIcon, g_CLI.szTip);
return i;
}
@@ -192,8 +192,8 @@ MIR_APP_DLL(void) Clist_TrayIconRemove(HWND hwnd, const char *szProto)
initcheck;
mir_cslock lck(trayLockCS);
- for (int i = 0; i < cli.trayIconCount; i++) {
- trayIconInfo_t *pii = &cli.trayIcon[i];
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ trayIconInfo_t *pii = &g_CLI.trayIcon[i];
if (pii->id != 0 && !mir_strcmp(szProto, pii->szProto)) {
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
nid.hWnd = hwnd;
@@ -207,7 +207,7 @@ MIR_APP_DLL(void) Clist_TrayIconRemove(HWND hwnd, const char *szProto)
}
}
- if (cli.trayIconCount == 1)
+ if (g_CLI.trayIconCount == 1)
SetTaskBarIcon(nullptr, nullptr);
}
@@ -225,10 +225,10 @@ int fnTrayIconInit(HWND hwnd)
CycleTimerId = 0;
}
- cli.trayIconCount = 1;
+ g_CLI.trayIconCount = 1;
if (netProtoCount) {
- cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
+ g_CLI.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
int trayIconSetting = db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
@@ -243,7 +243,7 @@ int fnTrayIconInit(HWND hwnd)
db_free(&dbv);
}
else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) {
- cli.trayIconCount = netProtoCount;
+ g_CLI.trayIconCount = netProtoCount;
for (int i = 0; i < accounts.getCount(); i++) {
int j = Clist_GetAccountIndex(i);
if (j >= 0) {
@@ -261,7 +261,7 @@ int fnTrayIconInit(HWND hwnd)
}
}
else {
- cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t));
+ g_CLI.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t));
Clist_TrayIconAdd(hwnd, nullptr, nullptr, CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
}
@@ -273,22 +273,22 @@ MIR_APP_DLL(int) Clist_TrayIconDestroy(HWND hwnd)
initcheck 0;
mir_cslock lck(trayLockCS);
- if (cli.trayIconCount == 1)
+ if (g_CLI.trayIconCount == 1)
SetTaskBarIcon(nullptr, nullptr);
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
nid.hWnd = hwnd;
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- nid.uID = cli.trayIcon[i].id;
+ nid.uID = g_CLI.trayIcon[i].id;
Shell_NotifyIcon(NIM_DELETE, &nid);
- DestroyIcon(cli.trayIcon[i].hBaseIcon);
- mir_free(cli.trayIcon[i].ptszToolTip);
+ DestroyIcon(g_CLI.trayIcon[i].hBaseIcon);
+ mir_free(g_CLI.trayIcon[i].ptszToolTip);
}
- mir_free(cli.trayIcon);
- cli.trayIcon = nullptr;
- cli.trayIconCount = 0;
+ mir_free(g_CLI.trayIcon);
+ g_CLI.trayIcon = nullptr;
+ g_CLI.trayIconCount = 0;
return 0;
}
@@ -297,7 +297,7 @@ void TrayIconTaskbarCreated(HWND hwnd)
{
initcheck;
Clist_TrayIconDestroy(hwnd);
- cli.pfnTrayIconInit(hwnd);
+ g_CLI.pfnTrayIconInit(hwnd);
}
static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD)
@@ -317,52 +317,52 @@ int TrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPrefer
mir_cslock lck(trayLockCS);
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
- nid.hWnd = cli.hwndContactList;
+ nid.hWnd = g_CLI.hwndContactList;
nid.uFlags = NIF_ICON | NIF_TIP;
nid.hIcon = hNewIcon;
if (!hNewIcon)
return -1;
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- if (mir_strcmp(cli.trayIcon[i].szProto, szPreferredProto))
+ if (mir_strcmp(g_CLI.trayIcon[i].szProto, szPreferredProto))
continue;
- nid.uID = cli.trayIcon[i].id;
- Clist_TrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- replaceStrW(cli.trayIcon[i].ptszToolTip, cli.szTip);
+ nid.uID = g_CLI.trayIcon[i].id;
+ Clist_TrayIconMakeTooltip(szNewTip, g_CLI.trayIcon[i].szProto);
+ replaceStrW(g_CLI.trayIcon[i].ptszToolTip, g_CLI.szTip);
if (!hasTips())
- mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, g_CLI.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
- if (cli.trayIconCount == 1)
- SetTaskBarIcon(hNewIcon, cli.szTip);
+ if (g_CLI.trayIconCount == 1)
+ SetTaskBarIcon(hNewIcon, g_CLI.szTip);
else
SetTaskBarIcon(nullptr, nullptr);
- cli.trayIcon[i].isBase = isBase;
+ g_CLI.trayIcon[i].isBase = isBase;
return i;
}
// if there wasn't a suitable icon, change all the icons
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- nid.uID = cli.trayIcon[i].id;
+ nid.uID = g_CLI.trayIcon[i].id;
- Clist_TrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- replaceStrW(cli.trayIcon[i].ptszToolTip, cli.szTip);
+ Clist_TrayIconMakeTooltip(szNewTip, g_CLI.trayIcon[i].szProto);
+ replaceStrW(g_CLI.trayIcon[i].ptszToolTip, g_CLI.szTip);
if (!hasTips())
- mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
+ mir_wstrncpy(nid.szTip, g_CLI.szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
- if (cli.trayIconCount == 1)
- SetTaskBarIcon(hNewIcon, cli.szTip);
+ if (g_CLI.trayIconCount == 1)
+ SetTaskBarIcon(hNewIcon, g_CLI.szTip);
else
SetTaskBarIcon(nullptr, nullptr);
- cli.trayIcon[i].isBase = isBase;
+ g_CLI.trayIcon[i].isBase = isBase;
if (db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
DWORD time1 = db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 200;
DWORD time2 = db_get_w(0, "CList", "IconFlashTime", 550) + 1000;
@@ -391,14 +391,14 @@ MIR_APP_DLL(int) Clist_TrayIconSetBaseInfo(HICON hIcon, const char *szPreferredP
mir_cslock lck(trayLockCS);
if (szPreferredProto) {
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- if (mir_strcmp(cli.trayIcon[i].szProto, szPreferredProto))
+ if (mir_strcmp(g_CLI.trayIcon[i].szProto, szPreferredProto))
continue;
- DestroyIcon(cli.trayIcon[i].hBaseIcon);
- cli.trayIcon[i].hBaseIcon = hIcon;
+ DestroyIcon(g_CLI.trayIcon[i].hBaseIcon);
+ g_CLI.trayIcon[i].hBaseIcon = hIcon;
return i;
}
if ((Clist_GetProtocolVisibility(szPreferredProto)) &&
@@ -409,12 +409,12 @@ MIR_APP_DLL(int) Clist_TrayIconSetBaseInfo(HICON hIcon, const char *szPreferredP
}
// if there wasn't a specific icon, there will only be one suitable
- for (int i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- DestroyIcon(cli.trayIcon[i].hBaseIcon);
- cli.trayIcon[i].hBaseIcon = hIcon;
+ DestroyIcon(g_CLI.trayIcon[i].hBaseIcon);
+ g_CLI.trayIcon[i].hBaseIcon = hIcon;
return i;
}
@@ -437,16 +437,16 @@ static VOID CALLBACK TrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
int i;
for (i = accounts.getCount() + 1; --i;) {
- cli.cycleStep = (cli.cycleStep + 1) % accounts.getCount();
- if (accounts[cli.cycleStep]->IsVisible())
+ g_CLI.cycleStep = (g_CLI.cycleStep + 1) % accounts.getCount();
+ if (accounts[g_CLI.cycleStep]->IsVisible())
break;
}
if (i) {
- DestroyIcon(cli.trayIcon[0].hBaseIcon);
- cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(0, accounts[cli.cycleStep]->szModuleName, accounts[cli.cycleStep]->iRealStatus);
- if (cli.trayIcon[0].isBase)
- TrayIconUpdate(cli.trayIcon[0].hBaseIcon, nullptr, nullptr, 1);
+ DestroyIcon(g_CLI.trayIcon[0].hBaseIcon);
+ g_CLI.trayIcon[0].hBaseIcon = g_CLI.pfnGetIconFromStatusMode(0, accounts[g_CLI.cycleStep]->szModuleName, accounts[g_CLI.cycleStep]->iRealStatus);
+ if (g_CLI.trayIcon[0].isBase)
+ TrayIconUpdate(g_CLI.trayIcon[0].hBaseIcon, nullptr, nullptr, 1);
}
}
@@ -474,53 +474,53 @@ MIR_APP_DLL(void) Clist_TrayIconUpdateBase(const char *szChangedProto)
for (auto &it : accounts)
if (!mir_strcmp(szChangedProto, it->szModuleName))
- cli.cycleStep = accounts.indexOf(&it);
+ g_CLI.cycleStep = accounts.indexOf(&it);
- int changed = cli.pfnTrayCalcChanged(szChangedProto, averageMode, netProtoCount);
- if (changed != -1 && cli.trayIcon[changed].isBase)
- TrayIconUpdate(cli.trayIcon[changed].hBaseIcon, nullptr, cli.trayIcon[changed].szProto, 1);
+ int changed = g_CLI.pfnTrayCalcChanged(szChangedProto, averageMode, netProtoCount);
+ if (changed != -1 && g_CLI.trayIcon[changed].isBase)
+ TrayIconUpdate(g_CLI.trayIcon[changed].hBaseIcon, nullptr, g_CLI.trayIcon[changed].szProto, 1);
}
int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount)
{
if (netProtoCount == 0)
- return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(nullptr, averageMode, 0), ILD_NORMAL), nullptr);
+ return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, g_CLI.pfnIconFromStatusMode(nullptr, averageMode, 0), ILD_NORMAL), nullptr);
int trayIconSetting = db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (averageMode > 0) {
if (trayIconSetting != SETTING_TRAYICON_MULTI)
- return Clist_TrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
+ return Clist_TrayIconSetBaseInfo(g_CLI.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
if (db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- return Clist_TrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
+ return Clist_TrayIconSetBaseInfo(g_CLI.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
- if (cli.trayIcon == nullptr || cli.trayIcon[0].szProto == nullptr)
- return Clist_TrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
+ if (g_CLI.trayIcon == nullptr || g_CLI.trayIcon[0].szProto == nullptr)
+ return Clist_TrayIconSetBaseInfo(g_CLI.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
- Clist_TrayIconDestroy(cli.hwndContactList);
- cli.pfnTrayIconInit(cli.hwndContactList);
+ Clist_TrayIconDestroy(g_CLI.hwndContactList);
+ g_CLI.pfnTrayIconInit(g_CLI.hwndContactList);
}
else {
switch (trayIconSetting) {
case SETTING_TRAYICON_CYCLE:
Clist_TraySetTimer();
- return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szChangedProto, Proto_GetStatus(szChangedProto), 0), ILD_NORMAL), nullptr);
+ return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, g_CLI.pfnIconFromStatusMode(szChangedProto, Proto_GetStatus(szChangedProto), 0), ILD_NORMAL), nullptr);
case SETTING_TRAYICON_MULTI:
- if (!cli.trayIcon)
+ if (!g_CLI.trayIcon)
Clist_TrayIconRemove(nullptr, nullptr);
- else if ((cli.trayIconCount > 1 || netProtoCount == 1) || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- return Clist_TrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
+ else if ((g_CLI.trayIconCount > 1 || netProtoCount == 1) || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ return Clist_TrayIconSetBaseInfo(g_CLI.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
else {
- Clist_TrayIconDestroy(cli.hwndContactList);
- cli.pfnTrayIconInit(cli.hwndContactList);
+ Clist_TrayIconDestroy(g_CLI.hwndContactList);
+ g_CLI.pfnTrayIconInit(g_CLI.hwndContactList);
}
break;
case SETTING_TRAYICON_SINGLE:
ptrA szProto(db_get_sa(0, "CList", "PrimaryStatus"));
- return Clist_TrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szProto, szProto ? Proto_GetStatus(szProto) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
+ return Clist_TrayIconSetBaseInfo(g_CLI.pfnGetIconFromStatusMode(0, szProto, szProto ? Proto_GetStatus(szProto) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
}
}
@@ -533,20 +533,20 @@ void TrayIconSetToBase(char *szPreferredProto)
initcheck;
mir_cslock lck(trayLockCS);
- for (i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- if (mir_strcmp(cli.trayIcon[i].szProto, szPreferredProto))
+ if (mir_strcmp(g_CLI.trayIcon[i].szProto, szPreferredProto))
continue;
- TrayIconUpdate(cli.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
+ TrayIconUpdate(g_CLI.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
return;
}
// if there wasn't a specific icon, there will only be one suitable
- for (i = 0; i < cli.trayIconCount; i++) {
- if (cli.trayIcon[i].id == 0)
+ for (i = 0; i < g_CLI.trayIconCount; i++) {
+ if (g_CLI.trayIcon[i].id == 0)
continue;
- TrayIconUpdate(cli.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
+ TrayIconUpdate(g_CLI.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
return;
}
}
@@ -556,8 +556,8 @@ MIR_APP_DLL(void) Clist_TrayIconIconsChanged()
initcheck;
mir_cslock lck(trayLockCS);
- Clist_TrayIconDestroy(cli.hwndContactList);
- cli.pfnTrayIconInit(cli.hwndContactList);
+ Clist_TrayIconDestroy(g_CLI.hwndContactList);
+ g_CLI.pfnTrayIconInit(g_CLI.hwndContactList);
}
static UINT_PTR autoHideTimerId;
@@ -567,7 +567,7 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd, UINT, UINT_PTR idEvent, DW
mir_cslock lck(trayLockCS);
KillTimer(hwnd, idEvent);
- HWND hwndClui = cli.hwndContactList;
+ HWND hwndClui = g_CLI.hwndContactList;
if (GetActiveWindow() != hwndClui) {
ShowWindow(hwndClui, SW_HIDE);
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
@@ -580,7 +580,7 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM)
mir_cslock lck(trayLockCS);
if (db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
- if (GetActiveWindow() != cli.hwndContactList) {
+ if (GetActiveWindow() != g_CLI.hwndContactList) {
KillTimer(nullptr, autoHideTimerId);
autoHideTimerId = SetTimer(nullptr, 0, 1000 * db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
}
@@ -611,27 +611,27 @@ static void CALLBACK TrayHideToolTipTimerProc(HWND hwnd, UINT, UINT_PTR, DWORD)
static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
{
- if (!g_trayTooltipActive && !cli.bTrayMenuOnScreen) {
+ if (!g_trayTooltipActive && !g_CLI.bTrayMenuOnScreen) {
POINT pt;
GetCursorPos(&pt);
if (abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE) {
- wchar_t* szTipCur = cli.szTip;
+ wchar_t* szTipCur = g_CLI.szTip;
{
int n = s_LastHoverIconID - 100;
- if (n >= 0 && n < cli.trayIconCount)
- szTipCur = cli.trayIcon[n].ptszToolTip;
+ if (n >= 0 && n < g_CLI.trayIconCount)
+ szTipCur = g_CLI.trayIcon[n].ptszToolTip;
}
CLCINFOTIP ti = { sizeof(ti) };
ti.rcItem.left = pt.x - 10;
ti.rcItem.right = pt.x + 10;
ti.rcItem.top = pt.y - 10;
ti.rcItem.bottom = pt.y + 10;
- ti.isTreeFocused = GetFocus() == cli.hwndContactList ? 1 : 0;
+ ti.isTreeFocused = GetFocus() == g_CLI.hwndContactList ? 1 : 0;
if (CallService("mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti) == CALLSERVICE_NOTFOUND)
CallService("mToolTip/ShowTip", (WPARAM)(char*)_T2A(szTipCur), (LPARAM)&ti);
GetCursorPos(&tray_hover_pos);
- SetTimer(cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc);
+ SetTimer(g_CLI.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc);
g_trayTooltipActive = true;
}
}
@@ -650,7 +650,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
break;
}
case TIM_CREATE:
- cli.pfnTrayIconInit(msg->hwnd);
+ g_CLI.pfnTrayIconInit(msg->hwnd);
break;
case WM_ACTIVATE:
@@ -674,22 +674,22 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
}
if (msg->lParam == WM_MBUTTONUP)
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
else if (msg->lParam == (db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
POINT pt;
HMENU hMenu = Menu_GetStatusMenu();
- for (int i = 0; i < cli.trayIconCount; i++) {
- if ((unsigned)cli.trayIcon[i].id == msg->wParam) {
- if (!cli.trayIcon[i].szProto)
+ for (int i = 0; i < g_CLI.trayIconCount; i++) {
+ if ((unsigned)g_CLI.trayIcon[i].id == msg->wParam) {
+ if (!g_CLI.trayIcon[i].szProto)
break;
int ind = 0;
for (int j = 0; j < accounts.getCount(); j++) {
int k = Clist_GetAccountIndex(j);
if (k >= 0) {
- if (!mir_strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName)) {
+ if (!mir_strcmp(g_CLI.trayIcon[i].szProto, accounts[k]->szModuleName)) {
HMENU hm = GetSubMenu(hMenu, ind);
if (hm) hMenu = hm;
break;
@@ -709,7 +709,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr);
}
else if (Clist_EventsProcessTrayDoubleClick(msg->wParam))
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
}
else if (msg->lParam == WM_RBUTTONUP) {
HMENU hMenu = Menu_BuildTrayMenu();
@@ -718,7 +718,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
POINT pt;
GetCursorPos(&pt);
- cli.bTrayMenuOnScreen = TRUE;
+ g_CLI.bTrayMenuOnScreen = TRUE;
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr);
Menu_DestroyNestedMenu(hMenu);
PostMessage(msg->hwnd, WM_NULL, 0, 0);
@@ -736,7 +736,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
}
else {
GetCursorPos(&tray_hover_pos);
- SetTimer(cli.hwndContactList, TIMERID_TRAYHOVER, 600, TrayToolTipTimerProc);
+ SetTimer(g_CLI.hwndContactList, TIMERID_TRAYHOVER, 600, TrayToolTipTimerProc);
}
break;
}
@@ -766,19 +766,19 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
static int sttGetIcon(const char *szProto)
{
if (szProto == nullptr)
- return cli.trayIcon[0].id;
+ return g_CLI.trayIcon[0].id;
UINT iconId = 0;
- for (int j = 0; j < cli.trayIconCount; j++) {
- if (cli.trayIcon[j].szProto != nullptr) {
- if (!mir_strcmp(szProto, cli.trayIcon[j].szProto)) {
- iconId = cli.trayIcon[j].id;
+ for (int j = 0; j < g_CLI.trayIconCount; j++) {
+ if (g_CLI.trayIcon[j].szProto != nullptr) {
+ if (!mir_strcmp(szProto, g_CLI.trayIcon[j].szProto)) {
+ iconId = g_CLI.trayIcon[j].id;
break;
}
}
- else if (cli.trayIcon[j].isBase) {
- iconId = cli.trayIcon[j].id;
+ else if (g_CLI.trayIcon[j].isBase) {
+ iconId = g_CLI.trayIcon[j].id;
break;
}
}
@@ -790,12 +790,12 @@ MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle,
{
if (szInfo == nullptr || szInfoTitle == nullptr)
return 1;
- if (cli.trayIcon == nullptr)
+ if (g_CLI.trayIcon == nullptr)
return 2;
NOTIFYICONDATAA nid = { 0 };
nid.cbSize = NOTIFYICONDATAA_V2_SIZE;
- nid.hWnd = cli.hwndContactList;
+ nid.hWnd = g_CLI.hwndContactList;
nid.uID = sttGetIcon(szProto);
nid.uFlags = NIF_INFO;
strncpy_s(nid.szInfo, szInfo, _TRUNCATE);
@@ -809,12 +809,12 @@ MIR_APP_DLL(int) Clist_TrayNotifyW(const char *szProto, const wchar_t *wszInfoTi
{
if (wszInfo == nullptr || wszInfoTitle == nullptr)
return 1;
- if (cli.trayIcon == nullptr)
+ if (g_CLI.trayIcon == nullptr)
return 2;
NOTIFYICONDATAW nid = { 0 };
nid.cbSize = NOTIFYICONDATAW_V2_SIZE;
- nid.hWnd = cli.hwndContactList;
+ nid.hWnd = g_CLI.hwndContactList;
nid.uID = sttGetIcon(szProto);
nid.uFlags = NIF_INFO;
mir_wstrncpy(nid.szInfo, wszInfo, _countof(nid.szInfo));
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index a4145e9395..9c38594de9 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -59,14 +59,14 @@ void fnLoadCluiGlobalOpts()
static int CluiModulesLoaded(WPARAM, LPARAM)
{
- if (cli.hMenuMain) {
+ if (g_CLI.hMenuMain) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = Menu_GetMainMenu();
- SetMenuItemInfo(cli.hMenuMain, 0, TRUE, &mii);
+ SetMenuItemInfo(g_CLI.hMenuMain, 0, TRUE, &mii);
mii.hSubMenu = Menu_GetStatusMenu();
- SetMenuItemInfo(cli.hMenuMain, 1, TRUE, &mii);
+ SetMenuItemInfo(g_CLI.hMenuMain, 1, TRUE, &mii);
}
return 0;
}
@@ -81,7 +81,7 @@ static void DisconnectAll()
static int CluiIconsChanged(WPARAM, LPARAM)
{
- DrawMenuBar(cli.hwndContactList);
+ DrawMenuBar(g_CLI.hwndContactList);
return 0;
}
@@ -92,7 +92,7 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)
wchar_t cls[128];
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
- hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : g_CLI.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != nullptr);
return 0;
@@ -104,7 +104,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM)
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_wstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : g_CLI.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -224,12 +224,12 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
m.message = msg;
m.wParam = wParam;
m.lParam = lParam;
- if (cli.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result))
+ if (g_CLI.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result))
return result;
- if (cli.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result))
+ if (g_CLI.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
- return cli.pfnContactListWndProc(hwnd, msg, wParam, lParam);
+ return g_CLI.pfnContactListWndProc(hwnd, msg, wParam, lParam);
}
int LoadCLUIModule(void)
@@ -238,7 +238,7 @@ int LoadCLUIModule(void)
wchar_t titleText[256];
uMsgProcessProfile = RegisterWindowMessage(L"Miranda::ProcessProfile");
- cli.pfnLoadCluiGlobalOpts();
+ g_CLI.pfnLoadCluiGlobalOpts();
HookEvent(ME_SYSTEM_MODULESLOADED, CluiModulesLoaded);
HookEvent(ME_SKIN_ICONSCHANGED, CluiIconsChanged);
@@ -250,9 +250,9 @@ int LoadCLUIModule(void)
WNDCLASSEX wndclass = { 0 };
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
- wndclass.lpfnWndProc = cli.pfnContactListControlWndProc;
+ wndclass.lpfnWndProc = g_CLI.pfnContactListControlWndProc;
wndclass.cbWndExtra = sizeof(void *);
- wndclass.hInstance = cli.hInst;
+ wndclass.hInstance = g_CLI.hInst;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.lpszClassName = CLISTCONTROL_CLASSW;
RegisterClassEx(&wndclass);
@@ -261,7 +261,7 @@ int LoadCLUIModule(void)
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW | ((db_get_b(0, "CList", "WindowShadow", 0) == 1) ? CS_DROPSHADOW : 0);
wndclass.lpfnWndProc = ContactListWndProc;
- wndclass.hInstance = cli.hInst;
+ wndclass.hInstance = g_CLI.hInst;
wndclass.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true);
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
@@ -285,7 +285,7 @@ int LoadCLUIModule(void)
Utils_AssertInsideScreen(&pos);
- cli.hwndContactList = CreateWindowEx(
+ g_CLI.hwndContactList = CreateWindowEx(
(db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
_T(MIRANDACLASS),
titleText,
@@ -293,27 +293,27 @@ int LoadCLUIModule(void)
(db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU |
(db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0),
pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top,
- nullptr, nullptr, cli.hInst, nullptr);
+ nullptr, nullptr, g_CLI.hInst, nullptr);
if (db_get_b(0, "CList", "OnDesktop", 0)) {
HWND hProgMan = FindWindow(L"Progman", nullptr);
if (IsWindow(hProgMan))
- SetParent(cli.hwndContactList, hProgMan);
+ SetParent(g_CLI.hwndContactList, hProgMan);
}
- cli.pfnOnCreateClc();
+ g_CLI.pfnOnCreateClc();
- PostMessage(cli.hwndContactList, M_RESTORESTATUS, 0, 0);
+ PostMessage(g_CLI.hwndContactList, M_RESTORESTATUS, 0, 0);
int state = db_get_b(0, "CList", "State", SETTING_STATE_NORMAL);
- cli.hMenuMain = GetMenu(cli.hwndContactList);
+ g_CLI.hMenuMain = GetMenu(g_CLI.hwndContactList);
if (!db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
- SetMenu(cli.hwndContactList, nullptr);
+ SetMenu(g_CLI.hwndContactList, nullptr);
if (state == SETTING_STATE_NORMAL)
- ShowWindow(cli.hwndContactList, SW_SHOW);
+ ShowWindow(g_CLI.hwndContactList, SW_SHOW);
else if (state == SETTING_STATE_MINIMIZED)
- ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
- SetWindowPos(cli.hwndContactList,
+ ShowWindow(g_CLI.hwndContactList, SW_SHOWMINIMIZED);
+ SetWindowPos(g_CLI.hwndContactList,
db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
@@ -440,9 +440,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int flags = WS_CHILD | CCS_BOTTOM;
flags |= cluiopt.showsbar ? WS_VISIBLE : 0;
flags |= cluiopt.showgrip ? SBARS_SIZEGRIP : 0;
- cli.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, cli.hInst, nullptr);
+ g_CLI.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_CLI.hInst, nullptr);
}
- cli.pfnCluiProtocolStatusChanged(0, nullptr);
+ g_CLI.pfnCluiProtocolStatusChanged(0, nullptr);
//delay creation of CLC so that it can get the status icons right the first time (needs protocol modules loaded)
PostMessage(hwnd, M_CREATECLC, 0, 0);
@@ -455,13 +455,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return FALSE;
case M_CREATECLC:
- cli.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
+ g_CLI.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
| CLS_CONTACTLIST
| (db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
| (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
| (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0),
- 0, 0, 0, 0, hwnd, nullptr, cli.hInst, nullptr);
+ 0, 0, 0, 0, hwnd, nullptr, g_CLI.hInst, nullptr);
SendMessage(hwnd, WM_SIZE, 0, 0);
break;
@@ -492,10 +492,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case WM_SYSCOLORCHANGE:
- SendMessage(cli.hwndContactTree, msg, wParam, lParam);
- SendMessage(cli.hwndStatus, msg, wParam, lParam);
+ SendMessage(g_CLI.hwndContactTree, msg, wParam, lParam);
+ SendMessage(g_CLI.hwndStatus, msg, wParam, lParam);
// XXX: only works with 4.71 with 95, IE4.
- SendMessage(cli.hwndStatus, SB_SETBKCOLOR, 0, GetSysColor(COLOR_3DFACE));
+ SendMessage(g_CLI.hwndStatus, SB_SETBKCOLOR, 0, GetSysColor(COLOR_3DFACE));
break;
case WM_SIZE:
@@ -505,13 +505,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
RECT rect, rcStatus;
GetClientRect(hwnd, &rect);
if (cluiopt.showsbar) {
- SetWindowPos(cli.hwndStatus, nullptr, 0, rect.bottom - 20, rect.right - rect.left, 20, SWP_NOZORDER);
- GetWindowRect(cli.hwndStatus, &rcStatus);
- cli.pfnCluiProtocolStatusChanged(0, nullptr);
+ SetWindowPos(g_CLI.hwndStatus, nullptr, 0, rect.bottom - 20, rect.right - rect.left, 20, SWP_NOZORDER);
+ GetWindowRect(g_CLI.hwndStatus, &rcStatus);
+ g_CLI.pfnCluiProtocolStatusChanged(0, nullptr);
}
else
rcStatus.top = rcStatus.bottom = 0;
- SetWindowPos(cli.hwndContactTree, nullptr, 0, 0, rect.right, rect.bottom - (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
+ SetWindowPos(g_CLI.hwndContactTree, nullptr, 0, 0, rect.right, rect.bottom - (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
}
if (wParam == SIZE_MINIMIZED) {
if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
@@ -540,7 +540,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return FALSE;
case WM_SETFOCUS:
- SetFocus(cli.hwndContactTree);
+ SetFocus(g_CLI.hwndContactTree);
return 0;
case WM_ACTIVATE:
@@ -643,7 +643,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
if (wParam)
SetForegroundWindow(hwnd);
AnimateWindow(hwnd, 200, AW_BLEND | (wParam ? 0 : AW_HIDE));
- SetWindowPos(cli.hwndContactTree, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ SetWindowPos(g_CLI.hwndContactTree, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
break;
@@ -691,16 +691,16 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case ID_TRAY_HIDE:
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
break;
case POPUP_NEWGROUP:
- SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
Clist_GroupCreate(0, nullptr);
break;
case POPUP_HIDEOFFLINE:
- cli.pfnSetHideOffline(-1);
+ g_CLI.pfnSetHideOffline(-1);
break;
case POPUP_HIDEOFFLINEROOT:
@@ -716,7 +716,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case POPUP_HIDEMIRANDA:
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
break;
}
return FALSE;
@@ -742,12 +742,12 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_DISPLAYCHANGE:
DefWindowProc(hwnd, msg, wParam, lParam);
- SendMessage(cli.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
+ SendMessage(g_CLI.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
break;
//MSG FROM CHILD CONTROL
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->hwndFrom == cli.hwndContactTree) {
+ if (((LPNMHDR)lParam)->hwndFrom == g_CLI.hwndContactTree) {
NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam;
switch (((LPNMHDR)lParam)->code) {
case CLN_EXPANDED:
@@ -758,7 +758,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
ClientToScreen(hwnd, &nmc->pt);
if (!(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDraggingEvent, (WPARAM)nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
- SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
+ SetCursor(LoadCursor(g_CLI.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
}
break;
@@ -772,7 +772,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
ClientToScreen(hwnd, &nmc->pt);
if (!(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDroppedEvent, (WPARAM)nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
- SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
+ SetCursor(LoadCursor(g_CLI.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
}
break;
@@ -800,7 +800,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75);
GetWindowRect(hwnd, &rcWindow);
- GetWindowRect(cli.hwndContactTree, &rcTree);
+ GetWindowRect(g_CLI.hwndContactTree, &rcTree);
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE);
HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
@@ -829,7 +829,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NM_CLICK:
{
DWORD hitFlags;
- HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
+ HANDLE hItem = (HANDLE)SendMessage(g_CLI.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
if (hItem) {
if (hitFlags & CLCHT_ONITEMEXTRA) {
if (!IsHContactGroup((UINT_PTR)hItem) && !IsHContactInfo((UINT_PTR)hItem))
@@ -844,14 +844,14 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
POINT pt = nmc->pt;
- ClientToScreen(cli.hwndContactTree, &pt);
+ ClientToScreen(g_CLI.hwndContactTree, &pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
}
break;
}
}
- else if (((LPNMHDR)lParam)->hwndFrom == cli.hwndStatus) {
+ else if (((LPNMHDR)lParam)->hwndFrom == g_CLI.hwndStatus) {
if (((LPNMHDR)lParam)->code == NM_CLICK) {
unsigned int nParts, nPanel;
NMMOUSE *nm = (NMMOUSE *)lParam;
@@ -860,10 +860,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
POINT pt;
hMenu = Menu_GetStatusMenu();
- nParts = SendMessage(cli.hwndStatus, SB_GETPARTS, 0, 0);
+ nParts = SendMessage(g_CLI.hwndStatus, SB_GETPARTS, 0, 0);
if (nm->dwItemSpec == 0xFFFFFFFE) {
nPanel = nParts - 1;
- SendMessage(cli.hwndStatus, SB_GETRECT, nPanel, (LPARAM)& rc);
+ SendMessage(g_CLI.hwndStatus, SB_GETRECT, nPanel, (LPARAM)& rc);
if (nm->pt.x < rc.left)
return FALSE;
}
@@ -880,26 +880,26 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
}
}
- SendMessage(cli.hwndStatus, SB_GETRECT, nPanel, (LPARAM)& rc);
+ SendMessage(g_CLI.hwndStatus, SB_GETRECT, nPanel, (LPARAM)& rc);
pt.x = rc.left;
pt.y = rc.top;
- ClientToScreen(cli.hwndStatus, &pt);
+ ClientToScreen(g_CLI.hwndStatus, &pt);
TrackPopupMenu(hMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr);
}
}
return FALSE;
case WM_MENUSELECT:
- if (lParam && (HMENU)lParam == cli.hMenuMain) {
+ if (lParam && (HMENU)lParam == g_CLI.hMenuMain) {
int pos = LOWORD(wParam);
POINT pt;
GetCursorPos(&pt);
- if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
+ if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, g_CLI.hMenuMain, pt) != -1)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = (pos == 0) ? Menu_GetMainMenu() : Menu_GetStatusMenu();
- SetMenuItemInfo(cli.hMenuMain, pos, TRUE, &mii);
+ SetMenuItemInfo(g_CLI.hMenuMain, pos, TRUE, &mii);
}
}
break;
@@ -910,7 +910,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
RECT rc;
- GetWindowRect(cli.hwndContactTree, &rc);
+ GetWindowRect(g_CLI.hwndContactTree, &rc);
if (pt.x == -1 && pt.y == -1) {
// all this is done in screen-coords!
GetCursorPos(&pt);
@@ -926,7 +926,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
Menu_DestroyNestedMenu(hMenu);
return 0;
}
- GetWindowRect(cli.hwndStatus, &rc);
+ GetWindowRect(g_CLI.hwndStatus, &rc);
if (PtInRect(&rc, pt)) {
HMENU hMenu;
if (db_get_b(0, "CLUI", "SBarRightClk", 0))
@@ -950,7 +950,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem == cli.hwndStatus) {
+ if (dis->hwndItem == g_CLI.hwndStatus) {
char *szProto = (char *)dis->itemData;
if (szProto == nullptr) return 0;
int status, x;
@@ -1028,19 +1028,19 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left));
}
- RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
- RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
+ RemoveMenu(g_CLI.hMenuMain, 0, MF_BYPOSITION);
+ RemoveMenu(g_CLI.hMenuMain, 0, MF_BYPOSITION);
- if (cli.hwndStatus) {
- DestroyWindow(cli.hwndStatus);
- cli.hwndStatus = nullptr;
+ if (g_CLI.hwndStatus) {
+ DestroyWindow(g_CLI.hwndStatus);
+ g_CLI.hwndStatus = nullptr;
}
// Disconnect all protocols
DisconnectAll();
ShowWindow(hwnd, SW_HIDE);
- DestroyWindow(cli.hwndContactTree);
+ DestroyWindow(g_CLI.hwndContactTree);
FreeLibrary(hUserDll);
PostQuitMessage(0);
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp
index 90880c2877..c3fee62555 100644
--- a/src/mir_app/src/cluiservices.cpp
+++ b/src/mir_app/src/cluiservices.cpp
@@ -41,11 +41,11 @@ EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup)
EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void)
{
- if (cli.hwndContactTree == nullptr)
+ if (g_CLI.hwndContactTree == nullptr)
return;
bool bRebuild = false;
- LONG_PTR dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE);
+ LONG_PTR dwStyle = GetWindowLongPtr(g_CLI.hwndContactTree, GWL_STYLE);
// CLC does this automatically, but we need to force it if hideoffline or hideempty has changed
if ((db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) {
@@ -73,8 +73,8 @@ EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void)
}
if (bRebuild) {
- SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, dwStyle);
- Clist_InitAutoRebuild(cli.hwndContactTree);
+ SetWindowLongPtr(g_CLI.hwndContactTree, GWL_STYLE, dwStyle);
+ Clist_InitAutoRebuild(g_CLI.hwndContactTree);
}
}
@@ -84,18 +84,18 @@ EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void)
void fnCluiProtocolStatusChanged(int, const char*)
{
if (g_menuProtos.getCount() == 0) {
- SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0);
- SendMessage(cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0);
+ SendMessage(g_CLI.hwndStatus, SB_SETPARTS, 0, 0);
+ SendMessage(g_CLI.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0);
return;
}
int borders[3];
- SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
+ SendMessage(g_CLI.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
int *partWidths = (int*)alloca(g_menuProtos.getCount() * sizeof(int));
if (db_get_b(0, "CLUI", "EqualSections", 0)) {
RECT rc;
- GetClientRect(cli.hwndStatus, &rc);
+ GetClientRect(g_CLI.hwndStatus, &rc);
rc.right -= borders[0] * 2 + (db_get_b(0, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0);
for (int i = 0; i < g_menuProtos.getCount(); i++)
partWidths[i] = (i + 1) * rc.right / g_menuProtos.getCount() - (borders[2] >> 1);
@@ -105,7 +105,7 @@ void fnCluiProtocolStatusChanged(int, const char*)
BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
HDC hdc = GetDC(nullptr);
- HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0));
+ HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(g_CLI.hwndStatus, WM_GETFONT, 0, 0));
for (int i = 0; i < g_menuProtos.getCount(); i++) { //count down since built in ones tend to go at the end
int x = 2;
if (showOpts & 1)
@@ -137,13 +137,13 @@ void fnCluiProtocolStatusChanged(int, const char*)
}
partWidths[g_menuProtos.getCount()-1] = -1;
- SendMessage(cli.hwndStatus, SB_SETMINHEIGHT, g_IconHeight, 0);
- SendMessage(cli.hwndStatus, SB_SETPARTS, g_menuProtos.getCount(), (LPARAM)partWidths);
+ SendMessage(g_CLI.hwndStatus, SB_SETMINHEIGHT, g_IconHeight, 0);
+ SendMessage(g_CLI.hwndStatus, SB_SETPARTS, g_menuProtos.getCount(), (LPARAM)partWidths);
int flags = SBT_OWNERDRAW;
if (db_get_b(0, "CLUI", "SBarBevel", 1) == 0)
flags |= SBT_NOBORDERS;
for (int i = 0; i < g_menuProtos.getCount(); i++)
- SendMessage(cli.hwndStatus, SB_SETTEXT, i | flags, (LPARAM)g_menuProtos[i].szProto);
+ SendMessage(g_CLI.hwndStatus, SB_SETTEXT, i | flags, (LPARAM)g_menuProtos[i].szProto);
}
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp
index fd3049ba58..5e468f5d0f 100644
--- a/src/mir_app/src/contact.cpp
+++ b/src/mir_app/src/contact.cpp
@@ -41,7 +41,7 @@ MIR_APP_DLL(void) Clist_LoadContactTree(void)
for (auto &hContact : Contacts()) {
int status = GetContactStatus(hContact);
if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0))
- Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact));
+ Clist_ChangeContactIcon(hContact, g_CLI.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact));
}
Clist_EndRebuild();
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 0bd5ab73c9..1a44938d1e 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -339,7 +339,7 @@ public:
tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem);
}
db_set_blob(0, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
- cli.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
+ g_CLI.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
}
void OnBeginDrag(CCtrlTreeView::TEventInfo *evt)
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp
index fff8bbb1c4..4e96de3489 100644
--- a/src/mir_app/src/ei_services.cpp
+++ b/src/mir_app/src/ei_services.cpp
@@ -77,18 +77,18 @@ int ExtraImage_ExtraIDToColumnNum(int extra)
int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)
{
- if (cli.hwndContactTree == nullptr)
+ if (g_CLI.hwndContactTree == nullptr)
return -1;
int icol = ExtraImage_ExtraIDToColumnNum(ConvertToClistSlot(slot));
if (icol == -1)
return -1;
- HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_FINDCONTACT, hContact, 0);
+ HANDLE hItem = (HANDLE)SendMessage(g_CLI.hwndContactTree, CLM_FINDCONTACT, hContact, 0);
if (hItem == nullptr)
return -1;
- SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol, hImage));
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol, hImage));
return 0;
}
@@ -277,23 +277,23 @@ MIR_APP_DLL(HANDLE) ExtraIcon_AddIcon(HICON hIcon)
MIR_APP_DLL(void) ExtraIcon_Reload()
{
- SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(0, "CLUI", "ExtraColumnSpace", 18), 0);
- SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(0, "CLUI", "ExtraColumnSpace", 18), 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
if (hExtraImageList)
ImageList_Destroy(hExtraImageList);
hExtraImageList = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 1, 256);
- SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList);
- SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
NotifyEventHooks(hEventExtraImageListRebuilding, 0, 0);
bImageCreated = true;
}
MIR_APP_DLL(void) ExtraIcon_SetAll(MCONTACT hContact)
{
- if (cli.hwndContactTree == nullptr)
+ if (g_CLI.hwndContactTree == nullptr)
return;
bool hcontgiven = (hContact != 0);
@@ -301,7 +301,7 @@ MIR_APP_DLL(void) ExtraIcon_SetAll(MCONTACT hContact)
if (!bImageCreated)
ExtraIcon_Reload();
- SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
if (hContact == 0)
hContact = db_find_first();
@@ -312,7 +312,7 @@ MIR_APP_DLL(void) ExtraIcon_SetAll(MCONTACT hContact)
break;
}
- cli.pfnInvalidateRect(cli.hwndContactTree, nullptr, FALSE);
+ g_CLI.pfnInvalidateRect(g_CLI.hwndContactTree, nullptr, FALSE);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp
index 966281a42a..e104cb249f 100644
--- a/src/mir_app/src/keyboard.cpp
+++ b/src/mir_app/src/keyboard.cpp
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static INT_PTR hkHideShow(WPARAM, LPARAM)
{
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
return 0;
}
@@ -37,8 +37,8 @@ static INT_PTR hkRead(WPARAM, LPARAM)
if (Clist_EventsProcessTrayDoubleClick(0) == 0)
return true;
- SetForegroundWindow(cli.hwndContactList);
- SetFocus(cli.hwndContactList);
+ SetForegroundWindow(g_CLI.hwndContactList);
+ SetFocus(g_CLI.hwndContactList);
return 0;
}
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index ad7c8e5580..13d0ffe0f3 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -109,7 +109,7 @@ MIR_APP_DLL(HMENU) Menu_GetMainMenu(void)
NotifyEventHooks(hPreBuildMainMenuEvent, 0, 0);
Menu_Build(hMainMenu, hMainMenuObject);
- DrawMenuBar(cli.hwndContactList);
+ DrawMenuBar(g_CLI.hwndContactList);
return hMainMenu;
}
@@ -548,8 +548,8 @@ static INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
replaceStrW(pimi->mi.name.w, ptszName);
replaceStrW(root->mi.name.w, ptszName);
- if (cli.hwndStatus)
- InvalidateRect(cli.hwndStatus, nullptr, TRUE);
+ if (g_CLI.hwndStatus)
+ InvalidateRect(g_CLI.hwndStatus, nullptr, TRUE);
return 0;
}
@@ -565,7 +565,7 @@ static INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
if (pa->IsVisible())
MenusProtoCount++;
- cli.currentDesiredStatusMode = smep->status;
+ g_CLI.currentDesiredStatusMode = smep->status;
for (auto &pa : accounts) {
if (!pa->IsEnabled())
@@ -573,10 +573,10 @@ static INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
if (MenusProtoCount > 1 && pa->IsLocked())
continue;
- Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode);
+ Proto_SetStatus(pa->szModuleName, g_CLI.currentDesiredStatusMode);
}
- NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0);
- db_set_w(0, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
+ NotifyEventHooks(hStatusModeChangeEvent, g_CLI.currentDesiredStatusMode, 0);
+ db_set_w(0, "CList", "Status", (WORD)g_CLI.currentDesiredStatusMode);
return 1;
}
@@ -669,7 +669,7 @@ static int MenuIconsChanged(WPARAM, LPARAM)
{
// just rebuild menu
RebuildMenuOrder();
- cli.pfnCluiProtocolStatusChanged(0, nullptr);
+ g_CLI.pfnCluiProtocolStatusChanged(0, nullptr);
return 0;
}
@@ -882,7 +882,7 @@ MIR_APP_DLL(void) Menu_ReloadProtoMenus(void)
RebuildMenuOrder();
if (db_get_b(0, "CList", "MoveProtoMenus", true))
BuildProtoMenus();
- cli.pfnCluiProtocolStatusChanged(0, nullptr);
+ g_CLI.pfnCluiProtocolStatusChanged(0, nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -994,7 +994,7 @@ static INT_PTR HotkeySetStatus(WPARAM, LPARAM lParam)
static INT_PTR ShowHide(WPARAM, LPARAM)
{
- cli.pfnShowHide();
+ g_CLI.pfnShowHide();
return 0;
}
@@ -1095,7 +1095,7 @@ void InitCustomMenus(void)
Menu_AddMainMenuItem(&mi);
currentStatusMenuItem = ID_STATUS_OFFLINE;
- cli.currentDesiredStatusMode = ID_STATUS_OFFLINE;
+ g_CLI.currentDesiredStatusMode = ID_STATUS_OFFLINE;
HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged);
}
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp
index 16bc77d0fd..2767e5ee5c 100644
--- a/src/mir_app/src/menu_groups.cpp
+++ b/src/mir_app/src/menu_groups.cpp
@@ -105,36 +105,36 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam)
static INT_PTR HideGroupsHelper(WPARAM, LPARAM)
{
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
+ int newVal = !(GetWindowLongPtr(g_CLI.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
db_set_b(0, "CList", "HideEmptyGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
return newVal;
}
static INT_PTR UseGroupsHelper(WPARAM, LPARAM)
{
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
+ int newVal = !(GetWindowLongPtr(g_CLI.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
db_set_b(0, "CList", "UseGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
return newVal;
}
static INT_PTR HideOfflineHelper(WPARAM, LPARAM)
{
- return cli.pfnSetHideOffline(-1);
+ return g_CLI.pfnSetHideOffline(-1);
}
static INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
{
- int newVal = !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0);
- SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT, newVal, 0);
+ int newVal = !SendMessage(g_CLI.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETHIDEOFFLINEROOT, newVal, 0);
return newVal;
}
static INT_PTR CreateGroupHelper(WPARAM, LPARAM)
{
- SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
- SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
+ SendMessage(g_CLI.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
Clist_GroupCreate(0, nullptr);
return 0;
}
@@ -144,10 +144,10 @@ static int OnBuildGroupMenu(WPARAM, LPARAM)
bool bChecked = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) != 0;
Menu_SetChecked(hHideOfflineUsersMenuItem, bChecked);
- bChecked = SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) != 0;
+ bChecked = SendMessage(g_CLI.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) != 0;
Menu_SetChecked(hHideOfflineUsersOutHereMenuItem, bChecked);
- DWORD dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE);
+ DWORD dwStyle = GetWindowLongPtr(g_CLI.hwndContactTree, GWL_STYLE);
Menu_SetChecked(hHideEmptyGroupsMenuItem, (dwStyle & CLS_HIDEEMPTYGROUPS) != 0);
Menu_SetChecked(hDisableGroupsMenuItem, (dwStyle & CLS_USEGROUPS) == 0);
return 0;
@@ -263,7 +263,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
static INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
{
- SendMessage(lParam ? (HWND)lParam : (HWND)cli.hwndContactTree, WM_COMMAND, wParam, 0);
+ SendMessage(lParam ? (HWND)lParam : (HWND)g_CLI.hwndContactTree, WM_COMMAND, wParam, 0);
return 0;
}
diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp
index 0496f63670..26dad6887a 100644
--- a/src/mir_app/src/menu_tray.cpp
+++ b/src/mir_app/src/menu_tray.cpp
@@ -98,7 +98,7 @@ static INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
static INT_PTR ShowHideStub(WPARAM, LPARAM)
{
- return cli.pfnShowHide();
+ return g_CLI.pfnShowHide();
}
void InitTrayMenus(void)
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp
index eb61784393..6852d8a6ee 100644
--- a/src/mir_app/src/meta_addto.cpp
+++ b/src/mir_app/src/meta_addto.cpp
@@ -236,7 +236,7 @@ void CMetaSelectDlg::SortCheck_OnChange(CCtrlCheck*)
INT_PTR Meta_AddTo(WPARAM hContact, LPARAM)
{
CMetaSelectDlg dlg(hContact);
- dlg.SetParent(cli.hwndContactList);
+ dlg.SetParent(g_CLI.hwndContactList);
dlg.DoModal();
return 0;
}
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp
index 9aea3770e0..5558c7da82 100644
--- a/src/mir_app/src/meta_edit.cpp
+++ b/src/mir_app/src/meta_edit.cpp
@@ -446,6 +446,6 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
INT_PTR Meta_Edit(WPARAM wParam, LPARAM)
{
- DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_METAEDIT), cli.hwndContactList, Meta_EditDialogProc, (LPARAM)wParam);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_METAEDIT), g_CLI.hwndContactList, Meta_EditDialogProc, (LPARAM)wParam);
return 0;
}
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 8ddebc8979..f868f1d2e2 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -191,7 +191,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
if (cc->IsMeta()) {
// check from recursion - see second half of this function
if (!bSkipQuestion && IDYES !=
- MessageBox(cli.hwndContactList,
+ MessageBox(g_CLI.hwndContactList,
TranslateT("This will remove the metacontact permanently.\n\nProceed anyway?"),
TranslateT("Are you sure?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2))
return 0;
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 592ca34e2f..f64b95e2f3 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -617,7 +617,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam)
InsertMenuItem(hMenu, i, TRUE, &mii);
}
- UINT res = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_BOTTOMALIGN | TPM_LEFTALIGN, sicd->clickLocation.x, sicd->clickLocation.y, 0, cli.hwndContactTree, nullptr);
+ UINT res = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_BOTTOMALIGN | TPM_LEFTALIGN, sicd->clickLocation.x, sicd->clickLocation.y, 0, g_CLI.hwndContactTree, nullptr);
if (res > 0) {
MCONTACT hChosen = Meta_GetContactHandle(cc, res - 1);
@@ -662,7 +662,7 @@ static VOID CALLBACK sttMenuThread(PVOID param)
TPMPARAMS tpmp = { 0 };
tpmp.cbSize = sizeof(tpmp);
- BOOL menuRet = TrackPopupMenuEx(hMenu, TPM_RETURNCMD, menuMousePoint.x, menuMousePoint.y, cli.hwndContactList, &tpmp);
+ BOOL menuRet = TrackPopupMenuEx(hMenu, TPM_RETURNCMD, menuMousePoint.x, menuMousePoint.y, g_CLI.hwndContactList, &tpmp);
Clist_MenuProcessCommand(LOWORD(menuRet), MPCF_CONTACTMENU, (INT_PTR)param);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index bd5c9da1c5..80b82ab300 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -612,3 +612,4 @@ UnregisterPlugin @633
?addFont@CMPluginBase@@QAEHPAUFontID@@@Z @641 NONAME
?addFont@CMPluginBase@@QAEHPAUFontIDW@@@Z @642 NONAME
?addTTB@CMPluginBase@@QAEPAXPBUTTBButton@@@Z @643 NONAME
+?g_CLI@@3UCLIST_INTERFACE@@A @644 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b7ca7c0fa4..2f15988949 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -612,3 +612,4 @@ UnregisterPlugin @633
?addFont@CMPluginBase@@QEAAHPEAUFontID@@@Z @641 NONAME
?addFont@CMPluginBase@@QEAAHPEAUFontIDW@@@Z @642 NONAME
?addTTB@CMPluginBase@@QEAAPEAXPEBUTTBButton@@@Z @643 NONAME
+?g_CLI@@3UCLIST_INTERFACE@@A @644 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index a3fb7f89c1..d49ebbab17 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -112,8 +112,6 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon
/**** clistmenus.cpp ********************************************************************/
-extern CLIST_INTERFACE cli;
-
extern int hMainMenuObject, hContactMenuObject, hStatusMenuObject;
extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent;
extern HANDLE hShutdownEvent, hPreShutdownEvent;