summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-04 15:15:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-04 15:15:55 +0000
commit419f192d3e4c52ace067722bcfd85904b7c2628b (patch)
treedd0e423016cc614f6cb27f1aec8d1e1c2980c853 /plugins/TabSRMM
parent801a035b524badd53b9e90460a6420d5f08fa2e4 (diff)
tabSRMM:
- own path service functions replaced with the core ones; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@9675 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp2
-rw-r--r--plugins/TabSRMM/src/container.cpp4
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp180
-rw-r--r--plugins/TabSRMM/src/mim.cpp245
-rw-r--r--plugins/TabSRMM/src/mim.h16
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp2
-rw-r--r--plugins/TabSRMM/src/themes.cpp3
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
10 files changed, 152 insertions, 306 deletions
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index fe487cf80f..d1cbacdd31 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -49,7 +49,7 @@ static void OnAddLog(SESSION_INFO *si, int isOk)
static void OnGetLogName(SESSION_INFO *si, LPCTSTR ptszParsedName)
{
- if (!M.pathIsAbsolute(ptszParsedName))
+ if (!PathIsAbsoluteT(ptszParsedName))
mir_sntprintf(si->pszLogFileName, MAX_PATH, _T("%s%s"), M.getChatLogPath(), ptszParsedName);
else
mir_sntprintf(si->pszLogFileName, MAX_PATH, _T("%s"), ptszParsedName);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index ea72e9cc64..0040e69b2f 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -888,7 +888,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
lstrcat(tszDirectory, _T("\\"));
TCHAR tszTemp[MAX_PATH];
- M.pathToRelative(tszDirectory, tszTemp, const_cast<TCHAR *>(szUserDir));
+ PathToRelativeT(tszDirectory, tszTemp, szUserDir);
SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index ff669fcf33..6f14c61c6f 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1474,7 +1474,7 @@ panel_found:
Utils::SettingsToContainer(pContainer);
if (szThemeName != NULL) {
- M.pathToAbsolute(szThemeName, pContainer->szAbsThemeFile);
+ PathToAbsoluteT(szThemeName, pContainer->szAbsThemeFile);
mir_sntprintf(pContainer->szRelThemeFile, MAX_PATH, _T("%s"), szThemeName);
db_free(&dbv);
}
@@ -1886,7 +1886,7 @@ panel_found:
mir_snprintf(szCName, 40, "%s_theme", CONTAINER_PREFIX);
if (lstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
- M.pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
+ PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
db_set_ts(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile);
pContainer->fPrivateThemeChanged = FALSE;
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index d47e906609..bf069aeab6 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -347,7 +347,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
GetDlgItemText(hwndDlg, IDC_THEME, szFilename, MAX_PATH);
szFilename[MAX_PATH - 1] = 0;
- M.pathToAbsolute(szFilename, szFinalThemeFile);
+ PathToAbsoluteT(szFilename, szFinalThemeFile);
if (_tcscmp(szFilename, pContainer->szRelThemeFile))
pContainer->fPrivateThemeChanged = TRUE;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index a2c9069eeb..63b424f7ec 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -30,9 +30,9 @@
#include "commonheaders.h"
-/**
- * Save message log for given session as RTF document
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// Save message log for given session as RTF document
+
void TSAPI DM_SaveLogAsRTF(const TWindowData *dat)
{
if (dat && dat->hwndIEView != 0) {
@@ -72,16 +72,16 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat)
}
}
-/**
- * This is broadcasted by the container to all child windows to check if the
- * container can be autohidden or -closed.
- *
- * wParam is the autohide timeout (in seconds)
- * lParam points to a BOOL and a session which wants to prevent auto-hiding
- * the container must set it to FALSE.
- *
- * If no session in the container disagrees, the container will be hidden.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// This is broadcasted by the container to all child windows to check if the
+// container can be autohidden or -closed.
+//
+// wParam is the autohide timeout (in seconds)
+// lParam points to a BOOL and a session which wants to prevent auto-hiding
+// the container must set it to FALSE.
+//
+// If no session in the container disagrees, the container will be hidden.
+
void TSAPI DM_CheckAutoHide(const TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
if (dat && lParam) {
@@ -99,10 +99,9 @@ void TSAPI DM_CheckAutoHide(const TWindowData *dat, WPARAM wParam, LPARAM lParam
*fResult = FALSE; // time since last activity did not yet reach the threshold.
}
}
-/**
- * checks if the balloon tooltip can be dismissed (usually called by
- * WM_MOUSEMOVE events
- */
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// checks if the balloon tooltip can be dismissed (usually called by WM_MOUSEMOVE events)
void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt)
{
@@ -120,9 +119,9 @@ void TSAPI DM_DismissTip(TWindowData *dat, const POINT& pt)
}
}
-/**
- * initialize the balloon tooltip for message window notifications
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// initialize the balloon tooltip for message window notifications
+
void TSAPI DM_InitTip(TWindowData *dat)
{
dat->hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT,
@@ -140,11 +139,11 @@ void TSAPI DM_InitTip(TWindowData *dat)
SetWindowPos(dat->hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
}
-/**
- * checks generic hotkeys valid for both IM and MUC sessions
- *
- * returns 1 for handled hotkeys, 0 otherwise.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// checks generic hotkeys valid for both IM and MUC sessions
+//
+// returns 1 for handled hotkeys, 0 otherwise.
+
LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat)
{
LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)message, (LPARAM)(TABSRMM_HK_SECTION_GENERIC));
@@ -344,10 +343,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer,
CheckMenuItem(submenu, ID_MODE_GLOBAL, MF_BYCOMMAND | (!(dat->dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(submenu, ID_MODE_PRIVATE, MF_BYCOMMAND | (dat->dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE ? MF_CHECKED : MF_UNCHECKED));
- /*
- * formatting menu..
- */
-
+ // formatting menu..
CheckMenuItem(submenu, ID_GLOBAL_BBCODE, MF_BYCOMMAND | ((PluginConfig.m_SendFormat) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(submenu, ID_GLOBAL_OFF, MF_BYCOMMAND | ((PluginConfig.m_SendFormat == SENDFORMAT_NONE) ? MF_CHECKED : MF_UNCHECKED));
@@ -766,10 +762,8 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA
}
return 0;
- /*
- * commands from the message log popup will be routed to the
- * message log menu handler
- */
+ // commands from the message log popup will be routed to the
+ // message log menu handler
case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
case ID_MESSAGELOGSETTINGS_GLOBAL:
if (dat) {
@@ -788,10 +782,10 @@ LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARA
return 1; // handled
}
-/**
- * initialize rich edit control (log and edit control) for both MUC and
- * standard IM session windows.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// initialize rich edit control (log and edit control) for both MUC and
+// standard IM session windows.
+
void TSAPI DM_InitRichEdit(TWindowData *dat)
{
char *szStreamOut = NULL;
@@ -849,13 +843,10 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
SendMessageA(hwndEdit, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
}
- /*
- * setup the rich edit control(s)
- * LOG is always set to RTL, because this is needed for proper bidirectional operation later.
- * The real text direction is then enforced by the streaming code which adds appropiate paragraph
- * and textflow formatting commands to the
- */
-
+ // setup the rich edit control(s)
+ // LOG is always set to RTL, because this is needed for proper bidirectional operation later.
+ // The real text direction is then enforced by the streaming code which adds appropiate paragraph
+ // and textflow formatting commands to the
PARAFORMAT2 pf2;
ZeroMemory(&pf2, sizeof(PARAFORMAT2));
pf2.cbSize = sizeof(pf2);
@@ -882,10 +873,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
SendMessage(hwndLog, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
}
- /*
- * set the scrollbars etc to RTL/LTR (only for manual RTL mode)
- */
-
+ // set the scrollbars etc to RTL/LTR (only for manual RTL mode)
if (!fIsChat) {
if (dat->dwFlags & MWF_LOG_RTL) {
SetWindowLongPtr(hwndEdit, GWL_EXSTYLE, GetWindowLongPtr(hwndEdit, GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
@@ -904,9 +892,8 @@ void TSAPI DM_InitRichEdit(TWindowData *dat)
}
}
-/*
-* set the states of defined database action buttons (only if button is a toggle)
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// set the states of defined database action buttons(only if button is a toggle)
void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat)
{
@@ -1091,9 +1078,8 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat)
SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
}
-/*
-* save current keyboard layout for the given contact
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// save current keyboard layout for the given contact
void TSAPI DM_SaveLocale(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
@@ -1113,10 +1099,9 @@ void TSAPI DM_SaveLocale(TWindowData *dat, WPARAM wParam, LPARAM lParam)
}
}
-/*
-* generic handler for the WM_COPY message in message log/chat history richedit control(s).
-* it filters out the invisible event boundary markers from the text copied to the clipboard.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// generic handler for the WM_COPY message in message log/chat history richedit control(s).
+// it filters out the invisible event boundary markers from the text copied to the clipboard.
LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -1146,9 +1131,8 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w
return result;
}
-/*
-* create embedded contact list control
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// create embedded contact list control
HWND TSAPI DM_CreateClist(TWindowData *dat)
{
@@ -1299,10 +1283,10 @@ LRESULT TSAPI DM_ThemeChanged(TWindowData *dat)
return 0;
}
-/**
- * send out message typing notifications (MTN) when the
- * user is typing/editing text in the message input area.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// send out message typing notifications (MTN) when the
+// user is typing/editing text in the message input area.
+
void TSAPI DM_NotifyTyping(TWindowData *dat, int mode)
{
if (!dat || !dat->hContact)
@@ -1310,35 +1294,21 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode)
DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_TYPE);
- const char *szProto = 0;
- MCONTACT hContact = 0;
- if (dat->bIsMeta){
- szProto = dat->cache->getActiveProto();
- hContact = dat->cache->getActiveContact();
- }
- else {
- szProto = dat->szProto;
- hContact = dat->hContact;
- }
+ const char *szProto = dat->cache->getActiveProto();
+ MCONTACT hContact = dat->cache->getActiveContact();
- /*
- * editing user notes or preparing a message for queued delivery -> don't send MTN
- */
+ // editing user notes or preparing a message for queued delivery -> don't send MTN
if (dat->fEditNotesActive || dat->sendMode & SMODE_SENDLATER)
return;
- /*
- * allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle)
- */
- if (!db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
+ // allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle)
+ if (!db_get_b(hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
return;
- if (!dat->szProto) // should not, but who knows...
+ if (szProto == NULL) // should not, but who knows...
return;
- /*
- * check status and capabilities of the protocol
- */
+ // check status and capabilities of the protocol
DWORD typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(typeCaps & PF4_SUPPORTTYPING))
return;
@@ -1347,10 +1317,8 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode)
if (protoStatus < ID_STATUS_ONLINE)
return;
- /*
- * check visibility/invisibility lists to not "accidentially" send MTN to contacts who
- * should not see them (privacy issue)
- */
+ // check visibility/invisibility lists to not "accidentially" send MTN to contacts who
+ // should not see them (privacy issue)
DWORD protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps & PF1_VISLIST && db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return;
@@ -1358,12 +1326,11 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode)
if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
- /*
- * don't send to contacts which are not permanently added to the contact list,
- * unless the option to ignore added status is set.
- */
+ // don't send to contacts which are not permanently added to the contact list,
+ // unless the option to ignore added status is set.
if (db_get_b(dat->hContact, "CList", "NotOnList", 0) && !M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
return;
+
// End user check
dat->nTypeMode = mode;
CallService(MS_PROTO_SELFISTYPING, hContact, dat->nTypeMode);
@@ -1554,10 +1521,8 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam)
if (!PluginConfig.lastSPlitterPos.bSync && dat->bType != srcDat->bType)
return 0;
- /*
- * for inactive sessions, delay the splitter repositioning until they become
- * active (faster, avoid redraw/resize problems for minimized windows)
- */
+ // for inactive sessions, delay the splitter repositioning until they become
+ // active (faster, avoid redraw/resize problems for minimized windows)
if (IsIconic(dat->pContainer->hwnd) || dat->pContainer->hwndActive != dat->hwnd) {
dat->dwFlagsEx |= MWF_EX_DELAYEDSPLITTER;
dat->wParam = newPos;
@@ -1588,9 +1553,8 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam)
return 0;
}
-/**
- * incoming event handler
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// incoming event handler
void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam)
{
@@ -1622,10 +1586,9 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam)
if (m_pContainer->hwndStatus)
PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
}
- /*
- * set the message log divider to mark new (maybe unseen) messages, if the container has
- * been minimized or in the background.
- */
+
+ // set the message log divider to mark new (maybe unseen) messages, if the container has
+ // been minimized or in the background.
if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) {
if (PluginConfig.m_DividersUsePopupConfig && PluginConfig.m_UseDividers) {
if (!MessageWindowOpened(dat->hContact, 0))
@@ -1888,10 +1851,9 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
}
}
-/*
-* status icon stuff (by sje, used for indicating encryption status in the status bar
-* this is now part of the message window api
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// status icon stuff (by sje, used for indicating encryption status in the status bar
+// this is now part of the message window api
static HANDLE hHookIconPressedEvt;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 218fc6031b..61265797a3 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -30,129 +30,30 @@
#include "commonheaders.h"
-PDTTE CMimAPI::m_pfnDrawThemeTextEx = 0;
-DEFICA CMimAPI::m_pfnDwmExtendFrameIntoClientArea = 0;
-DICE CMimAPI::m_pfnDwmIsCompositionEnabled = 0;
-DRT CMimAPI::m_pfnDwmRegisterThumbnail = 0;
-BPI CMimAPI::m_pfnBufferedPaintInit = 0;
-BPU CMimAPI::m_pfnBufferedPaintUninit = 0;
-BBP CMimAPI::m_pfnBeginBufferedPaint = 0;
-EBP CMimAPI::m_pfnEndBufferedPaint = 0;
-BBW CMimAPI::m_pfnDwmBlurBehindWindow = 0;
-DGC CMimAPI::m_pfnDwmGetColorizationColor = 0;
-BPSA CMimAPI::m_pfnBufferedPaintSetAlpha = 0;
-DWMIIB CMimAPI::m_pfnDwmInvalidateIconicBitmaps = 0;
-DWMSWA CMimAPI::m_pfnDwmSetWindowAttribute = 0;
-DWMUT CMimAPI::m_pfnDwmUpdateThumbnailProperties = 0;
-DURT CMimAPI::m_pfnDwmUnregisterThumbnail = 0;
-DSIT CMimAPI::m_pfnDwmSetIconicThumbnail = 0;
-DSILP CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap = 0;
-bool CMimAPI::m_shutDown = 0;
-TCHAR CMimAPI::m_userDir[] = _T("\0");
-
-bool CMimAPI::m_haveBufferedPaint = false;
-
-/**
- * Case insensitive _tcsstr
- *
- * @param szString TCHAR *: String to be searched
- * @param szSearchFor
- *TCHAR *: String that should be found in szString
- *
- * @return TCHAR *: found position of szSearchFor in szString. 0 if szSearchFor was not found
- */
-const TCHAR* CMimAPI::StriStr(const TCHAR *szString, const TCHAR *szSearchFor)
-{
- assert(szString != 0 && szSearchFor != 0);
-
- if (!szString || *szString == 0)
- return NULL;
-
- if (!szSearchFor || *szSearchFor == 0)
- return szString;
-
- for (; *szString; ++szString) {
- if (_totupper(*szString) == _totupper(*szSearchFor)) {
- const TCHAR *h, *n;
- for (h = szString, n = szSearchFor; *h && *n; ++h, ++n)
- if (_totupper(*h) != _totupper(*n))
- break;
-
- if (!*n)
- return szString;
- }
- }
- return NULL;
-}
-
-int CMimAPI::pathIsAbsolute(const TCHAR *path) const
-{
- if (!path || !(lstrlen(path) > 2))
- return 0;
- if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
- return 1;
- return 0;
-}
-
-size_t CMimAPI::pathToRelative(const TCHAR *pSrc, TCHAR *pOut, const TCHAR *szBase) const
-{
- const TCHAR *tszBase = szBase ? szBase : m_szProfilePath;
-
- pOut[0] = 0;
- if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
- if (!pathIsAbsolute(pSrc)) {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return lstrlen(pOut);
- }
-
- TCHAR szTmp[MAX_PATH];
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
- if (StriStr(szTmp, tszBase)) {
- if (tszBase[lstrlen(tszBase) - 1] == '\\')
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(tszBase));
- else {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(tszBase) + 1 );
- //pOut[0]='.';
- }
- return(lstrlen(pOut));
- }
-
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return(lstrlen(pOut));
-}
-
-/**
- * Translate a relativ path to an absolute, using the current profile
- * data directory.
- *
- * @param pSrc TCHAR *: input path + filename (relative)
- * @param pOut TCHAR *: the result
- * @param szBase TCHAR *: (OPTIONAL) base path for the translation. Can be 0 in which case
- * the function will use m_szProfilePath (usually \tabSRMM below %miranda_userdata%
- *
- * @return
- */
-size_t CMimAPI::pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut, const TCHAR *szBase) const
-{
- const TCHAR *tszBase = szBase ? szBase : m_szProfilePath;
-
- pOut[0] = 0;
- if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
- if (pathIsAbsolute(pSrc) && pSrc[0]!='.')
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- else if (pSrc[0]=='.')
- mir_sntprintf(pOut, MAX_PATH, _T("%s\\%s"), tszBase, pSrc + 1);
- else
- mir_sntprintf(pOut, MAX_PATH, _T("%s\\%s"), tszBase, pSrc);
-
- return lstrlen(pOut);
-}
-
-/*
- * window list functions
- */
+PDTTE CMimAPI::m_pfnDrawThemeTextEx = 0;
+DEFICA CMimAPI::m_pfnDwmExtendFrameIntoClientArea = 0;
+DICE CMimAPI::m_pfnDwmIsCompositionEnabled = 0;
+DRT CMimAPI::m_pfnDwmRegisterThumbnail = 0;
+BPI CMimAPI::m_pfnBufferedPaintInit = 0;
+BPU CMimAPI::m_pfnBufferedPaintUninit = 0;
+BBP CMimAPI::m_pfnBeginBufferedPaint = 0;
+EBP CMimAPI::m_pfnEndBufferedPaint = 0;
+BBW CMimAPI::m_pfnDwmBlurBehindWindow = 0;
+DGC CMimAPI::m_pfnDwmGetColorizationColor = 0;
+BPSA CMimAPI::m_pfnBufferedPaintSetAlpha = 0;
+DWMIIB CMimAPI::m_pfnDwmInvalidateIconicBitmaps = 0;
+DWMSWA CMimAPI::m_pfnDwmSetWindowAttribute = 0;
+DWMUT CMimAPI::m_pfnDwmUpdateThumbnailProperties = 0;
+DURT CMimAPI::m_pfnDwmUnregisterThumbnail = 0;
+DSIT CMimAPI::m_pfnDwmSetIconicThumbnail = 0;
+DSILP CMimAPI::m_pfnDwmSetIconicLivePreviewBitmap = 0;
+bool CMimAPI::m_shutDown = 0;
+TCHAR CMimAPI::m_userDir[] = _T("\0");
+
+bool CMimAPI::m_haveBufferedPaint = false;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// window list functions
void CMimAPI::BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -179,6 +80,8 @@ INT_PTR CMimAPI::RemoveWindow(HWND hWnd)
return WindowList_Remove(m_hMessageWindowList, hWnd);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CMimAPI::FoldersPathChanged(WPARAM wParam, LPARAM lParam)
{
return M.foldersPathChanged();
@@ -229,10 +132,10 @@ INT_PTR CMimAPI::foldersPathChanged()
const TCHAR* CMimAPI::getUserDir()
{
if (m_userDir[0] == 0) {
- if ( ServiceExists(MS_FOLDERS_REGISTER_PATH))
+ if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
lstrcpyn(m_userDir, L"%miranda_userdata%", SIZEOF(m_userDir));
else
- lstrcpyn(m_userDir, VARST( _T("%miranda_userdata%")), SIZEOF(m_userDir));
+ lstrcpyn(m_userDir, VARST(_T("%miranda_userdata%")), SIZEOF(m_userDir));
Utils::ensureTralingBackslash(m_userDir);
}
@@ -278,24 +181,21 @@ bool CMimAPI::getAeroState()
return m_isAero;
}
-/**
- * Initialize various Win32 API functions which are not common to all versions of Windows.
- * We have to work with functions pointers here.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// 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()
{
m_hUxTheme = 0;
- /*
- * vista+ DWM API
- */
+ // vista+ DWM API
m_hDwmApi = 0;
- if (IsWinVerVistaPlus()) {
+ if (IsWinVerVistaPlus()) {
m_hDwmApi = Utils::loadSystemLibrary(L"\\dwmapi.dll");
- if (m_hDwmApi) {
- m_pfnDwmExtendFrameIntoClientArea = (DEFICA)GetProcAddress(m_hDwmApi,"DwmExtendFrameIntoClientArea");
- m_pfnDwmIsCompositionEnabled = (DICE)GetProcAddress(m_hDwmApi,"DwmIsCompositionEnabled");
+ if (m_hDwmApi) {
+ m_pfnDwmExtendFrameIntoClientArea = (DEFICA)GetProcAddress(m_hDwmApi, "DwmExtendFrameIntoClientArea");
+ m_pfnDwmIsCompositionEnabled = (DICE)GetProcAddress(m_hDwmApi, "DwmIsCompositionEnabled");
m_pfnDwmRegisterThumbnail = (DRT)GetProcAddress(m_hDwmApi, "DwmRegisterThumbnail");
m_pfnDwmBlurBehindWindow = (BBW)GetProcAddress(m_hDwmApi, "DwmEnableBlurBehindWindow");
m_pfnDwmGetColorizationColor = (DGC)GetProcAddress(m_hDwmApi, "DwmGetColorizationColor");
@@ -306,9 +206,8 @@ void CMimAPI::InitAPI()
m_pfnDwmSetIconicThumbnail = (DSIT)GetProcAddress(m_hDwmApi, "DwmSetIconicThumbnail");
m_pfnDwmSetIconicLivePreviewBitmap = (DSILP)GetProcAddress(m_hDwmApi, "DwmSetIconicLivePreviewBitmap");
}
- /*
- * additional uxtheme APIs (Vista+)
- */
+
+ // additional uxtheme APIs (Vista+)
m_hUxTheme = Utils::loadSystemLibrary(L"\\uxtheme.dll");
if (m_hUxTheme) {
m_pfnDrawThemeTextEx = (PDTTE)GetProcAddress(m_hUxTheme, "DrawThemeTextEx");
@@ -325,9 +224,8 @@ void CMimAPI::InitAPI()
else m_haveBufferedPaint = false;
}
-/**
- * hook subscriber function for incoming message typing events
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// hook subscriber function for incoming message typing events
int CMimAPI::TypingMessage(WPARAM hContact, LPARAM lParam)
{
@@ -351,7 +249,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM lParam)
return 0; // should never happen
}
- if ( M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
+ if (M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
if (!hwnd && !M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1))
fShowOnClist = FALSE;
if (hwnd && !M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1))
@@ -366,7 +264,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM lParam)
BOOL fShow = FALSE;
int iMode = M.GetByte("MTN_PopupMode", 0);
- switch(iMode) {
+ switch (iMode) {
case 0:
fShow = TRUE;
break;
@@ -420,13 +318,12 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM lParam)
return 0;
}
-/**
- * this is the global ack dispatcher. It handles both ACKTYPE_MESSAGE and ACKTYPE_AVATAR events
- * for ACKTYPE_MESSAGE it searches the corresponding send job in the queue and, if found, dispatches
- * it to the owners window
- *
- * ACKTYPE_AVATAR no longer handled here, because we have avs services now.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// this is the global ack dispatcher.It handles both ACKTYPE_MESSAGE and ACKTYPE_AVATAR events
+// for ACKTYPE_MESSAGE it searches the corresponding send job in the queue and, if found, dispatches
+// it to the owners window
+//
+// ACKTYPE_AVATAR no longer handled here, because we have avs services now.
int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam)
{
@@ -435,7 +332,7 @@ int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam)
return 0;
HWND hwndDlg = 0;
- int i=0, iFound = SendQueue::NR_SENDJOBS;
+ int i = 0, iFound = SendQueue::NR_SENDJOBS;
SendJob *jobs = sendQueue->getJobByIndex(0);
if (pAck->type == ACKTYPE_MESSAGE) {
@@ -473,8 +370,8 @@ int CMimAPI::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
char *szProto = GetContactProto(hContact);
if (szProto) {
// leave this menu item hidden for chats
- if ( !db_get_b(hContact, szProto, "ChatRoom", 0 ))
- if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
+ if (!db_get_b(hContact, szProto, "ChatRoom", 0))
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
bEnabled = true;
}
@@ -482,14 +379,13 @@ int CMimAPI::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
return 0;
}
-/**
- * this handler is called first in the message window chain - it will handle events for which a message window
- * is already open. if not, it will do nothing and the 2nd handler (MessageEventAdded) will perform all
- * the needed actions.
- *
- * 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.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// this handler is called first in the message window chain - it will handle events for which a message window
+// is already open. if not, it will do nothing and the 2nd handler(MessageEventAdded) will perform all
+// the needed actions.
+//
+// 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 lParam)
{
@@ -498,13 +394,12 @@ int CMimAPI::DispatchNewEvent(WPARAM hContact, LPARAM lParam)
return 0;
}
-/**
- * Message event added is called when a new message is added to the database
- * if no session is open for the contact, this function will determine if and how a new message
- * session (tab) must be created.
- *
- * if a session is already created, it just does nothing and DispatchNewEvent() will take care.
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// Message event added is called when a new message is added to the database
+// if no session is open for the contact, this function will determine if and how a new message
+// 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 lParam)
{
@@ -610,12 +505,10 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam)
CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0);
return 0;
}
-
+
bool bActivate = false, bPopup = M.GetByte("cpopup", 0) != 0;
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer != NULL) {
- //if ((IsIconic(pContainer->hwnd)) && PluginConfig.haveAutoSwitch())
- // pContainer->dwFlags |= CNT_DEFERREDTABSELECT;
if (M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) {
if ((pContainer = FindMatchingContainer(L"default", hContact)) != NULL) {
CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
@@ -629,17 +522,15 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam)
}
if (bAutoContainer) {
if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != NULL) { // 2 means create minimized, don't popup...
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
+ CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0);
}
return 0;
}
}
- /*
- * for tray support, we add the event to the tray menu. otherwise we send it back to
- * the contact list for flashing
- */
+ // for tray support, we add the event to the tray menu. otherwise we send it back to
+ // the contact list for flashing
nowindowcreate:
if (!(dbei.flags & DBEF_READ)) {
UpdateTrayMenu(0, 0, dbei.szModule, NULL, hContact, 1);
diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h
index c548d07c4f..6340fe1e59 100644
--- a/plugins/TabSRMM/src/mim.h
+++ b/plugins/TabSRMM/src/mim.h
@@ -124,10 +124,6 @@ public:
* path utilities
*/
- int pathIsAbsolute(const TCHAR *path) const;
- size_t pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut, const TCHAR *szBase = 0) const;
- size_t pathToRelative(const TCHAR *pSrc, TCHAR *pOut, const TCHAR *szBase = 0) const;
-
__forceinline LPCTSTR getDataPath() const { return(m_szProfilePath); }
__forceinline LPCTSTR getSkinPath() const { return(m_szSkinsPath); }
__forceinline LPCTSTR getSavedAvatarPath() const { return(m_szSavedAvatarsPath); }
@@ -180,13 +176,11 @@ public:
* window lists
*/
- void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam);
- void BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam);
- INT_PTR AddWindow(HWND hWnd, MCONTACT h);
- INT_PTR RemoveWindow(HWND hWnd);
- HWND FindWindow(MCONTACT h) const;
-
- static LPCTSTR StriStr(const TCHAR *szString, const TCHAR *szSearchFor);
+ void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam);
+ void BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam);
+ INT_PTR AddWindow(HWND hWnd, MCONTACT h);
+ INT_PTR RemoveWindow(HWND hWnd);
+ HWND FindWindow(MCONTACT h) const;
static int FoldersPathChanged(WPARAM wParam, LPARAM lParam); // hook subscriber for folders plugin
static int TypingMessage(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 2983bc1e22..f62a9b77de 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -135,7 +135,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
mir_sntprintf(szBuf, 255, _T("%s"), fd.cFileName);
}
- M.pathToRelative(tszFinalName, tszRel, M.getSkinPath());
+ PathToRelativeT(tszFinalName, tszRel, M.getSkinPath());
if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) {
TCHAR *idata = (TCHAR*)mir_alloc((lstrlen(tszRel) + 1) * sizeof(TCHAR));
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index bcda08d422..44243d5717 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1036,8 +1036,7 @@ void CSkin::setFileName()
{
DBVARIANT dbv;
if (0 == db_get_ts(0, SRMSGMOD_T, "ContainerSkin", &dbv)) {
- M.pathToAbsolute(dbv.ptszVal, m_tszFileName, M.getSkinPath());
- m_tszFileName[MAX_PATH - 1] = 0;
+ PathToAbsoluteT(dbv.ptszVal, m_tszFileName, M.getSkinPath());
db_free(&dbv);
}
else
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 055a1233fa..8deacf4537 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -720,7 +720,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett
mir_snprintf(szCName, 40, "%s%d_theme", szSetting, pContainer->iContainerIndex);
if (lstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
- M.pathToRelative(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
+ PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile);
db_set_ts(NULL, SRMSGMOD_T, szCName, pContainer->szAbsThemeFile);
pContainer->fPrivateThemeChanged = FALSE;
}