summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-26 14:54:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-26 14:54:32 +0000
commit15d257830f5f9148a7ccad2de719b1cf75f62598 (patch)
treed9666f29123dc4af154ed94b0c7c1f9ae3cb2f10 /plugins/TabSRMM/src
parent831890a8024a9519cdf725c5a098898734e54e93 (diff)
MCONTACT-related code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8277 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp2
-rw-r--r--plugins/TabSRMM/src/container.cpp8
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp36
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp644
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.cpp2
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
8 files changed, 304 insertions, 400 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index 7ca7530585..c1d5fae4ee 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -852,7 +852,7 @@ void TSAPI BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, B
cbcd.hContact = dat->hContact;
cbcd.flags = (code ? BBCF_RIGHTBUTTON : 0) | (GetKeyState(VK_SHIFT) & 0x8000 ? BBCF_SHIFTPRESSED : 0) | (GetKeyState(VK_CONTROL) & 0x8000 ? BBCF_CONTROLPRESSED : 0) | (bFromArrow ? BBCF_ARROWCLICKED : 0);
- NotifyEventHooks(hHookButtonPressedEvt, (WPARAM)dat->hContact, (LPARAM)&cbcd);
+ NotifyEventHooks(hHookButtonPressedEvt, dat->hContact, (LPARAM)&cbcd);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index beaed8af21..0a60a74c8e 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -270,7 +270,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p)
TabCtrl_SetCurSel(hwndTab, iItem);
ShowWindow(dat->pContainer->hwndActive, SW_HIDE);
dat->pContainer->hwndActive = si->hWnd;
- SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
dat->pContainer->dwFlags |= CNT_DEFERREDTABSELECT;
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 12ba5216fa..5c30455b8a 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -981,7 +981,7 @@ panel_found:
if (si && dat->hContact) {
char *szProto = GetContactProto(dat->hContact);
if (szProto)
- CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
+ CallProtoService( szProto, PS_LEAVECHAT, dat->hContact, 0 );
}
}
break;
@@ -2345,9 +2345,9 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg)
AppendMenu(hMenu, MF_STRING | MF_DISABLED | MF_GRAYED | MF_CHECKED, 1, TranslateT("Meta Contact"));
AppendMenu(hMenu, MF_SEPARATOR, 1, _T(""));
- int iNumProtos = (int)CallService(MS_MC_GETNUMCONTACTS, (WPARAM)dat->hContact, 0);
- int iDefaultProtoByNum = (int)CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)dat->hContact, 0);
- MCONTACT hContactMostOnline = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->hContact, 0);
+ int iNumProtos = (int)CallService(MS_MC_GETNUMCONTACTS, dat->hContact, 0);
+ int iDefaultProtoByNum = (int)CallService(MS_MC_GETDEFAULTCONTACTNUM, dat->hContact, 0);
+ MCONTACT hContactMostOnline = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, dat->hContact, 0);
char *szProtoMostOnline = GetContactProto(hContactMostOnline);
int isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index b39f2da11d..32ec5e2083 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -301,7 +301,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer,
break;
case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, dat->hContact, 0);
break;
case IDC_SMILEYBTN:
@@ -574,7 +574,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer,
break;
case IDC_PROTOCOL:
- submenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ submenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
if (lParam == 0)
GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc);
else
@@ -1130,7 +1130,7 @@ HWND TSAPI DM_CreateClist(TWindowData *dat)
HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248,
184, 0, 30, 30, dat->hwnd, (HMENU)IDC_CLIST, g_hInst, NULL);
SendMessage(hwndClist, WM_TIMER, 14, 0);
- HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, (WPARAM)dat->hContact, 0);
+ HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, dat->hContact, 0);
SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) & ~CLS_EX_TRACKSELECT);
SetWindowLongPtr(hwndClist, GWL_EXSTYLE, GetWindowLongPtr(hwndClist, GWL_EXSTYLE) | (CLS_EX_NOSMOOTHSCROLLING | CLS_EX_NOTRANSLUCENTSEL));
@@ -1361,7 +1361,7 @@ void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam)
if (dat->hContact && dat->szProto != NULL && dat->bIsMeta) {
DWORD dwForcedContactNum = 0;
- CallService(MS_MC_GETFORCESTATE, (WPARAM)dat->hContact, (LPARAM)&dwForcedContactNum);
+ CallService(MS_MC_GETFORCESTATE, dat->hContact, (LPARAM)&dwForcedContactNum);
db_set_dw(dat->hContact, SRMSGMOD_T, "tabSRMM_forced", dwForcedContactNum);
}
@@ -1371,7 +1371,6 @@ void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam)
dat->Panel->getVisibility();
// small inner margins (padding) for the text areas
-
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
@@ -1412,20 +1411,17 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff)
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
else {
- TWindowData *dat_active = NULL;
-
if (!fForceOff) {
dat->showTyping = 2;
dat->nTypeSecs = 86400;
- mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar),
- TranslateT("%s has entered text."), dat->cache->getNick());
+ mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar), TranslateT("%s has entered text."), dat->cache->getNick());
if (hwndStatus && dat->pContainer->hwndActive == hwndDlg)
SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar);
}
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
HandleIconFeedback(dat, (HICON) - 1);
- dat_active = (TWindowData*)GetWindowLongPtr(dat->pContainer->hwndActive, GWLP_USERDATA);
+ TWindowData *dat_active = (TWindowData*)GetWindowLongPtr(dat->pContainer->hwndActive, GWLP_USERDATA);
if (dat_active && dat_active->bType == SESSIONTYPE_IM)
SendMessage(hwndContainer, DM_UPDATETITLE, 0, 0);
else
@@ -1463,7 +1459,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff)
dat->iFlashIcon = PluginConfig.g_IconTypingEvent;
HandleIconFeedback(dat, PluginConfig.g_IconTypingEvent);
}
- else { // active tab may show icon if status bar is disabled
+ else { // active tab may show icon if status bar is disabled
if (!hwndStatus) {
if (TabCtrl_GetItemCount(GetParent(hwndDlg)) > 1 || !(dat->pContainer->dwFlags & CNT_HIDETABS))
HandleIconFeedback(dat, PluginConfig.g_IconTypingEvent);
@@ -1476,11 +1472,11 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff)
}
}
-/**
- * sync splitter position for all open sessions.
- * This cares about private / per container / MUC <> IM splitter syncing and everything.
- * called from IM and MUC windows via DM_SPLITTERGLOBALEVENT
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// sync splitter position for all open sessions.
+// This cares about private / per container / MUC <> IM splitter syncing and everything.
+// called from IM and MUC windows via DM_SPLITTERGLOBALEVENT
+
int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
RECT rcWin;
@@ -1615,7 +1611,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam)
*/
if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) {
if (PluginConfig.m_DividersUsePopupConfig && PluginConfig.m_UseDividers) {
- if (!MessageWindowOpened((WPARAM)dat->hContact, 0))
+ if (!MessageWindowOpened(dat->hContact, 0))
SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0);
}
else if (PluginConfig.m_UseDividers) {
@@ -1688,7 +1684,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam)
TabCtrl_SetCurSel(GetParent(hwndDlg), iItem);
ShowWindow(m_pContainer->hwndActive, SW_HIDE);
m_pContainer->hwndActive = hwndDlg;
- SendMessage(hwndContainer, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ SendMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
m_pContainer->dwFlags |= CNT_DEFERREDTABSELECT;
}
}
@@ -1848,7 +1844,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
m_pContainer->SideBar->updateSession(dat);
}
if (m_pContainer->hwndActive == hwndDlg && lParam)
- SendMessage(hwndContainer, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ SendMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
UpdateTrayMenuState(dat, TRUE);
if (dat->cache->isFavorite())
@@ -1999,7 +1995,7 @@ void SI_CheckStatusIconClick(TWindowData *dat, HWND hwndFrom, POINT pt, RECT r,
sicd.dwId = si->dwId;
sicd.szModule = si->szModule;
sicd.flags = (code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0);
- NotifyEventHooks(hHookIconPressedEvt, (WPARAM)dat->hContact, (LPARAM)&sicd);
+ NotifyEventHooks(hHookIconPressedEvt, dat->hContact, (LPARAM)&sicd);
InvalidateRect(dat->pContainer->hwndStatus, NULL, TRUE);
}
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 6de97204e3..565b685e33 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -336,7 +336,7 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
if (dat->dwFlagsEx & MWF_SHOW_FLASHCLIST) {
dat->dwFlagsEx &= ~MWF_SHOW_FLASHCLIST;
if (dat->hFlashingEvent != 0)
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)dat->hContact, (LPARAM)dat->hFlashingEvent);
+ CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)dat->hFlashingEvent);
dat->hFlashingEvent = 0;
}
dat->pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE;
@@ -357,7 +357,7 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg)
}
dat->pContainer->hIconTaskbarOverlay = 0;
- SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ SendMessage(dat->pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
UpdateStatusBar(dat);
dat->dwLastActivity = GetTickCount();
@@ -1324,18 +1324,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// load log option flags...
dat->dwFlags = dat->pContainer->theme.dwFlags;
- /*
- * consider per-contact message setting overrides
- */
-
- if (M.GetDword(dat->hContact, "mwmask", 0))
- if (dat->hContact)
- LoadLocalFlags(hwndDlg, dat);
-
- /*
- * allow disabling emoticons per contact (note: currently unused feature)
- */
+
+ // consider per-contact message setting overrides
+ if (dat->hContact && M.GetDword(dat->hContact, "mwmask", 0))
+ LoadLocalFlags(hwndDlg, dat);
+ // allow disabling emoticons per contact (note: currently unused feature)
int dwLocalSmAdd = M.GetByte(dat->hContact, "doSmileys", 0xff);
if (dwLocalSmAdd != 0xffffffff)
dat->doSmileys = dwLocalSmAdd;
@@ -1425,29 +1419,21 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST);
- /*
- * add us to the tray list (if it exists)
- */
-
+ // add us to the tray list (if it exists)
if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXLIMITTEXT, 0, 0x80000000);
- /*
- * subclassing stuff
- */
+ // subclassing stuff
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
- /*
- * load old messages from history (if wanted...)
- */
-
+ // load old messages from history (if wanted...)
dat->cache->updateStats(TSessionStats::INIT_TIMER);
if (dat->hContact) {
FindFirstEvent(dat);
@@ -1457,9 +1443,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
LoadOwnAvatar(dat);
- /*
- * restore saved msg if any...
- */
+ // restore saved msg if any...
if (dat->hContact) {
ptrT tszSavedMsg(db_get_tsa(dat->hContact, SRMSGMOD, "SavedMsg"));
if (tszSavedMsg != 0) {
@@ -1527,7 +1511,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
m_pContainer->hwndActive = hwndDlg;
m_pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
}
- PostMessage(hwndContainer, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ PostMessage(hwndContainer, DM_UPDATETITLE, dat->hContact, 0);
DM_RecalcPictureSize(dat);
dat->dwLastActivity = GetTickCount() - 1000;
@@ -1539,9 +1523,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->dwFlags &= ~MWF_INITMODE;
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
- /*
- * show a popup if wanted...
- */
+ // show a popup if wanted...
if (newData->bWantPopup) {
DBEVENTINFO dbei = { sizeof(dbei) };
newData->bWantPopup = FALSE;
@@ -1620,22 +1602,15 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
}
- /*
- * draw the (new) infopanel background. Use the gradient from the statusitem.
- */
-
+ // draw the (new) infopanel background. Use the gradient from the statusitem.
GetClientRect(hwndDlg, &rc);
dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
- /*
- * draw aero related stuff
- */
-
+ // draw aero related stuff
if (!CSkin::m_skinEnabled)
CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
- /*
- * render info panel fields
- */
+
+ // render info panel fields
dat->Panel->renderContent(hdcMem);
if (hpb)
@@ -1655,12 +1630,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return 0;
case WM_PAINT:
+ // in skinned mode only, draw the background elements for the 2 richedit controls
+ // this allows border-less textboxes to appear "skinned" and blended with the background
{
- /*
- * in skinned mode only, draw the background elements for the 2 richedit controls
- * this allows border-less textboxes to appear "skinned" and blended with the
- * background
- */
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwndDlg, &ps);
EndPaint(hwndDlg, &ps);
@@ -1719,8 +1691,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (PluginConfig.g_FlashAvatarAvail) {
RECT rc1 = { 0, 0, rc.right - rc.left, rc.bottom - rc.top };
if (dat->Panel->isActive()) {
- FLASHAVATAR fa = {0};
-
+ FLASHAVATAR fa = { 0 };
fa.hContact = dat->hContact;
fa.id = 25367;
fa.cProto = dat->szProto;
@@ -1886,32 +1857,29 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
SendMessage(hwndDlg, DM_DEFERREDREMAKELOG, (WPARAM)hwndDlg, 0);
- return(_dlgReturn(hwndDlg, 1));
}
+ return(_dlgReturn(hwndDlg, 1));
+
case TABSRMM_HK_TOGGLEMULTISEND:
- {
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
-
- dat->sendMode ^= SMODE_MULTIPLE;
- if (dat->sendMode & SMODE_MULTIPLE) {
- HWND hwndClist = DM_CreateClist(dat);
- } else {
- if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
- DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
- }
- SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
- DM_ScrollToBottom(dat, 0, 0);
- Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
- if (dat->sendMode & SMODE_MULTIPLE)
- SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
- else
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
- return(_dlgReturn(hwndDlg, 1));
- }
+ dat->sendMode ^= SMODE_MULTIPLE;
+ if (dat->sendMode & SMODE_MULTIPLE)
+ DM_CreateClist(dat);
+ else if (IsWindow(GetDlgItem(hwndDlg, IDC_CLIST)))
+ DestroyWindow(GetDlgItem(hwndDlg, IDC_CLIST));
+
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
+ DM_ScrollToBottom(dat, 0, 0);
+ Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_CLIST, (dat->sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
+ if (dat->sendMode & SMODE_MULTIPLE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_CLIST));
+ else
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ RedrawWindow(hwndDlg, 0, 0, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN);
+ return(_dlgReturn(hwndDlg, 1));
}
if (DM_GenericHotkeysCheck(&message, dat)) {
dat->fkeyProcessed = true;
@@ -2039,7 +2007,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
return(_dlgReturn(hwndDlg, 0));
}
- //MAD_
+
if (msg == WM_MOUSEWHEEL && (((NMHDR*)lParam)->idFrom == IDC_LOG || ((NMHDR*)lParam)->idFrom == IDC_MESSAGE)) {
RECT rc;
GetCursorPos(&pt);
@@ -2077,33 +2045,30 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (cf2.dwEffects & CFE_BOLD) {
if (bBold == BST_UNCHECKED)
CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_CHECKED);
- } else {
- if (bBold == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
}
+ else if (bBold == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTBOLD, BST_UNCHECKED);
if (cf2.dwEffects & CFE_ITALIC) {
if (bItalic == BST_UNCHECKED)
CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_CHECKED);
- } else {
- if (bItalic == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
}
+ else if (bItalic == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTITALIC, BST_UNCHECKED);
if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
if (bUnder == BST_UNCHECKED)
CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_CHECKED);
- } else {
- if (bUnder == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
}
+ else if (bUnder == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTUNDERLINE, BST_UNCHECKED);
+
if (cf2.dwEffects & CFE_STRIKEOUT) {
if (bStrikeout == BST_UNCHECKED)
CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_CHECKED);
- } else {
- if (bStrikeout == BST_CHECKED)
- CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
}
+ else if (bStrikeout == BST_CHECKED)
+ CheckDlgButton(hwndDlg, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
}
switch (msg) {
case WM_LBUTTONDOWN:
@@ -2213,15 +2178,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case IDM_OPENNEW:
CallService(MS_UTILS_OPENURL, 1 + OUF_TCHAR, (LPARAM)tr.lpstrText);
break;
+
case IDM_OPENEXISTING:
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)tr.lpstrText);
break;
+
case IDM_COPYLINK:
- HGLOBAL hData;
if (!OpenClipboard(hwndDlg))
break;
+
EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText)+1));
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText)+1));
TCHAR *buf = (TCHAR*)GlobalLock(hData);
lstrcpy(buf, tr.lpstrText);
GlobalUnlock(hData);
@@ -2251,38 +2218,28 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case DM_UPDATEWINICON:
- {
- HWND t_hwnd;
- const char* szProto = dat->cache->getActiveProto();
- WORD wStatus = dat->cache->getActiveStatus();
-
- t_hwnd = m_pContainer->hwnd;
-
- if (dat->hXStatusIcon) {
- DestroyIcon(dat->hXStatusIcon);
- dat->hXStatusIcon = 0;
- }
+ if (dat->hXStatusIcon) {
+ DestroyIcon(dat->hXStatusIcon);
+ dat->hXStatusIcon = 0;
+ }
- if (szProto) {
- dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat);
- if (M.GetByte("use_xicons", 1))
- dat->hXStatusIcon = GetXStatusIcon(dat);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONSETASDIMMED, (dat->dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
+ if (LPCSTR szProto = dat->cache->getActiveProto()) {
+ dat->hTabIcon = dat->hTabStatusIcon = MY_GetContactIcon(dat);
+ if (M.GetByte("use_xicons", 1))
+ dat->hXStatusIcon = GetXStatusIcon(dat);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BUTTONSETASDIMMED, (dat->dwFlagsEx & MWF_SHOW_ISIDLE) != 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
- if (m_pContainer->hwndActive == hwndDlg)
- SendMessage(t_hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
+ if (m_pContainer->hwndActive == hwndDlg)
+ SendMessage(m_pContainer->hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon));
- if (dat->pWnd)
- dat->pWnd->updateIcon(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon);
- }
- return 0;
+ if (dat->pWnd)
+ dat->pWnd->updateIcon(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabIcon);
}
- /*
- * configures the toolbar only... if lParam != 0, then it also calls
- * SetDialogToType() to reconfigure the message window
- */
+ return 0;
+ // configures the toolbar only... if lParam != 0, then it also calls
+ // SetDialogToType() to reconfigure the message window
case DM_CONFIGURETOOLBAR:
dat->showUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
@@ -2403,14 +2360,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
oldDynaSplitter = dat->dynaSplitter;
dat->splitterY = rc.bottom - pt.y +DPISCALEY_S(23);
- /*
- * attempt to fix splitter troubles..
- * hardcoded limits... better solution is possible, but this works for now
- */
- //mad
+
+ // attempt to fix splitter troubles..
+ // hardcoded limits... better solution is possible, but this works for now
if (dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR)
bottomtoolbarH = 22;
- //
+
if (dat->splitterY < (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH)) { // min splitter size
dat->splitterY = (DPISCALEY_S(MINSPLITTERY) + 5 + bottomtoolbarH);
dat->dynaSplitter = dat->splitterY - DPISCALEY_S(34);
@@ -2443,12 +2398,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
break;
- /*
- * queue a dm_remakelog
- * wParam = hwnd of the sender, so we can directly do a DM_REMAKELOG if the msg came
- * from ourself. otherwise, the dm_remakelog will be deferred until next window
- * activation (focus)
- */
+ // queue a dm_remakelog
+ // wParam = hwnd of the sender, so we can directly do a DM_REMAKELOG if the msg came
+ // from ourself. otherwise, the dm_remakelog will be deferred until next window
+ // activation (focus)
case DM_DEFERREDREMAKELOG:
if ((HWND) wParam == hwndDlg)
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
@@ -2482,35 +2435,32 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
StreamInEvents(hwndDlg, (HANDLE)wParam, 1, 1, NULL);
return 0;
- /*
- * replays queued events after the message log has been frozen for a while
- */
+ // replays queued events after the message log has been frozen for a while
case DM_REPLAYQUEUE:
- {
- for (int i=0; i < dat->iNextQueuedEvent; i++)
- if (dat->hQueuedEvents[i] != 0)
- StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
- }
+ for (int i=0; i < dat->iNextQueuedEvent; i++)
+ if (dat->hQueuedEvents[i] != 0)
+ StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
dat->iNextQueuedEvent = 0;
SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
TranslateT("Autoscrolling is disabled (press F12 to enable it)"));
return 0;
- case DM_SCROLLIEVIEW: {
- IEVIEWWINDOW iew = {0};
-
- iew.cbSize = sizeof(IEVIEWWINDOW);
- iew.iType = IEW_SCROLLBOTTOM;
- if (dat->hwndIEView) {
- iew.hwnd = dat->hwndIEView;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
- } else if (dat->hwndHPP) {
- iew.hwnd = dat->hwndHPP;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&iew);
+ case DM_SCROLLIEVIEW:
+ {
+ IEVIEWWINDOW iew = { sizeof(iew) };
+ iew.iType = IEW_SCROLLBOTTOM;
+ if (dat->hwndIEView) {
+ iew.hwnd = dat->hwndIEView;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);
+ }
+ else if (dat->hwndHPP) {
+ iew.hwnd = dat->hwndHPP;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&iew);
+ }
}
return 0;
- }
+
case DM_FORCESCROLL:
{
SCROLLINFO *psi = (SCROLLINFO *)lParam;
@@ -2863,98 +2813,89 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return 0;
}
else {
- int bufSize = 0, memRequired = 0, flags = 0;
- char *streamOut = NULL;
- TCHAR *decoded = NULL, *converted = NULL;
- FINDTEXTEXA fi = {0};
- int final_sendformat = dat->SendFormat;
- HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
-
// don't parse text formatting when the message contains curly braces - these are used by the rtf syntax
// and the parser currently cannot handle them properly in the text - XXX needs to be fixed later.
-
- PARAFORMAT2 pf2;
- ZeroMemory(&pf2, sizeof(PARAFORMAT2));
+ FINDTEXTEXA fi = { 0 };
fi.chrg.cpMin = 0;
fi.chrg.cpMax = -1;
fi.lpstrText = "{";
- final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
+ int final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? dat->SendFormat : 0;
fi.lpstrText = "}";
final_sendformat = SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) == -1 ? final_sendformat : 0;
if (GetSendButtonState(hwndDlg) == PBS_DISABLED)
break;
- streamOut = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, final_sendformat ? 0 : (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE));
- if (streamOut != NULL) {
- decoded = mir_utf8decodeW(streamOut);
- if (decoded != NULL) {
- char* utfResult = NULL;
- if (final_sendformat)
- DoRtfToTags(decoded, dat);
- rtrimt(decoded);
- bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0);
-
- if (!IsUtfSendAvailable(dat->hContact)) {
- flags |= PREF_UNICODE;
- memRequired = bufSize + ((lstrlenW(decoded) + 1) * sizeof(WCHAR));
- } else {
- flags |= PREF_UTF;
- utfResult = mir_utf8encodeT(decoded);
- memRequired = (int)(strlen(utfResult)) + 1;
- }
+ ptrA streamOut(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, final_sendformat ? 0 : (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE)));
+ if (streamOut == NULL)
+ break;
- /*
- * try to detect RTL
- */
+ ptrT decoded(mir_utf8decodeT(streamOut));
+ if (decoded == NULL)
+ break;
- SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0);
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- SendMessage(hwndEdit, EM_SETSEL, 0, -1);
- SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- if (pf2.wEffects & PFE_RTLPARA)
- if (SendQueue::RTL_Detect(decoded))
- flags |= PREF_RTL;
-
- SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0);
- SendMessage(hwndEdit, EM_SETSEL, -1, -1);
- InvalidateRect(hwndEdit, NULL, FALSE);
-
- if (memRequired > dat->iSendBufferSize) {
- dat->sendBuffer = (char *) mir_realloc(dat->sendBuffer, memRequired);
- dat->iSendBufferSize = memRequired;
- }
- if (utfResult) {
- CopyMemory(dat->sendBuffer, utfResult, memRequired);
- mir_free(utfResult);
- }
- else {
- WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, bufSize, 0, 0);
- if (flags & PREF_UNICODE)
- CopyMemory(&dat->sendBuffer[bufSize], decoded, (lstrlenW(decoded) + 1) * sizeof(WCHAR));
- }
- mir_free(decoded);
- }
- mir_free(streamOut);
+ char *utfResult = NULL;
+ if (final_sendformat)
+ DoRtfToTags(decoded, dat);
+ rtrimt(decoded);
+ int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0);
+
+ int memRequired = 0, flags = 0;
+ if (!IsUtfSendAvailable(dat->hContact)) {
+ flags |= PREF_UNICODE;
+ memRequired = bufSize + ((lstrlenW(decoded) + 1) * sizeof(WCHAR));
+ }
+ else {
+ flags |= PREF_UTF;
+ utfResult = mir_utf8encodeT(decoded);
+ memRequired = (int)(strlen(utfResult)) + 1;
}
+
+ // try to detect RTL
+ HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE);
+ SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0);
+
+ PARAFORMAT2 pf2;
+ ZeroMemory(&pf2, sizeof(PARAFORMAT2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_RTLPARA;
+ SendMessage(hwndEdit, EM_SETSEL, 0, -1);
+ SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
+ if (pf2.wEffects & PFE_RTLPARA)
+ if (SendQueue::RTL_Detect(decoded))
+ flags |= PREF_RTL;
+
+ SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0);
+ SendMessage(hwndEdit, EM_SETSEL, -1, -1);
+ InvalidateRect(hwndEdit, NULL, FALSE);
+
+ if (memRequired > dat->iSendBufferSize) {
+ dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired);
+ dat->iSendBufferSize = memRequired;
+ }
+ if (utfResult) {
+ CopyMemory(dat->sendBuffer, utfResult, memRequired);
+ mir_free(utfResult);
+ }
+ else {
+ WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, bufSize, 0, 0);
+ if (flags & PREF_UNICODE)
+ CopyMemory(&dat->sendBuffer[bufSize], decoded, (lstrlenW(decoded) + 1) * sizeof(WCHAR));
+ }
+
if (memRequired == 0 || dat->sendBuffer[0] == 0)
break;
if (dat->sendMode & SMODE_CONTAINER && m_pContainer->hwndActive == hwndDlg && GetForegroundWindow() == hwndContainer) {
- HWND contacthwnd;
- int tabCount = TabCtrl_GetItemCount(hwndTab), i;
- char *szFromStream = NULL;
-
- szFromStream = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, dat->SendFormat ? 0 : (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE));
+ int tabCount = TabCtrl_GetItemCount(hwndTab);
+ ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, dat->SendFormat ? 0 : (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE)));
TCITEM tci = { 0 };
tci.mask = TCIF_PARAM;
-
- for (i=0; i < tabCount; i++) {
+ for (int i=0; i < tabCount; i++) {
TabCtrl_GetItem(hwndTab, i, &tci);
// get the contact from the tabs lparam which hopefully is the tabs hwnd so we can get its userdata.... hopefully
- contacthwnd = (HWND)tci.lParam;
+ HWND contacthwnd = (HWND)tci.lParam;
if (IsWindow(contacthwnd)) {
// if the contact hwnd is the current contact then ignore it and let the normal code deal with the msg
if (contacthwnd != hwndDlg) {
@@ -2965,8 +2906,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
}
}
- if (szFromStream)
- mir_free(szFromStream);
}
// END /all /MOD
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
@@ -2984,16 +2923,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case IDC_QUOTE:
{
+ int iCharsPerLine = M.GetDword("quoteLineLength", 64);
CHARRANGE sel;
- TCHAR* szQuoted, *szText;
- char* szFromStream = NULL;
- HANDLE hDBEvent = 0;
- int iCharsPerLine = M.GetDword("quoteLineLength", 64);
- TCHAR *szConverted;
- int iAlloced = 0;
- unsigned int iSize = 0;
SETTEXTEX stx = {ST_SELECTION, 1200};
+ HANDLE hDBEvent = 0;
if (dat->hwndIEView || dat->hwndHPP) { // IEView quoting support..
TCHAR *selected = 0, *szQuoted = 0;
@@ -3033,49 +2967,48 @@ quote_from_last:
if (sel.cpMin == sel.cpMax) {
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(hDBEvent);
- szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
- dbei.pBlob = (BYTE *)szText;
+ TCHAR *szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
+ dbei.pBlob = (BYTE*)szText;
db_event_get(hDBEvent, &dbei);
- iSize = (int)(strlen((char *)dbei.pBlob)) + 1;
+ int iSize = int(strlen((char*)dbei.pBlob)) + 1;
+
+ bool iAlloced = false;
+ TCHAR *szConverted;
if (dbei.flags & DBEF_UTF) {
szConverted = mir_utf8decodeW((char*)szText);
- iAlloced = TRUE;
+ iAlloced = true;
}
else {
if (iSize != dbei.cbBlob)
- szConverted = (TCHAR*) & dbei.pBlob[iSize];
+ szConverted = (TCHAR*)&dbei.pBlob[iSize];
else {
szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
- iAlloced = TRUE;
- MultiByteToWideChar(CP_ACP, 0, (char *) dbei.pBlob, -1, szConverted, iSize);
+ iAlloced = true;
+ MultiByteToWideChar(CP_ACP, 0, (char*)dbei.pBlob, -1, szConverted, iSize);
}
}
if (dbei.eventType == EVENTTYPE_FILE) {
int iDescr = lstrlenA((char *)(szText + sizeof(DWORD)));
MoveMemory(szText, szText + sizeof(DWORD), iDescr);
- MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1);
+ MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD)+iDescr, dbei.cbBlob - iDescr - sizeof(DWORD)-1);
szText[iDescr] = '\r';
- szText[iDescr+1] = '\n';
- szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * (1 + lstrlenA((char *)szText)));
- MultiByteToWideChar(CP_ACP, 0, (char *) szText, -1, szConverted, 1 + lstrlenA((char *)szText));
- iAlloced = TRUE;
+ szText[iDescr + 1] = '\n';
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + lstrlenA((char *)szText)));
+ MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + lstrlenA((char *)szText));
+ iAlloced = true;
}
- szQuoted = QuoteText(szConverted, iCharsPerLine, 0);
+ ptrT szQuoted(QuoteText(szConverted, iCharsPerLine, 0));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
mir_free(szText);
- mir_free(szQuoted);
if (iAlloced)
mir_free(szConverted);
}
else {
- szFromStream = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), dat, SF_TEXT | SF_USECODEPAGE | SFF_SELECTION);
- wchar_t *converted = mir_utf8decodeW(szFromStream);
+ ptrA szFromStream(Message_GetFromStream(GetDlgItem(hwndDlg, IDC_LOG), dat, SF_TEXT | SF_USECODEPAGE | SFF_SELECTION));
+ ptrW converted(mir_utf8decodeW(szFromStream));
Utils::FilterEventMarkers(converted);
- szQuoted = QuoteText(converted, iCharsPerLine, 0);
+ ptrT szQuoted(QuoteText(converted, iCharsPerLine, 0));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- mir_free(szQuoted);
- mir_free(converted);
- mir_free(szFromStream);
}
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
@@ -3083,7 +3016,7 @@ quote_from_last:
case IDC_ADD:
{
- ADDCONTACTSTRUCT acs = {0};
+ ADDCONTACTSTRUCT acs = { 0 };
acs.hContact = dat->hContact;
acs.handleType = HANDLE_CONTACT;
acs.szProto = 0;
@@ -3142,48 +3075,45 @@ quote_from_last:
break;
}
- if ((HWND)wParam == GetDlgItem(hwndDlg,IDC_NAME/* IDC_PROTOCOL*/) && dat->hContact != 0) {
+ if ((HWND)wParam == GetDlgItem(hwndDlg, IDC_NAME) && dat->hContact != 0) {
GetCursorPos(&pt);
HMENU hMC = BuildMCProtocolMenu(hwndDlg);
- if (hMC) {
- int iSelection = 0;
- iSelection = TrackPopupMenu(hMC, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (iSelection < 1000 && iSelection >= 100) { // the "force" submenu...
- if (iSelection == 999) { // un-force
- if (CallService(MS_MC_UNFORCESENDCONTACT, (WPARAM)dat->hContact, 0) == 0)
- db_set_dw(dat->hContact, SRMSGMOD_T, "tabSRMM_forced", -1);
- else
- _DebugPopup(dat->hContact, TranslateT("Unforce failed"));
- }
- else {
- if (CallService(MS_MC_FORCESENDCONTACTNUM, (WPARAM)dat->hContact, (LPARAM)(iSelection - 100)) == 0)
- db_set_dw(dat->hContact, SRMSGMOD_T, "tabSRMM_forced", (DWORD)(iSelection - 100));
- else
- _DebugPopup(dat->hContact, TranslateT("The selected protocol cannot be forced at this time"));
- }
- }
- else if (iSelection >= 1000) // the "default" menu...
- CallService(MS_MC_SETDEFAULTCONTACTNUM, (WPARAM)dat->hContact, (LPARAM)(iSelection - 1000));
+ if (hMC == NULL)
+ break;
- DestroyMenu(hMC);
- InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
- return TRUE;
+ int iSelection = TrackPopupMenu(hMC, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (iSelection < 1000 && iSelection >= 100) { // the "force" submenu...
+ if (iSelection == 999) { // un-force
+ if (CallService(MS_MC_UNFORCESENDCONTACT, dat->hContact, 0) == 0)
+ db_set_dw(dat->hContact, SRMSGMOD_T, "tabSRMM_forced", -1);
+ else
+ _DebugPopup(dat->hContact, TranslateT("Unforce failed"));
+ }
+ else {
+ if (CallService(MS_MC_FORCESENDCONTACTNUM, dat->hContact, (LPARAM)(iSelection - 100)) == 0)
+ db_set_dw(dat->hContact, SRMSGMOD_T, "tabSRMM_forced", (DWORD)(iSelection - 100));
+ else
+ _DebugPopup(dat->hContact, TranslateT("The selected protocol cannot be forced at this time"));
+ }
}
+ else if (iSelection >= 1000) // the "default" menu...
+ CallService(MS_MC_SETDEFAULTCONTACTNUM, dat->hContact, (LPARAM)(iSelection - 1000));
+
+ DestroyMenu(hMC);
+ InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
+ return TRUE;
}
}
break;
- /*
- * this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
- * it receives:
- * wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
- (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId
- pairs.)
- * lParam = the original ackdata
- *
- * the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
- * *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
- */
+ // this is now *only* called from the global ME_PROTO_ACK handler (static int ProtoAck() in msgs.c)
+ // it receives:
+ // wParam = index of the sendjob in the queue in the low word, index of the found sendID in the high word
+ // (normally 0, but if its a multisend job, then the sendjob may contain more than one hContact/hSendId pairs.)
+ // lParam = the original ackdata
+ //
+ // the "per message window" ACK hook is gone, the global ack handler cares about all types of ack's (currently
+ // *_MESSAGE and *_AVATAR and dispatches them to the owner windows).
case HM_EVENTSENT:
sendQueue->ackMessage(dat, wParam, lParam);
return 0;
@@ -3191,10 +3121,9 @@ quote_from_last:
case DM_ACTIVATEME:
ActivateExistingTab(m_pContainer, hwndDlg);
return 0;
- /*
- * sent by the select container dialog box when a container was selected...
- * lParam = (TCHAR*)selected name...
- */
+
+ // sent by the select container dialog box when a container was selected...
+ // lParam = (TCHAR*)selected name...
case DM_CONTAINERSELECTED:
{
TCHAR *szNewName = (TCHAR*)lParam;
@@ -3228,19 +3157,14 @@ quote_from_last:
Utils::CopyToClipBoard(const_cast<TCHAR *>(dat->cache->getUIN()), hwndDlg);
return 0;
- /*
- * broadcasted when GLOBAL info panel setting changes
- */
+ // broadcasted when GLOBAL info panel setting changes
case DM_SETINFOPANEL:
CInfoPanel::setPanelHandler(dat, wParam, lParam);
return 0;
- /*
- * show the balloon tooltip control.
- * wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
- * lParam == new text to show
- */
-
+ // show the balloon tooltip control.
+ // wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
+ // lParam == new text to show
case DM_ACTIVATETOOLTIP:
if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
break;
@@ -3252,9 +3176,8 @@ quote_from_last:
if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
return 1;
break;
- /*
- * save the contents of the log as rtf file
- */
+
+ // save the contents of the log as rtf file
case DM_SAVEMESSAGELOG:
DM_SaveLogAsRTF(dat);
return 0;
@@ -3263,19 +3186,16 @@ quote_from_last:
DM_CheckAutoHide(dat, wParam, lParam);
return 0;
- // metacontact support
-
+ // metacontact support
case DM_UPDATEMETACONTACTINFO: // update the icon in the statusbar for the "most online" protocol
{
DWORD isForced;
if ((isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1)) >= 0) {
char szTemp[64];
mir_snprintf(szTemp, sizeof(szTemp), "Status%d", isForced);
- if (db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE) {
- TCHAR szBuffer[200];
- mir_sntprintf(szBuffer, 200, TranslateT("Warning: you have selected a subprotocol for sending the following messages which is currently offline"));
- SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer);
- }
+ if (db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE)
+ SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE,
+ (LPARAM)TranslateT("Warning: you have selected a subprotocol for sending the following messages which is currently offline"));
}
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
@@ -3320,7 +3240,7 @@ quote_from_last:
}
return TRUE;
- case DM_CLIENTCHANGED:
+ case DM_CLIENTCHANGED:
GetClientIcon(dat);
if (dat->hClientIcon && dat->Panel->isActive())
InvalidateRect(hwndDlg, NULL, TRUE);
@@ -3361,7 +3281,7 @@ quote_from_last:
case DM_BBNEEDUPDATE:
if (lParam)
- CB_ChangeButton(hwndDlg,dat,(CustomButtonData*)lParam);
+ CB_ChangeButton(hwndDlg, dat, (CustomButtonData*)lParam);
else
BB_InitDlgButtons(dat);
@@ -3370,22 +3290,20 @@ quote_from_last:
case DM_CBDESTROY:
if (lParam)
- CB_DestroyButton(hwndDlg,dat,(DWORD)wParam,(DWORD)lParam);
+ CB_DestroyButton(hwndDlg, dat, (DWORD)wParam, (DWORD)lParam);
else
- CB_DestroyAllButtons(hwndDlg,dat);
+ CB_DestroyAllButtons(hwndDlg, dat);
return 0;
case WM_DROPFILES:
{
BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000;
if (!not_sending) {
- const char* szProto = dat->cache->getActiveProto();
- int pcaps;
-
+ const char *szProto = dat->cache->getActiveProto();
if (szProto == NULL)
break;
- pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(pcaps & PF1_FILESEND))
break;
if (dat->wStatus == ID_STATUS_OFFLINE) {
@@ -3399,31 +3317,32 @@ quote_from_last:
}
}
}
+
if (dat->hContact != NULL) {
TCHAR szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
TCHAR** ppFiles = NULL;
- for (i=0; i < fileCount; i++) {
+ for (i = 0; i < fileCount; i++) {
DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
}
if (!not_sending)
- CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM)dat->hContact, (LPARAM)ppFiles);
+ CallService(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
else {
if (ServiceExists(MS_HTTPSERVER_ADDFILENAME)) {
- for (int i=0; i < totalCount; i++) {
- char* szFileName = mir_t2a( ppFiles[i] );
+ for (int i = 0; i < totalCount; i++) {
+ char* szFileName = mir_t2a(ppFiles[i]);
char *szTemp = (char*)CallService(MS_HTTPSERVER_ADDFILENAME, (WPARAM)szFileName, 0);
- mir_free( szFileName );
+ mir_free(szFileName);
}
char *szHTTPText = "DEBUG";
SendDlgItemMessageA(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)szHTTPText);
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
}
- for (i=0;ppFiles[i];i++)
+ for (i = 0; ppFiles[i]; i++)
mir_free(ppFiles[i]);
mir_free(ppFiles);
}
@@ -3432,38 +3351,32 @@ quote_from_last:
case DM_CHECKQUEUEFORCLOSE:
{
- int *uOpen = (int *)lParam;
+ int *uOpen = (int*)lParam;
if (uOpen)
*uOpen += dat->iOpenJobs;
}
return 0;
case WM_CLOSE:
- {
- int iTabs, i;
- TCITEM item = {0};
- RECT rc;
- TContainerData *pContainer = dat->pContainer;
-
- // esc handles error controls if we are in error state (error controls visible)
+ // esc handles error controls if we are in error state (error controls visible)
+ if (wParam == 0 && lParam == 0 && dat->dwFlags & MWF_ERRORSTATE) {
+ SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
+ return TRUE;
+ }
- if (wParam == 0 && lParam == 0 && dat->dwFlags & MWF_ERRORSTATE) {
- SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 0);
+ if (wParam == 0 && lParam == 0) {
+ if (PluginConfig.m_EscapeCloses == 1) {
+ SendMessage(hwndContainer, WM_SYSCOMMAND, SC_MINIMIZE, 0);
return TRUE;
}
-
- if (wParam == 0 && lParam == 0) {
- if (PluginConfig.m_EscapeCloses == 1) {
- SendMessage(hwndContainer, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- return TRUE;
- }
- else if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(hwndContainer, SW_HIDE);
- return TRUE;
- }
- _dlgReturn(hwndDlg, TRUE);
+ else if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
+ ShowWindow(hwndContainer, SW_HIDE);
+ return TRUE;
}
-
+ _dlgReturn(hwndDlg, TRUE);
+ }
+ {
+ TContainerData *pContainer = dat->pContainer;
if (dat->iOpenJobs > 0 && lParam != 2) {
if (dat->dwFlags & MWF_ERRORSTATE)
SendMessage(hwndDlg, DM_ERRORDECIDED, MSGERROR_CANCEL, 1);
@@ -3478,31 +3391,33 @@ quote_from_last:
return TRUE;
}
}
- iTabs = TabCtrl_GetItemCount(hwndTab);
+ int iTabs = TabCtrl_GetItemCount(hwndTab);
if (iTabs == 1) {
PostMessage(hwndContainer, WM_CLOSE, 0, 1);
return 1;
}
m_pContainer->iChilds--;
- i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
- /*
- * after closing a tab, we need to activate the tab to the left side of
- * the previously open tab.
- * normally, this tab has the same index after the deletion of the formerly active tab
- * unless, of course, we closed the last (rightmost) tab.
- */
+ // after closing a tab, we need to activate the tab to the left side of
+ // the previously open tab.
+ // normally, this tab has the same index after the deletion of the formerly active tab
+ // unless, of course, we closed the last (rightmost) tab.
if (!m_pContainer->bDontSmartClose && iTabs > 1 && lParam != 3) {
if (i == iTabs - 1)
i--;
else
i++;
TabCtrl_SetCurSel(hwndTab, i);
+
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, i, &item); // retrieve dialog hwnd for the now active tab...
- m_pContainer->hwndActive = (HWND) item.lParam;
+ m_pContainer->hwndActive = (HWND)item.lParam;
+
+ RECT rc;
SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW);
ShowWindow((HWND)item.lParam, SW_SHOW);
@@ -3524,7 +3439,7 @@ quote_from_last:
break;
if (PluginConfig.g_FlashAvatarAvail) {
- FLASHAVATAR fa = {0};
+ FLASHAVATAR fa = { 0 };
fa.hContact = dat->hContact;
fa.id = 25367;
fa.cProto = dat->szProto;
@@ -3548,7 +3463,6 @@ quote_from_last:
AddContactToFavorites(dat->hContact, dat->cache->getNick(), dat->cache->getActiveProto(), dat->szStatus, dat->wStatus,
LoadSkinnedProtoIcon(dat->cache->getActiveProto(), dat->cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
if (dat->hContact) {
-
if (!dat->fEditNotesActive) {
char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE));
if (msg) {
@@ -3569,22 +3483,19 @@ quote_from_last:
mir_free(dat->sendBuffer);
mir_free(dat->hHistoryEvents);
- /*
- * search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
- * messages in the queue as they can be acked later
- */
+ // search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
+ // messages in the queue as they can be acked later
{
SendJob *jobs = sendQueue->getJobByIndex(0);
- for (int i=0; i < SendQueue::NR_SENDJOBS; i++) {
+ for (int i = 0; i < SendQueue::NR_SENDJOBS; i++) {
if (jobs[i].hOwner == dat->hContact) {
- if (jobs[i].iStatus > (unsigned)SendQueue::SQ_INPROGRESS)
+ if (jobs[i].iStatus >(unsigned)SendQueue::SQ_INPROGRESS)
sendQueue->clearJob(i);
- /*
- * unfinished jobs which did not yet return anything are kept in the queue.
- * the hwndOwner is set to 0 because the window handle is now no longer valid.
- * Response for such a job is still silently handled by AckMessage() (sendqueue.c)
- */
+
+ // unfinished jobs which did not yet return anything are kept in the queue.
+ // the hwndOwner is set to 0 because the window handle is now no longer valid.
+ // Response for such a job is still silently handled by AckMessage() (sendqueue.c)
if (jobs[i].iStatus == (unsigned)SendQueue::SQ_INPROGRESS)
jobs[i].hwndOwner = 0;
}
@@ -3614,8 +3525,8 @@ quote_from_last:
db_set_dw(0, SRMSGMOD, "multisplit", dat->multiSplitterX);
{
- HFONT hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
- if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
DeleteObject(hFont);
TCITEM item = { 0 };
@@ -3632,10 +3543,7 @@ quote_from_last:
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
- /*
- * clean up IEView and H++ log windows
- */
-
+ // clean up IEView and H++ log windows
if (dat->hwndIEView != 0) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
@@ -3679,7 +3587,7 @@ quote_from_last:
dat->cache->setWindowData();
if (dat->cache->isValid() && !dat->fIsReattach && dat->hContact && M.GetByte("deletetemp", 0))
if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
delete dat->Panel;
mir_free(dat);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 06ad8cb2cc..91e977e721 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -375,7 +375,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
if ( (si != NULL) && (dat->hContact != NULL)) {
char *szProto = GetContactProto(dat->hContact);
if (szProto)
- CallProtoService( szProto, PS_LEAVECHAT, (WPARAM)dat->hContact, 0 );
+ CallProtoService( szProto, PS_LEAVECHAT, dat->hContact, 0 );
}
}
return 1;
@@ -418,13 +418,13 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
break;
case ID_PICMENU_SETTINGS: {
if (menuId == MENU_PANELPICMENU)
- CallService(MS_AV_CONTACTOPTIONS, (WPARAM)dat->hContact, 0);
+ CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
else if (menuId == MENU_PICMENU) {
if (dat->Panel->isActive()) {
if (ServiceExists(MS_AV_SETMYAVATAR) && CallService(MS_AV_CANSETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0))
CallService(MS_AV_SETMYAVATAR, (WPARAM)(dat->cache->getActiveProto()), 0);
} else
- CallService(MS_AV_CONTACTOPTIONS, (WPARAM)dat->hContact, 0);
+ CallService(MS_AV_CONTACTOPTIONS, dat->hContact, 0);
}
}
return 1;
@@ -448,7 +448,7 @@ int TSAPI MsgWindowMenuHandler(TWindowData *dat, int selection, int menuId)
return 1;
case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
- CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)dat->hContact, 0);
+ CallService(MS_TABMSG_SETUSERPREFS, dat->hContact, 0);
return 1;
}
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 98dde21f3b..00536e4e68 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -621,7 +621,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest
}
if (dat->bType == SESSIONTYPE_IM)
- SendMessage(pContainer->hwnd, DM_UPDATETITLE, (WPARAM)dat->hContact, 0);
+ SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
if (IsIconic(pContainer->hwnd)) {
SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(pContainer->hwnd);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index ae06aa7ee8..f328f1dfc8 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -774,7 +774,7 @@ HICON Utils::iconFromAvatar(const TWindowData *dat)
if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == NULL)
return 0;
- AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->hContact, 0);
+ AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, dat->hContact, 0);
if (ace == NULL || ace->hbmPic == NULL)
return NULL;