summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-09-01 15:18:56 +0000
commitc16bd3d58396036f078282ad0b7032562c0c0533 (patch)
tree28a330ad3bd8ba85a20cd2b9a18d5186a0861e66
parent1b9f36054bddeef87d4f9c139877d28c4e6b1702 (diff)
- adaptation for the kernel strdel();
- buffer overrun removed (rare crashes); - old useless code removed; - removal of a blank line after comments was a bad idea git-svn-id: http://svn.miranda-ng.org/main/trunk@15136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/TabSRMM/src/container.cpp9
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp31
-rw-r--r--plugins/TabSRMM/src/mim.cpp6
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp5
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp21
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.h2
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.cpp22
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp9
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp7
-rw-r--r--plugins/TabSRMM/src/themes.cpp35
-rw-r--r--plugins/TabSRMM/src/userprefs.cpp3
-rw-r--r--plugins/TabSRMM/src/utils.cpp205
-rw-r--r--plugins/TabSRMM/src/utils.h2
16 files changed, 244 insertions, 125 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 01a14c266f..7ba28e9fec 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1870,6 +1870,7 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
}
}
+/////////////////////////////////////////////////////////////////////////////////////////
// cut off contact name to the option value set via Options->Tabbed messaging
// some people were requesting this, because really long contact list names
// are causing extraordinary wide tabs and these are looking ugly and wasting
@@ -1877,15 +1878,13 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
//
// size = max length of target string
-int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size)
+int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, size_t size)
{
- size_t cutMax = PluginConfig.m_iTabNameLimit;
-
- if (mir_tstrlen(oldname) <= cutMax)
+ if (mir_tstrlen(oldname) <= PluginConfig.m_iTabNameLimit)
_tcsncpy_s(newname, size, oldname, _TRUNCATE);
else {
TCHAR fmt[30];
- mir_sntprintf(fmt, _T("%%%d.%ds..."), cutMax, cutMax);
+ mir_sntprintf(fmt, _T("%%%d.%ds..."), PluginConfig.m_iTabNameLimit, PluginConfig.m_iTabNameLimit);
mir_sntprintf(newname, size, fmt, oldname);
}
return 0;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 8acc0cc29f..4916bd6264 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -421,7 +421,7 @@ static TCHAR* ShortenPreview(DBEVENTINFO* dbe)
if (iPreviewLimit > 500 || iPreviewLimit == 0)
iPreviewLimit = 500;
- TCHAR* buf = DbGetEventTextT(dbe, CP_ACP);
+ TCHAR *buf = DbGetEventTextT(dbe, CP_ACP);
if (mir_tstrlen(buf) > iPreviewLimit) {
fAddEllipsis = true;
size_t iIndex = iPreviewLimit;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 8e7ad1bcdd..c2e1ff3b5d 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1744,7 +1744,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam)
else
_tcsncpy_s(newcontactname, szNick, _TRUNCATE);
- Utils::DoubleAmpersands(newcontactname);
+ Utils::DoubleAmpersands(newcontactname, _countof(newcontactname));
if (mir_tstrlen(newcontactname) != 0) {
if (PluginConfig.m_bStatusOnTabs)
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 6314e59e0e..5b2cccb984 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -74,6 +74,7 @@ void CInfoPanel::setActive(const int newActive)
/////////////////////////////////////////////////////////////////////////////////////////
// Load height. Private panel height is indicated by 0xffff for the high word
+
void CInfoPanel::loadHeight()
{
BYTE bSync = M.GetByte("syncAllPanels", 0); // sync muc <> im panels
@@ -100,6 +101,7 @@ void CInfoPanel::loadHeight()
// Save current panel height to the database
//
// @param fFlush bool: flush values to database (usually only requested by destructor)
+
void CInfoPanel::saveHeight(bool fFlush)
{
BYTE bSync = M.GetByte("syncAllPanels", 0);
@@ -138,6 +140,7 @@ void CInfoPanel::saveHeight(bool fFlush)
// @param newHeight LONG: the new height.
// @param fBroadcast bool: broadcast the new height to all open sessions, respect
// container's private setting flag.
+
void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast)
{
if (newHeight < MIN_PANELHEIGHT || newHeight > 100)
@@ -219,6 +222,7 @@ void CInfoPanel::showHide() const
// if applicable, local (per contact) override.
//
// @return bool: panel is visible for this session
+
bool CInfoPanel::getVisibility()
{
if (m_dat->hContact == 0) {
@@ -257,6 +261,7 @@ void CInfoPanel::mapRealRectOnTop(const RECT& rcSrc, RECT& rcDest, const SIZE& s
// returns the previosuly selected font
//
// caller should not forget to delete the font!
+
HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig)
{
LOGFONT lf;
@@ -274,6 +279,7 @@ HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig)
// @param rc RECT&: target rectangle
// @param item CSkinItem *: The item to render in non-aero mode
// @param bAero bool: aero active
+
void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, bool fAutoCalc) const
{
if (!m_active)
@@ -319,6 +325,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero,
// message window's WM_SIZE handler).
//
// @param hdc HDC: target device context
+
void CInfoPanel::renderContent(const HDC hdc)
{
if (!m_active)
@@ -373,6 +380,7 @@ void CInfoPanel::renderContent(const HDC hdc)
// @param hdc HDC: target DC for drawing
//
// @param rcItem RECT &: target rectangle
+
void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem)
{
const TCHAR *szStatusMsg = NULL;
@@ -466,6 +474,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem)
//
// @param hdc HDC: device context for drawing.
// @param rcItem RECT &: target rectangle for drawing
+
void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
{
::SetBkMode(hdc, TRANSPARENT);
@@ -516,6 +525,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
/////////////////////////////////////////////////////////////////////////////////////////
// Render the info panel status field. Usually in the 2nd line, right aligned
// @param hdc : target device context
+
void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
{
SIZE sProto = { 0 }, sStatus = { 0 }, sTime = { 0 };
@@ -589,6 +599,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
//
// @param hdc HDC: device context for drawing.
// @param rcItem RECT &: target rectangle for drawing
+
void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
{
SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->si);
@@ -647,6 +658,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
// Draw 2nd line of text in the info panel.
// @param hdc : target device context
// @param rcItem : target rectangle
+
void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
{
SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->si);
@@ -679,6 +691,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
/////////////////////////////////////////////////////////////////////////////////////////
// Invalidate the info panel rectangle
+
void CInfoPanel::Invalidate(BOOL fErase) const
{
if (m_active) {
@@ -692,6 +705,7 @@ void CInfoPanel::Invalidate(BOOL fErase) const
/////////////////////////////////////////////////////////////////////////////////////////
// build the left click contextual menu for the info panel
// @return HMENU: menu handle for the fully prepared menu
+
HMENU CInfoPanel::constructContextualMenu() const
{
MENUITEMINFO mii = { 0 };
@@ -730,6 +744,7 @@ HMENU CInfoPanel::constructContextualMenu() const
//
// @param cmd command id
// @return 0 if command was processed, != 0 otherwise
+
LRESULT CInfoPanel::cmdHandler(UINT cmd)
{
switch (cmd) {
@@ -759,6 +774,7 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd)
// handle mouse clicks on the info panel.
//
// @param pt: mouse cursor pos
+
void CInfoPanel::handleClick(const POINT& pt)
{
if (!m_active || m_hoverFlags == 0)
@@ -786,6 +802,7 @@ void CInfoPanel::handleClick(const POINT& pt)
//
// @param pt POINT (in screen coordinates)
// @return Hit test result or 0 if none applies.
+
int CInfoPanel::hitTest(POINT pt)
{
::ScreenToClient(m_dat->hwnd, &pt);
@@ -805,6 +822,7 @@ int CInfoPanel::hitTest(POINT pt)
// and to hover the info panel fields.
//
// @param pt : mouse coordinates (screen)
+
void CInfoPanel::trackMouse(POINT &pt)
{
if (!m_active)
@@ -848,6 +866,7 @@ void CInfoPanel::trackMouse(POINT &pt)
// activate a tooltip
// @param ctrlId : control id
// @param lParam : typically a TCHAR * for the tooltip text
+
void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
{
if (!m_active || !m_dat->hwndTip)
@@ -921,6 +940,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
// this is only used from outside (i.e. container window dialog)
//
// hwndNew = window to become active (as reported by WM_ACTIVATE).
+
void CInfoPanel::hideTip(const HWND hwndNew)
{
if (m_tip) {
@@ -937,6 +957,7 @@ void CInfoPanel::hideTip(const HWND hwndNew)
// (ACC window class). Only required when support for animated avatars is enabled because
// native avatar rendering does not support animated images.
// To avoid clipping issues, this is done during WM_ERASEBKGND.
+
LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1014,6 +1035,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP
// our userdata. Real processing is done by ConfigDlgProc()
//
// @params Like a normal dialog procedure
+
INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CInfoPanel *infoPanel = reinterpret_cast<CInfoPanel *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
@@ -1032,6 +1054,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wPara
/////////////////////////////////////////////////////////////////////////////////////////
// dialog procedure for the info panel config popup
+
INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1219,6 +1242,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
// invoke info panel config popup dialog
// @param pt : mouse coordinates (screen)
// @return : always 0
+
int CInfoPanel::invokeConfigDialog(const POINT &pt)
{
if (!m_active)
@@ -1257,6 +1281,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt)
// remove the info panel configuration dialog
// @param fForced: bool, if true, dismiss it under any circumstances, even
// with the pointer still inside the dialog.
+
void CInfoPanel::dismissConfig(bool fForced)
{
if (m_hwndConfig == 0)
@@ -1283,6 +1308,7 @@ void CInfoPanel::dismissConfig(bool fForced)
// @param hContact HANDLE contact handle
// @param pszText TCHAR* the content of the rich edit control
// @param panel CInfoPanel* the panel which owns it
+
CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText, const CInfoPanel* panel)
{
m_hwnd = ::CreateWindowEx(WS_EX_TOOLWINDOW, _T("RichEditTipClass"), _T(""), (M.isAero() ? WS_THICKFRAME : WS_BORDER) | WS_POPUPWINDOW | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
@@ -1312,6 +1338,7 @@ CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText,
// @param pt point in screen coordinates
// @param hIcon optional icon to display in the tip header
// @param szTitle optional title to display in the tip header
+
void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const TCHAR *szTitle)
{
HDC hdc = ::GetDC(m_hwnd);
@@ -1384,6 +1411,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const TCHAR *szTit
/////////////////////////////////////////////////////////////////////////////////////////
// register richedit tooltip window class
+
void CTip::registerClass()
{
WNDCLASSEX wc = { 0 };
@@ -1399,6 +1427,7 @@ void CTip::registerClass()
/////////////////////////////////////////////////////////////////////////////////////////
// subclass the rich edit control inside the tip. Needed to hide the blinking
// caret and prevent all scrolling actions.
+
LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1424,6 +1453,7 @@ LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
/////////////////////////////////////////////////////////////////////////////////////////
// stub for the tip control window procedure. Just handle WM_CREATE and set the
// this pointer.
+
LRESULT CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CTip *tip = reinterpret_cast<CTip *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
@@ -1440,6 +1470,7 @@ LRESULT CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
/////////////////////////////////////////////////////////////////////////////////////////
// the window procedure for the tooltip window.
+
INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
POINT pt;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 0b9ddfe22d..0672bb15f9 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -53,6 +53,7 @@ bool CMimAPI::m_haveBufferedPaint = false;
/////////////////////////////////////////////////////////////////////////////////////////
// window list functions
+
void CMimAPI::BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam)
{
WindowList_Broadcast(m_hMessageWindowList, msg, wParam, lParam);
@@ -182,6 +183,7 @@ bool CMimAPI::getAeroState()
/////////////////////////////////////////////////////////////////////////////////////////
// Initialize various Win32 API functions which are not common to all versions of Windows.
// We have to work with functions pointers here.
+
void CMimAPI::InitAPI()
{
DWORD dwVer = LOWORD(GetVersion());
@@ -226,6 +228,7 @@ void CMimAPI::InitAPI()
/////////////////////////////////////////////////////////////////////////////////////////
// hook subscriber function for incoming message typing events
+
int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode)
{
int foundWin = 0, preTyping = 0;
@@ -328,6 +331,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode)
// it to the owners window
//
// ACKTYPE_AVATAR no longer handled here, because we have avs services now.
+
int CMimAPI::ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *pAck = (ACKDATA*)lParam;
@@ -383,6 +387,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM hContact, LPARAM)
//
// this handler POSTs the event to the message window procedure - so it is fast and can exit quickly which will
// improve the overall responsiveness when receiving messages.
+
int CMimAPI::DispatchNewEvent(WPARAM hContact, LPARAM hDbEvent)
{
if (hContact) {
@@ -402,6 +407,7 @@ int CMimAPI::DispatchNewEvent(WPARAM hContact, LPARAM hDbEvent)
// session(tab) must be created.
//
// if a session is already created, it just does nothing and DispatchNewEvent() will take care.
+
int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
TCHAR szName[CONTAINER_NAMELEN + 1];
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index a69d9e87e8..e5b790f142 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -79,6 +79,7 @@ static void _clrMsgFilter(LPARAM lParam)
// @param idFrom dlg ctrl id
// @param hwndFrom src window handle
// @param pt mouse pointer position
+
static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt)
{
CHARRANGE sel, all = { 0, -1 };
@@ -213,6 +214,7 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
/////////////////////////////////////////////////////////////////////////////////////////
// sublassing procedure for the h++ based message log viewer
+
LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TWindowData *mwdat = (TWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
@@ -250,6 +252,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
//
// it protects itself from being called more than once per session activation and is valid for
// normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c)
+
static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
{
if (dat == NULL || dat->iTabID < 0)
@@ -768,6 +771,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
/////////////////////////////////////////////////////////////////////////////////////////
// subclasses the avatar display controls, needed for skinning and to prevent
// it from flickering during resize/move operations.
+
static LRESULT CALLBACK AvatarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -933,6 +937,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
/////////////////////////////////////////////////////////////////////////////////////////
// resizer proc for the "new" layout.
+
static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
{
TWindowData *dat = (TWindowData*)lParam;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index fa6753fd89..9c3abb9c2b 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -70,6 +70,7 @@ bool TSAPI IsCustomEvent(int eventType)
// reorder tabs within a container. fSavePos indicates whether the new position should
// be saved to the contacts db record (if so, the container will try to open the tab
// at the saved position later)
+
void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fSavePos)
{
if (dat == NULL || !IsWindow(hwndDlg))
@@ -99,6 +100,7 @@ void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fS
/////////////////////////////////////////////////////////////////////////////////////////
// subclassing for the save as file dialog (needed to set it to thumbnail view on Windows 2000
// or later
+
static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
switch (msg) {
@@ -124,6 +126,7 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP
// saves a contact picture to disk
// takes hbm (bitmap handle) and bool isOwnPic (1 == save the picture as your own avatar)
// requires AVS and ADVAIMG services (Miranda 0.7+)
+
static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic)
{
TCHAR szFinalFilename[MAX_PATH];
@@ -191,6 +194,7 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic)
/////////////////////////////////////////////////////////////////////////////////////////
// flash a tab icon if mode = true, otherwise restore default icon
// store flashing state into bState
+
void TSAPI FlashTab(TWindowData *dat, HWND hwndTab, int iTabindex, BOOL *bState, BOOL mode, HICON origImage)
{
if (mode)
@@ -208,6 +212,7 @@ void TSAPI FlashTab(TWindowData *dat, HWND hwndTab, int iTabindex, BOOL *bState,
/////////////////////////////////////////////////////////////////////////////////////////
// calculates avatar layouting, based on splitter position to find the optimal size
// for the avatar w/o disturbing the toolbar too much.
+
void TSAPI CalcDynamicAvatarSize(TWindowData *dat, BITMAP *bminfo)
{
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE || dat->pContainer->dwFlags & CNT_DEFERREDCONFIGURE || dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED || IsIconic(dat->pContainer->hwnd))
@@ -415,6 +420,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
/////////////////////////////////////////////////////////////////////////////////////////
// update the status bar field which displays the number of characters in the input area
// and various indicators (caps lock, num lock, insert mode).
+
void TSAPI UpdateReadChars(const TWindowData *dat)
{
if (dat && (dat->pContainer->hwndStatus && dat->pContainer->hwndActive == dat->hwnd)) {
@@ -454,6 +460,7 @@ void TSAPI UpdateReadChars(const TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// update all status bar fields and force a redraw of the status bar.
+
void TSAPI UpdateStatusBar(const TWindowData *dat)
{
if (dat && dat->pContainer->hwndStatus && dat->pContainer->hwndActive == dat->hwnd) {
@@ -490,6 +497,7 @@ void TSAPI UpdateStatusBar(const TWindowData *dat)
//
// NOT used for typing notification feedback as this is handled directly from the
// MTN handler.
+
void TSAPI HandleIconFeedback(TWindowData *dat, HICON iIcon)
{
TCITEM item = { 0 };
@@ -512,6 +520,7 @@ void TSAPI HandleIconFeedback(TWindowData *dat, HICON iIcon)
/////////////////////////////////////////////////////////////////////////////////////////
// catches notifications from the AVS controls
+
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam)
{
if (((LPNMHDR)lParam)->code == NM_AVATAR_CHANGED) {
@@ -532,6 +541,7 @@ void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// retrieve the visiblity of the avatar window, depending on the global setting
// and local mode
+
bool TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat)
{
BYTE bAvatarMode = dat->pContainer->avatarMode;
@@ -617,6 +627,7 @@ bool TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// checks, if there is a valid smileypack installed for the given protocol
+
int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact)
{
if (!PluginConfig.g_SmileyAddAvail)
@@ -634,6 +645,7 @@ int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact)
/////////////////////////////////////////////////////////////////////////////////////////
// return value MUST be mir_free()'d by caller.
+
TCHAR* TSAPI QuoteText(const TCHAR *text)
{
int outChar, lineChar;
@@ -777,6 +789,7 @@ void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, MEVENT hEvent, DBEVENTIN
// typed message before sending it.
// caller must mir_free the returned pointer.
// UNICODE version returns UTF-8 encoded string.
+
static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
static DWORD dwRead;
@@ -867,6 +880,7 @@ static int GetRtfIndex(int iCol, int iCount, int *pIndex)
/////////////////////////////////////////////////////////////////////////////////////////
// convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting
// tags and return plain text
+
BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors, COLORREF *pColors)
{
if (pszText.IsEmpty())
@@ -1020,6 +1034,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors
/////////////////////////////////////////////////////////////////////////////////////////
// retrieve both buddys and my own UIN for a message session and store them in the message window *dat
// respects metacontacts and uses the current protocol if the contact is a MC
+
void TSAPI GetMYUIN(TWindowData *dat)
{
CONTACTINFO ci = { sizeof(ci) };
@@ -1226,6 +1241,7 @@ void TSAPI PlayIncomingSound(const TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// reads send format and configures the toolbar buttons
// if mode == 0, int only configures the buttons and does not change send format
+
void TSAPI GetSendFormat(TWindowData *dat)
{
UINT controls[5] = { IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTSTRIKEOUT, IDC_FONTFACE };
@@ -1246,6 +1262,7 @@ void TSAPI GetSendFormat(TWindowData *dat)
// keyboard layout.
//
// GetLocaleInfo() should no longer be used on Vista and later
+
void TSAPI GetLocaleID(TWindowData *dat, const TCHAR *szKLName)
{
TCHAR szLI[256], *stopped = NULL;
@@ -1387,6 +1404,7 @@ void TSAPI HandlePasteAndSend(const TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// draw various elements of the message window, like avatar(s), info panel fields
// and the color formatting menu
+
int TSAPI MsgWindowDrawHandler(WPARAM, LPARAM lParam, TWindowData *dat)
{
if (!dat)
@@ -1773,6 +1791,7 @@ HICON TSAPI MY_GetContactIcon(const TWindowData *dat, LPCSTR szSetting)
/////////////////////////////////////////////////////////////////////////////////////////
// read keyboard state and return the state of the modifier keys
+
void TSAPI KbdState(TWindowData *dat, BOOL& isShift, BOOL& isControl, BOOL& isAlt)
{
GetKeyboardState(dat->kstate);
@@ -1784,6 +1803,7 @@ void TSAPI KbdState(TWindowData *dat, BOOL& isShift, BOOL& isControl, BOOL& isAl
/////////////////////////////////////////////////////////////////////////////////////////
// clear the message log
// code needs to distuingish between IM and MUC sessions.
+
void TSAPI ClearLog(TWindowData *dat)
{
if (dat && dat->bType == SESSIONTYPE_IM) {
@@ -1828,6 +1848,7 @@ void TSAPI ClearLog(TWindowData *dat)
//
// the container will use this in its WM_GETMINMAXINFO handler to set
// minimum tracking height.
+
void TSAPI DetermineMinHeight(TWindowData *dat)
{
if (!dat)
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h
index 35ca213d64..f34850e91c 100644
--- a/plugins/TabSRMM/src/msgdlgutils.h
+++ b/plugins/TabSRMM/src/msgdlgutils.h
@@ -64,7 +64,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat
void TSAPI LoadOverrideTheme(TContainerData *pContainer);
void TSAPI LoadThemeDefaults(TContainerData *pContainer);
void TSAPI ConfigureSmileyButton(TWindowData *dat);
-int TSAPI CutContactName(const TCHAR *szold, TCHAR *sznew, unsigned int size);
+int TSAPI CutContactName(const TCHAR *szold, TCHAR *sznew, size_t size);
void TSAPI SendNudge(const TWindowData *dat);
void TSAPI EnableSendButton(const TWindowData *dat, int iMode);
LRESULT TSAPI GetSendButtonState(HWND hwnd);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index e62592ec27..5a64fc8f05 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -92,6 +92,7 @@ static HWND hwndTabConfig = 0;
// will be used as the name of the skin.
//
// [Global]/Name property is new in TabSRMM version 3.
+
static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
{
bool fValid = false;
@@ -143,6 +144,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
//
// By default, $SKINS_ROOT is set to %miranda_userdata% or custom folder
// selected by the folders plugin.
+
static int TSAPI RescanSkins(HWND hwndCombobox)
{
DBVARIANT dbv = { 0 };
@@ -189,6 +191,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox)
/////////////////////////////////////////////////////////////////////////////////////////
// mir_free the item extra data (used to store the skin filenames for each entry).
+
static void TSAPI FreeComboData(HWND hwndCombobox)
{
LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
@@ -204,6 +207,7 @@ static void TSAPI FreeComboData(HWND hwndCombobox)
/////////////////////////////////////////////////////////////////////////////////////////
// controls to disable when loading or unloading a skin is not possible (because
// of at least one message window being open).
+
static UINT _ctrls[] = { IDC_SKINNAME, IDC_RESCANSKIN, IDC_RESCANSKIN, IDC_RELOADSKIN, 0 };
static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -378,6 +382,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
/////////////////////////////////////////////////////////////////////////////////////////
+
void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem)
{
TVINSERTSTRUCT tvi = { 0 };
@@ -832,6 +837,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
/////////////////////////////////////////////////////////////////////////////////////////
// typing notify options
+
static void ResetCList(HWND hwndDlg)
{
if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !M.GetByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
@@ -985,6 +991,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam
/////////////////////////////////////////////////////////////////////////////////////////
// options for tabbed messaging got their own page.. finally :)
+
static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1062,6 +1069,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar
/////////////////////////////////////////////////////////////////////////////////////////
// container options
+
static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 48954f3a24..4f22af20e5 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -41,6 +41,7 @@ void Chat_AddIcons(void);
/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes IEView plugin options. Apply them to all open tabs
+
int IEViewOptionsChanged(WPARAM, LPARAM)
{
M.BroadcastMessage(DM_IEVIEWOPTIONSCHANGED, 0, 0);
@@ -49,6 +50,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes smileyadd options. Notify all open tabs about the changes
+
int SmileyAddOptionsChanged(WPARAM, LPARAM)
{
M.BroadcastMessage(DM_SMILEYOPTIONSCHANGED, 0, 0);
@@ -58,6 +60,7 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// Message API 0.0.0.3 services
+
static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
{
char *szBuf = (char*)wParam;
@@ -70,6 +73,7 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
// wparam = (MessageWindowInputData*)
// lparam = (MessageWindowData*)
// returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
+
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
@@ -112,6 +116,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
+
static void SetStatusTextWorker(TWindowData *dat, StatusTextData *st)
{
if (!dat)
@@ -148,6 +153,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// service function. Invoke the user preferences dialog for the contact given (by handle) in wParam
+
static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
{
HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, wParam);
@@ -161,6 +167,7 @@ static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// service function - open the tray menu from the TTB button
+
static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
{
SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, lParam == 0 ? WM_LBUTTONUP : WM_RBUTTONUP);
@@ -172,6 +179,7 @@ static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
// wParam == hContact of the window to find
// lParam == window handle (set it to 0 if you want search for hcontact, otherwise it
// is directly used as the handle for the target window
+
static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam)
{
HWND hwndTarget = (HWND)lParam;
@@ -187,6 +195,7 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// return the version of the window api supported
+
static INT_PTR GetWindowAPI(WPARAM, LPARAM)
{
return PLUGIN_MAKE_VERSION(0, 0, 0, 2);
@@ -203,6 +212,7 @@ static INT_PTR GetWindowAPI(WPARAM, LPARAM)
// or (if lParam was specified) the hwnd if the window exists.
// 0 if there is none (or the popup mode of the target container was configured to "hide"
// the window..
+
INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
{
HWND hwnd = 0;
@@ -242,6 +252,7 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
// ReadMessageCommand is executed whenever the user wants to manually open a window.
// This can happen when double clicking a contact on the clist OR when opening a new
// message (clicking on a popup, clicking the flashing tray icon and so on).
+
static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
{
MCONTACT hContact = ((CLISTEVENT *)lParam)->hContact;
@@ -266,6 +277,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
// e.g. it is called when user double clicks a contact on the contact list
// it is implemented as a service, so external plugins can use it to open a message window.
// contacts handle must be passed in wParam.
+
INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar)
{
// make sure that only the main UI thread will handle window creation
@@ -323,6 +335,7 @@ INT_PTR SendMessageCommand_W(WPARAM hContact, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// open a window when user clicks on the flashing "typing message" tray icon.
// just calls SendMessageCommand() for the given contact.
+
static INT_PTR TypingMessageCommand(WPARAM, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
@@ -382,6 +395,7 @@ int MyAvatarChanged(WPARAM wParam, LPARAM lParam)
//
// this function searches and activates the tab belonging to the given hwnd (which is the
// hwnd of a message dialog window)
+
int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndChild, GWLP_USERDATA); // needed to obtain the hContact for the message window
@@ -430,6 +444,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
// this function creates and activates a new tab within the given container.
// bActivateTab: make the new tab the active one
// bPopupContainer: restore container if it was minimized, otherwise flash it...
+
HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, MEVENT hdbEvent)
{
if (M.FindWindow(hContact) != 0) {
@@ -462,7 +477,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
else
_tcsncpy_s(newcontactname, contactName, _TRUNCATE);
- Utils::DoubleAmpersands(newcontactname);
+ Utils::DoubleAmpersands(newcontactname, _countof(newcontactname));
}
else _tcsncpy_s(newcontactname, _T("_U_"), _TRUNCATE);
@@ -582,6 +597,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
// this is used by the 2nd containermode (limit tabs on default containers).
// it searches a container with "room" for the new tabs or otherwise creates
// a new (cloned) one.
+
TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName)
{
int iMaxTabs = M.GetDword("maxtabs", 0);
@@ -598,6 +614,7 @@ TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName)
/////////////////////////////////////////////////////////////////////////////////////////
// load some global icons.
+
void TSAPI CreateImageList(BOOL bInitial)
{
// the imagelist is now a fake. It is still needed to provide the tab control with a
@@ -758,6 +775,7 @@ static int GetIconPackVersion(HMODULE hDLL)
/////////////////////////////////////////////////////////////////////////////////////////
// setup default icons for the IcoLib service. This needs to be done every time the
// plugin is loaded default icons are taken from the icon pack in either \icons or \plugins
+
static int TSAPI SetupIconLibConfig()
{
int j = 2, version = 0;
@@ -846,6 +864,7 @@ static int TSAPI LoadFromIconLib()
/////////////////////////////////////////////////////////////////////////////////////////
// load icon theme from either icon pack or IcoLib
+
void TSAPI LoadIconTheme()
{
if (SetupIconLibConfig() == 0)
@@ -893,6 +912,7 @@ int IconsChanged(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// initialises the internal API, services, events etc...
+
static void TSAPI InitAPI()
{
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 452b3faaf1..dc6407bf1d 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -34,6 +34,7 @@ SendQueue *sendQueue = 0;
// searches the queue for a message belonging to the given contact which has been marked
// as "failed" by either the ACKRESULT_FAILED or a timeout handler
// returns: zero-based queue index or -1 if none was found
+
int SendQueue::findNextFailed(const TWindowData *dat) const
{
if (dat)
@@ -61,6 +62,7 @@ void SendQueue::handleError(TWindowData *dat, const int iEntry) const
/////////////////////////////////////////////////////////////////////////////////////////
//add a message to the sending queue.
// iLen = required size of the memory block to hold the message
+
int SendQueue::addTo(TWindowData *dat, size_t iLen, int dwFlags)
{
int i;
@@ -176,6 +178,7 @@ static void DoSplitSendA(LPVOID param)
/////////////////////////////////////////////////////////////////////////////////////////
// return effective length of the message in bytes (utf-8 encoded)
+
size_t SendQueue::getSendLength(const int iEntry)
{
SendJob &p = m_jobs[iEntry];
@@ -317,6 +320,7 @@ void SendQueue::clearJob(const int iIndex)
// ) a delivery has completed successfully
// ) user decided to cancel a failed send
// it removes the completed / canceled send job from the queue and schedules the next job to send (if any)
+
void SendQueue::checkQueue(const TWindowData *dat) const
{
if (dat) {
@@ -335,6 +339,7 @@ void SendQueue::checkQueue(const TWindowData *dat) const
/////////////////////////////////////////////////////////////////////////////////////////
// logs an error message to the message window.Optionally, appends the original message
// from the given sendJob (queue index)
+
void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const TCHAR *szErrMsg) const
{
if (dat == 0)
@@ -364,6 +369,7 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const TCHAR
// ) input area
// ) multisend contact list instance
// ) send button
+
void SendQueue::EnableSending(const TWindowData *dat, const int iMode)
{
if (dat) {
@@ -376,6 +382,7 @@ void SendQueue::EnableSending(const TWindowData *dat, const int iMode)
/////////////////////////////////////////////////////////////////////////////////////////
// show or hide the error control button bar on top of the window
+
void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const
{
UINT myerrorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
@@ -480,6 +487,7 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// searches string for characters typical for RTL text(hebrew and other RTL languages
+
int SendQueue::RTL_Detect(const WCHAR *pszwText)
{
int i, n = 0;
@@ -625,6 +633,7 @@ LRESULT SendQueue::WarnPendingJobs(unsigned int)
// hContact : contact to which the job should be added (default = hOwner of the send job)
//
// @return the index on success, -1 on failure
+
int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, bool fIsSendLater)
{
bool fAvail = sendLater->isAvail();
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index f693c3ee92..0e0cdc68c0 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -78,6 +78,7 @@ static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, P
/////////////////////////////////////////////////////////////////////////////////////////
// tabctrl helper function
// Finds leftmost down item.
+
static UINT FindLeftDownItem(HWND hwnd)
{
RECT rctLeft = { 100000, 0, 0, 0 }, rctCur;
@@ -98,6 +99,7 @@ static UINT FindLeftDownItem(HWND hwnd)
/////////////////////////////////////////////////////////////////////////////////////////
// tab control color definitions, including the database setting key names
+
static struct colOptions
{
UINT defclr;
@@ -117,6 +119,7 @@ static struct colOptions
/////////////////////////////////////////////////////////////////////////////////////////
// hints for drawing functions
+
#define HINT_ACTIVATE_RIGHT_SIDE 1
#define HINT_ACTIVE_ITEM 2
#define FLOAT_ITEM_HEIGHT_SHIFT 2
@@ -156,6 +159,7 @@ void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat
// it obtains the label and icon handle directly from the message window data
// no image list is used and necessary, the message window dialog procedure has to provide a valid
// icon handle in dat->hTabIcon
+
static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int nItem, TWindowData *dat)
{
if (dat == NULL)
@@ -1305,6 +1309,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
/////////////////////////////////////////////////////////////////////////////////////////
// load the tab control configuration data (colors, fonts, flags...
+
void TSAPI ReloadTabConfig()
{
PluginConfig.tabConfig.m_hPenLight = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
@@ -1355,6 +1360,7 @@ static bool tconfig_init = false;
/////////////////////////////////////////////////////////////////////////////////////////
// options dialog for setting up tab options
+
INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -1454,6 +1460,7 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
/////////////////////////////////////////////////////////////////////////////////////////
// register the new tab control as a window class (TSTabCtrlClass)
+
int TSAPI RegisterTabCtrlClass(void)
{
WNDCLASSEX wc = { 0 };
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index ba9625a4ab..6cefdcfa98 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -619,6 +619,7 @@ void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ub
// @param rc RECT *: client rectangle inside the target DC.
// @param fIgnoreGlyph: bool: will ignore any glyph item. Set it to true when
// using this function from _outside_ a skin
+
void __fastcall CImageItem::Render(const HDC hdc, const RECT *rc, bool fIgnoreGlyph) const
{
BYTE l = m_bLeft, r = m_bRight, t = m_bTop, b = m_bBottom;
@@ -793,6 +794,7 @@ void CImageItem::Create(const TCHAR *szImageFile)
//
// @return char*: full path and filename to the .png image which represents this image item.
// caller MUST delete it.
+
TCHAR* CImageItem::Read(const TCHAR *szFilename)
{
TCHAR buffer[501];
@@ -882,6 +884,7 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename)
/////////////////////////////////////////////////////////////////////////////////////////
// Free all resources allocated by an image item
+
void CImageItem::Free()
{
if (m_hdc) {
@@ -903,6 +906,7 @@ void CImageItem::Free()
// @param hBitmap bitmap handle
// @param bAlpha new alpha value (0 -> fully transparent, 255 -> opaque)
// default value is 255
+
void CImageItem::SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha)
{
BITMAP bmp;
@@ -994,6 +998,7 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha
/////////////////////////////////////////////////////////////////////////////////////////
// load PNG image using core service(advaimg)
+
HBITMAP TSAPI CImageItem::LoadPNG(const TCHAR *szFilename)
{
HBITMAP hBitmap = 0;
@@ -1006,6 +1011,7 @@ HBITMAP TSAPI CImageItem::LoadPNG(const TCHAR *szFilename)
// called on:
// ) init
// ) manual loading on user's request
+
void CSkin::setFileName()
{
DBVARIANT dbv;
@@ -1021,6 +1027,7 @@ void CSkin::setFileName()
/////////////////////////////////////////////////////////////////////////////////////////
// initialize the skin object
+
void CSkin::Init(bool fStartup)
{
m_ImageItems = 0;
@@ -1046,6 +1053,7 @@ void CSkin::Init(bool fStartup)
// throws a warning to close all message windows before a skin can
// be loaded. user can cancel it
// @return: bool: true if windows were closed (or none was open) -> skin can be loaded
+
bool CSkin::warnToClose() const
{
if (::pFirstContainer == NULL)
@@ -1064,6 +1072,7 @@ bool CSkin::warnToClose() const
// mir_free the aero tab bitmaps
// only called on exit, NOT when a skin is unloaded as these elements
// are always needed (even without a skin)
+
void CSkin::UnloadAeroTabs()
{
if (m_tabTop) {
@@ -1097,6 +1106,7 @@ void CSkin::UnloadAeroTabs()
// Called when:
// * user unloads the skin from the dialog box
// * a new skin is loaded by user's request.
+
void CSkin::Unload()
{
// do nothing when user decides to not close any window
@@ -1213,6 +1223,7 @@ void CSkin::LoadIcon(const TCHAR *szSection, const TCHAR *name, HICON &hIcon)
// @param id int: zero-based index into the table of predefined skin items
// @param szItem char *: the section name in the ini file which holds the definition for this
// item.
+
void CSkin::ReadItem(const int id, const TCHAR *szItem)
{
TCHAR buffer[512];
@@ -1279,6 +1290,7 @@ void CSkin::ReadItem(const int id, const TCHAR *szItem)
// The real work is done by the CImageItem::Read().
//
// @param itemname char *: image item name, also section name in the .tsk file
+
void CSkin::ReadImageItem(const TCHAR *itemname)
{
TCHAR buffer[512], szItemNr[30];
@@ -1340,6 +1352,7 @@ void CSkin::ReadImageItem(const TCHAR *itemname)
// It reads and initializes all static values for the skin. Afterwards
// it calls ReadItems() to read additional skin information like image items,
// buttons and icons.
+
void CSkin::Load(void)
{
if (warnToClose() == false)
@@ -1507,6 +1520,7 @@ void CSkin::Load(void)
/////////////////////////////////////////////////////////////////////////////////////////
// Load additional skin items (like image items, buttons, icons etc.)
// This is called AFTER ReadItems() has read the basic skin items
+
void CSkin::LoadItems()
{
TCHAR *szSections = NULL;
@@ -1574,6 +1588,7 @@ void CSkin::LoadItems()
// ) icons change (via ico lib service)
//
// @param fDeleteOnly: only delete GDI resources (this is ONLY used at plugin shutdown)
+
void CSkin::setupTabCloseBitmap(bool fDeleteOnly)
{
if (m_tabCloseHDC || fDeleteOnly) {
@@ -1642,6 +1657,7 @@ void CSkin::setupTabCloseBitmap(bool fDeleteOnly)
// ) dwm mode changes
// ) aero effect is changed by the user
// ) glow colorization is changed by user's request
+
void CSkin::setupAeroSkins()
{
M.getAeroState();
@@ -1812,6 +1828,7 @@ void CSkin::setupAeroSkins()
/////////////////////////////////////////////////////////////////////////////////////////
// Calculate window frame borders for a skin with the ability to paint the window frame.
// Uses system metrics to determine predefined window borders and caption bar size.
+
void CSkin::SkinCalcFrameWidth()
{
int xBorder = GetSystemMetrics(SM_CXSIZEFRAME);
@@ -1832,6 +1849,7 @@ void CSkin::SkinCalcFrameWidth()
// @param pContainer ContainerWindowData *: needed to access the cached DC of the container window
// @param rcClient RECT *: client rectangle (target area)
// @param hdcTarget HDC: device context of the target window
+
void CSkin::SkinDrawBG(HWND hwndClient, HWND hwnd, TContainerData *pContainer, RECT *rcClient, HDC hdcTarget)
{
RECT rcWindow;
@@ -1864,6 +1882,7 @@ void CSkin::SkinDrawBG(HWND hwndClient, HWND hwnd, TContainerData *pContainer, R
// @param pContainer ContainerWindowData *: needed to access the cached DC of the container window
// @param rcClient RECT *: client rectangle (target area)
// @param hdcTarget HDC: device context of the target window
+
void CSkin::SkinDrawBGFromDC(HWND hwndClient, HWND hwnd, RECT *rcClient, HDC hdcTarget)
{
RECT rcWindow;
@@ -1882,6 +1901,7 @@ void CSkin::SkinDrawBGFromDC(HWND hwndClient, HWND hwnd, RECT *rcClient, HDC hdc
/////////////////////////////////////////////////////////////////////////////////////////
// draw an icon "Dimmed" (small amount of transparency applied)
+
void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON hIcon, BYTE alpha)
{
HDC dcMem = ::CreateCompatibleDC(hdc);
@@ -1947,6 +1967,7 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID
/////////////////////////////////////////////////////////////////////////////////////////
// process WM_NCPAINT for the rich edit control. Draws a visual style border and avoid
// classic static edge / client edge may also draw a colorized border around the control
+
UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
{
// do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
@@ -2018,6 +2039,7 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID,
// "f3e355"
//
// @return COLORREF representation of the string value.
+
DWORD __fastcall CSkin::HexStringToLong(const TCHAR *szSource)
{
TCHAR *stopped;
@@ -2030,6 +2052,7 @@ DWORD __fastcall CSkin::HexStringToLong(const TCHAR *szSource)
/////////////////////////////////////////////////////////////////////////////////////////
// Render text to the given HDC. This function is aero aware and will use uxtheme DrawThemeTextEx() when needed.
// Paramaters are pretty much comparable to GDI DrawText() API
+
int CSkin::RenderText(HDC hdc, HANDLE hTheme, const TCHAR *szText, RECT *rc, DWORD dtFlags, const int iGlowSize, COLORREF clr, bool fForceAero)
{
if ((PluginConfig.m_bIsVista && !CSkin::m_skinEnabled && hTheme) || fForceAero) {
@@ -2063,6 +2086,7 @@ int CSkin::RenderText(HDC hdc, HANDLE hTheme, const TCHAR *szText, RECT *rc, DWO
//bitmap should be freed.
//
// @return HBTIAMP: handle to a bitmap with the desired size.
+
HBITMAP CSkin::ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &mustFree)
{
BITMAP bm;
@@ -2096,6 +2120,7 @@ HBITMAP CSkin::ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &must
//
// @return bool: true if the item has been painted, false if not
// (only reason: the ignore flag in the item is set).
+
bool __fastcall CSkin::DrawItem(const HDC hdc, const RECT *rc, const CSkinItem *item)
{
if (!item->IGNORED) {
@@ -2117,6 +2142,7 @@ bool __fastcall CSkin::DrawItem(const HDC hdc, const RECT *rc, const CSkinItem *
// @param dc The device context for which the bitmap should be created.
//
// @return HBITMAP: handle to the bitmap created.
+
HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc)
{
BITMAPINFO dib = { 0 };
@@ -2140,6 +2166,7 @@ HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc)
// @param rc RECT &: Rectangular area within the client area of hwndClient.
//
//It will receive the transformed coordinates, relative to the client area of hwndParent
+
void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc)
{
POINT pt;
@@ -2164,6 +2191,7 @@ void CSkin::MapClientToParent(HWND hwndClient, HWND hwndParent, RECT &rc)
//
// @param hdc HDC: handle to the device context in which painting should occur.
// @param rcWindow RECT &: The window rectangle of the message dialog window
+
void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindow)
{
if (dat) {
@@ -2259,6 +2287,7 @@ void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindo
// @param hdcSrc The source device context (usually obtained by BeginPaint())
// @param rc RECT&: the target rectangle that receives the painting
// @param hdcOut HDC& (out) receives the buffered device context handle
+
HANDLE CSkin::InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut)
{
return CMimAPI::m_pfnBeginBufferedPaint(hdcSrc, &rc, BPBF_TOPDOWNDIB, NULL, &hdcOut);
@@ -2269,6 +2298,7 @@ HANDLE CSkin::InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut)
//
// @param hbp HANDLE: handle of the buffered paint context
// @param rc RECT*: target rectangly where alpha value should be applied
+
void CSkin::FinalizeBufferedPaint(HANDLE hbp, RECT *rc)
{
if (m_pCurrentAeroEffect && m_pCurrentAeroEffect->m_finalAlpha > 0)
@@ -2289,6 +2319,7 @@ void CSkin::FinalizeBufferedPaint(HANDLE hbp, RECT *rc)
// @param hbp HANDLE: handle to a buffered paint identifier.
// default is none, needed forsome special
// effects. default paramenter is 0
+
void CSkin::ApplyAeroEffect(const HDC hdc, const RECT *rc, int iEffectArea)
{
if (m_pCurrentAeroEffect == 0 || m_aeroEffect == AERO_EFFECT_NONE)
@@ -2300,6 +2331,7 @@ void CSkin::ApplyAeroEffect(const HDC hdc, const RECT *rc, int iEffectArea)
/////////////////////////////////////////////////////////////////////////////////////////
// aero effect callbacks
+
void CSkin::AeroEffectCallback_Milk(const HDC hdc, const RECT *rc, int iEffectArea)
{
if (iEffectArea < 0x1000) {
@@ -2402,6 +2434,7 @@ void CSkin::setAeroEffect(LRESULT effect)
// extract the aero skin images from the DLL and store them in
// the private data folder.
// runs at every startup
+
void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
{
TCHAR tszBasePath[MAX_PATH];
@@ -2420,6 +2453,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
/////////////////////////////////////////////////////////////////////////////////////////
// redraw the splitter area between the message input and message log area only
+
void CSkin::UpdateToolbarBG(TWindowData *dat)
{
if (dat == NULL)
@@ -2453,6 +2487,7 @@ void CSkin::UpdateToolbarBG(TWindowData *dat)
//
// @param hdc: device context
// @param rc: area to fill.
+
void CSkin::FillBack(const HDC hdc, RECT* rc)
{
if (0 == CSkin::m_BrushFill) {
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp
index 417c88cc4a..5bea94fead 100644
--- a/plugins/TabSRMM/src/userprefs.cpp
+++ b/plugins/TabSRMM/src/userprefs.cpp
@@ -271,6 +271,7 @@ checkboxes[] = {
//
// ALWAYS mask dat->dwFlags with MWF_LOG_ALL to only affect real flag bits and
// ignore temporary bits.
+
int TSAPI LoadLocalFlags(TWindowData *dat)
{
if (dat == NULL)
@@ -301,6 +302,7 @@ int TSAPI LoadLocalFlags(TWindowData *dat)
//
// @params: Win32 window procedure conform
// @return LRESULT
+
static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -395,6 +397,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA
// @params: like any Win32 window procedure
//
// @return LRESULT (ignored for dialog procs, use DWLP_MSGRESULT)
+
INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index bad2772b2c..08d19e775f 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -1,4 +1,4 @@
-/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
// Miranda NG: the free IM client for Microsoft* Windows*
//
// Copyright (с) 2012-15 Miranda NG project,
@@ -62,43 +62,11 @@ static TCHAR *formatting_strings_end[] = { _T("b0 "), _T("i0 "), _T("u0 "), _
#define NR_CODES 5
-TCHAR* Utils::FilterEventMarkers(TCHAR *wszText)
-{
- tstring text(wszText);
- size_t beginmark = 0, endmark = 0;
-
- while (true) {
- if ((beginmark = text.find(_T("~-+"))) != text.npos) {
- endmark = text.find(_T("+-~"), beginmark);
- if (endmark != text.npos && (endmark - beginmark) > 5) {
- text.erase(beginmark, (endmark - beginmark) + 3);
- continue;
- }
- break;
- }
- break;
- }
-
- while (true) {
- if ((beginmark = text.find(_T("\xAA"))) != text.npos) {
- endmark = beginmark + 2;
- if (endmark != text.npos && (endmark - beginmark) > 1) {
- text.erase(beginmark, endmark - beginmark);
- continue;
- }
- break;
- }
- break;
- }
-
- mir_tstrcpy(wszText, text.c_str());
- return wszText;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// this translates formatting tags into rtf sequences...
// flags: loword = words only for simple * /_ formatting
// hiword = bbcode support (strip bbcodes if 0)
+
const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOOL isSent)
{
bool clr_was_added = false, was_added;
@@ -354,62 +322,50 @@ bool Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat, CMStri
dest.Append(tszGroup);
}
break;
+
+ case 0: // wrongly formed format string
+ return true;
}
}
return true;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
char* Utils::FilterEventMarkers(char *szText)
{
- std::string text(szText);
- size_t beginmark = 0, endmark = 0;
-
- while (true) {
- if ((beginmark = text.find("~-+")) != text.npos) {
- endmark = text.find("+-~", beginmark);
- if (endmark != text.npos && (endmark - beginmark) > 5) {
- text.erase(beginmark, (endmark - beginmark) + 3);
- continue;
- }
+ for (char *p = strstr(szText, "~-+"); p != NULL; p = strstr(p, "~-+")) {
+ char *pEnd = strstr(p + 3, "+-~");
+ if (pEnd == NULL)
break;
- }
- break;
- }
- while (true) {
- if ((beginmark = text.find("\xAA")) != text.npos) {
- endmark = beginmark + 2;
- if (endmark != text.npos && (endmark - beginmark) > 1) {
- text.erase(beginmark, endmark - beginmark);
- continue;
- }
- break;
- }
- break;
+ strdel(p, (pEnd - p) + 3);
}
- //
- mir_strcpy(szText, text.c_str());
+
return szText;
}
-const TCHAR* Utils::DoubleAmpersands(TCHAR *pszText)
+WCHAR* Utils::FilterEventMarkers(WCHAR *wszText)
{
- tstring text(pszText);
-
- size_t textPos = 0;
+ for (WCHAR *p = wcsstr(wszText, L"~-+"); p != NULL; p = wcsstr(p, L"~-+")) {
+ WCHAR *pEnd = wcsstr(p + 3, L"+-~");
+ if (pEnd == NULL)
+ break;
- while (true) {
- if ((textPos = text.find(_T("&"), textPos)) != text.npos) {
- text.insert(textPos, _T("%"));
- text.replace(textPos, 2, _T("&&"));
- textPos += 2;
- continue;
- }
- break;
+ strdelw(p, (pEnd - p) + 3);
}
- mir_tstrcpy(pszText, text.c_str());
- return pszText;
+
+ return wszText;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void Utils::DoubleAmpersands(TCHAR *pszText, size_t len)
+{
+ CMString text(pszText);
+ text.Replace(_T("&"), _T("&&"));
+ mir_tstrncpy(pszText, text.c_str(), len);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -418,6 +374,7 @@ const TCHAR* Utils::DoubleAmpersands(TCHAR *pszText)
// @param szText source text
// @param iMaxLen max length of the preview
// @return TCHAR* result (caller must mir_free() it)
+
TCHAR* Utils::GetPreviewWithEllipsis(TCHAR *szText, size_t iMaxLen)
{
size_t uRequired;
@@ -453,6 +410,7 @@ TCHAR* Utils::GetPreviewWithEllipsis(TCHAR *szText, size_t iMaxLen)
/////////////////////////////////////////////////////////////////////////////////////////
// returns != 0 when one of the installed keyboard layouts belongs to an rtl language
// used to find out whether we need to configure the message input box for bidirectional mode
+
int Utils::FindRTLLocale(TWindowData *dat)
{
HKL layouts[20];
@@ -478,6 +436,7 @@ int Utils::FindRTLLocale(TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// init default color table. the table may grow when using custom colors via bbcodes
+
void Utils::RTF_CTableInit()
{
int iSize = sizeof(TRTFColorTable) * RTF_CTABLE_DEFSIZE;
@@ -490,6 +449,7 @@ void Utils::RTF_CTableInit()
/////////////////////////////////////////////////////////////////////////////////////////
// add a color to the global rtf color table
+
void Utils::RTF_ColorAdd(const TCHAR *tszColname, size_t length)
{
TCHAR *stopped;
@@ -506,6 +466,7 @@ void Utils::RTF_ColorAdd(const TCHAR *tszColname, size_t length)
/////////////////////////////////////////////////////////////////////////////////////////
// generic error popup dialog procedure
+
LRESULT CALLBACK Utils::PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = PUGetContact(hWnd);
@@ -532,6 +493,7 @@ LRESULT CALLBACK Utils::PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam
// @param hContact: contact handle (0 = read global)
// @param cs TContainerSettings* target structure
// @return 0 on success, 1 failure (blob does not exist OR is not a valid private setting structure
+
int Utils::ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey)
{
memcpy(cs, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
@@ -581,6 +543,7 @@ void Utils::ContainerToSettings(TContainerData *pContainer)
//
// @param pContainer container window info struct
// @param fForce true -> force them private, even if they were not marked as private in the db
+
void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce)
{
char szCname[50];
@@ -625,6 +588,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett
//
// @param: maxHeight - determines maximum height for the picture, width will
// be scaled accordingly.
+
void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, double& dNewHeight, LONG maxHeight)
{
BITMAP bm;
@@ -656,6 +620,7 @@ void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, doubl
//
// @param dat: _MessageWindowData* pointer to the window data
// @return HICON: the icon handle
+
HICON Utils::iconFromAvatar(const TWindowData *dat)
{
if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == NULL)
@@ -744,6 +709,7 @@ void Utils::getIconSize(HICON hIcon, int& sizeX, int& sizeY)
// @param szText menu item text (must NOT be 0)
// @param uID the item command id
// @param pos zero-based position index
+
void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const TCHAR *szText, UINT uID, UINT pos)
{
mii.wID = uID;
@@ -757,6 +723,7 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const TC
/////////////////////////////////////////////////////////////////////////////////////////
// return != 0 when the sound effect must be played for the given
// session. Uses container sound settings
+
int Utils::mustPlaySound(const TWindowData *dat)
{
if (!dat)
@@ -787,6 +754,7 @@ int Utils::mustPlaySound(const TWindowData *dat)
/////////////////////////////////////////////////////////////////////////////////////////
// enable or disable a dialog control
+
void Utils::enableDlgControl(const HWND hwnd, UINT id, bool fEnable)
{
::EnableWindow(::GetDlgItem(hwnd, id), fEnable);
@@ -794,6 +762,7 @@ void Utils::enableDlgControl(const HWND hwnd, UINT id, bool fEnable)
/////////////////////////////////////////////////////////////////////////////////////////
// show or hide a dialog control
+
void Utils::showDlgControl(const HWND hwnd, UINT id, int showCmd)
{
::ShowWindow(::GetDlgItem(hwnd, id), showCmd);
@@ -807,7 +776,7 @@ DWORD CALLBACK Utils::StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
SetFilePointer(hFile, 0, NULL, FILE_END);
- FilterEventMarkers(reinterpret_cast<TCHAR *>(pbBuff));
+ FilterEventMarkers((char*)pbBuff);
WriteFile(hFile, pbBuff, cb, (DWORD *)pcb, NULL);
*pcb = cb;
CloseHandle(hFile);
@@ -819,6 +788,7 @@ DWORD CALLBACK Utils::StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
/////////////////////////////////////////////////////////////////////////////////////////
// extract a resource from the given module
// tszPath must end with \
+
bool Utils::extractResource(const HMODULE h, const UINT uID, const TCHAR *tszName, const TCHAR *tszPath,
const TCHAR *tszFilename, bool fForceOverwrite)
{
@@ -851,6 +821,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const TCHAR *tszNam
// caller MUST mir_free() the returned string
// @param hwndRich - rich edit window handle
// @return wchar_t* extracted URL
+
TCHAR* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich)
{
CHARRANGE sel = { 0 };
@@ -872,6 +843,7 @@ TCHAR* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich)
/////////////////////////////////////////////////////////////////////////////////////////
// generic command dispatcher
// used in various places (context menus, info panel menus etc.)
+
LRESULT Utils::CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam, LPARAM lParam, TWindowData *dat, TContainerData *pContainer)
{
switch (uType) {
@@ -898,6 +870,7 @@ LRESULT Utils::CmdDispatcher(UINT uType, HWND hwndDlg, UINT cmd, WPARAM wParam,
// or folder name. All invalid characters will be replaced by spaces.
//
// @param tszFilename - string to filter.
+
void Utils::sanitizeFilename(wchar_t* tszFilename)
{
static wchar_t *forbiddenCharacters = L"%/\\':|\"<>?";
@@ -914,6 +887,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename)
/////////////////////////////////////////////////////////////////////////////////////////
// ensure that a path name ends on a trailing backslash
// @param szPathname - pathname to check
+
void Utils::ensureTralingBackslash(wchar_t *szPathname)
{
if (szPathname[mir_wstrlen(szPathname) - 1] != '\\')
@@ -925,6 +899,7 @@ void Utils::ensureTralingBackslash(wchar_t *szPathname)
// handle.
//
// return 0 and throw an exception if something goes wrong.
+
HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename)
{
wchar_t sysPathName[MAX_PATH + 2];
@@ -945,6 +920,7 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename)
/////////////////////////////////////////////////////////////////////////////////////////
// setting avatar's contact
+
void Utils::setAvatarContact(HWND hWnd, MCONTACT hContact)
{
MCONTACT hSub = db_mc_getSrmmSub(hContact);
@@ -953,6 +929,7 @@ void Utils::setAvatarContact(HWND hWnd, MCONTACT hContact)
/////////////////////////////////////////////////////////////////////////////////////////
// stub for copying data to clipboard
+
size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner)
{
if (!OpenClipboard(hwndOwner) || str == 0)
@@ -972,6 +949,7 @@ size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner)
/////////////////////////////////////////////////////////////////////////////////////////
// file list handler
+
void Utils::AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename)
{
*pppFiles = (TCHAR**)mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(TCHAR*));
@@ -1000,23 +978,23 @@ void Utils::AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename
/////////////////////////////////////////////////////////////////////////////////////////
// implementation of the CWarning class
+//
+// IMPORTANT note to translators for translation of the warning dialogs:
+//
+// Make sure to NOT remove the pipe character ( | ) from the strings. This separates the
+// warning title from the actual warning text.
+//
+// Also, do NOT insert multiple | characters in the translated string. Not well-formatted
+// warnings cannot be translated and the plugin will show the untranslated versions.
+//
+// strings marked with a NOT TRANSLATABLE comment cannot be translated at all. This
+// will be used for important and critical error messages only.
+//
+// some strings are empty, this is intentional and used for error messages that share
+// the message with other possible error notifications (popups, tool tips etc.)
+//
+// Entries that do not use the LPGENT() macro are NOT TRANSLATABLE, so don't bother translating them.
-/** IMPORTANT note to translators for translation of the warning dialogs:
- *
- * Make sure to NOT remove the pipe character ( | ) from the strings. This separates the
- * warning title from the actual warning text.
- *
- * Also, do NOT insert multiple | characters in the translated string. Not well-formatted
- * warnings cannot be translated and the plugin will show the untranslated versions.
- *
- * strings marked with a NOT TRANSLATABLE comment cannot be translated at all. This
- * will be used for important and critical error messages only.
- *
- * some strings are empty, this is intentional and used for error messages that share
- * the message with other possible error notifications (popups, tool tips etc.)
- *
- * Entries that do not use the LPGENT() macro are NOT TRANSLATABLE, so don't bother translating them.
- */
static wchar_t* warnings[] = {
LPGENT("Important release notes|A test warning message"), /* WARN_TEST */ /* reserved for important notes after upgrade - NOT translatable */
LPGENT("Icon pack version check|The installed icon pack is outdated and might be incompatible with TabSRMM version 3.\n\n\\b1Missing or misplaced icons are possible issues with the currently installed icon pack.\\b0"), /* WARN_ICONPACKVERSION */
@@ -1069,22 +1047,23 @@ __int64 CWarning::getMask()
return(mask);
}
-/**
- * send cancel message to all open warning dialogs so they are destroyed
- * before TabSRMM is unloaded.
- *
- * called by the OkToExit handler in globals.cpp
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// send cancel message to all open warning dialogs so they are destroyed
+// before TabSRMM is unloaded.
+//
+// called by the OkToExit handler in globals.cpp
+
void CWarning::destroyAll()
{
if (hWindowList)
WindowList_Broadcast(hWindowList, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0);
}
-/**
- * show a CWarning dialog using the id value. Check whether the user has chosen to
- * not show this message again. This has room for 64 different warning dialogs, which
- * should be enough in the first place. Extending it should not be too hard though.
- */
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// show a CWarning dialog using the id value. Check whether the user has chosen to
+// not show this message again. This has room for 64 different warning dialogs, which
+// should be enough in the first place. Extending it should not be too hard though.
+
LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt)
{
wchar_t* separator_pos = 0;
@@ -1095,10 +1074,8 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt)
if (0 == hWindowList)
hWindowList = WindowList_Create();
- /*
- * don't open new warnings when shutdown was initiated (modal ones will otherwise
- * block the shutdown)
- */
+ // don't open new warnings when shutdown was initiated (modal ones will otherwise
+ // block the shutdown)
if (CMimAPI::m_shutDown)
return -1;
@@ -1109,10 +1086,8 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt)
if (dwFlags & CWF_UNTRANSLATED)
_s = TranslateTS(warnings[uId]);
else {
- /*
- * revert to untranslated warning when the translated message
- * is not well-formatted.
- */
+ // revert to untranslated warning when the translated message
+ // is not well-formatted.
_s = TranslateTS(warnings[uId]);
if (mir_wstrlen(_s) < 3 || 0 == wcschr(_s, '|'))
@@ -1156,9 +1131,9 @@ LRESULT CWarning::show(const int uId, DWORD dwFlags, const wchar_t* tszTxt)
return -1;
}
-/**
- * stub dlg procedure. Just register the object pointer in WM_INITDIALOG
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// stub dlg procedure.Just register the object pointer in WM_INITDIALOG
+
INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CWarning *w = reinterpret_cast<CWarning *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
@@ -1183,9 +1158,9 @@ INT_PTR CALLBACK CWarning::stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-/**
- * dialog procedure for the warning dialog box
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// dialog procedure for the warning dialog box
+
INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 878c00fe33..343cfffc67 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -58,7 +58,7 @@ public:
static LPCTSTR FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOOL isSent);
static bool FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat, CMString &dest);
static char* FilterEventMarkers(char *szText);
- static LPCTSTR DoubleAmpersands(TCHAR *pszText);
+ static void DoubleAmpersands(TCHAR *pszText, size_t len);
static void RTF_CTableInit();
static void RTF_ColorAdd(const TCHAR *tszColname, size_t length);
static int ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = 0);