diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-29 14:19:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-29 14:19:12 +0000 |
commit | c1840425166576b1cf187076a9344a78a20375b6 (patch) | |
tree | 7c7e1d66219c7b2ed6b57a397ac67b3541aa127e /plugins/TabSRMM/chat | |
parent | d80ee102fba0f99ad2ab0e0e734267f76b3b639e (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@686 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/chat')
-rw-r--r-- | plugins/TabSRMM/chat/clist.cpp | 12 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/log.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/main.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/manager.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/muchighlight.cpp | 56 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/options.cpp | 26 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/services.cpp | 448 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/tools.cpp | 44 | ||||
-rw-r--r-- | plugins/TabSRMM/chat/window.cpp | 182 |
9 files changed, 378 insertions, 404 deletions
diff --git a/plugins/TabSRMM/chat/clist.cpp b/plugins/TabSRMM/chat/clist.cpp index 540997aa87..cd19765bdf 100644 --- a/plugins/TabSRMM/chat/clist.cpp +++ b/plugins/TabSRMM/chat/clist.cpp @@ -55,13 +55,13 @@ static HANDLE Clist_GroupExists(TCHAR *tszGroup) if (!result) {
match = (!_tcscmp(tszGroup, &dbv.ptszVal[1]) && (lstrlen(tszGroup) == lstrlen(&dbv.ptszVal[1])));
DBFreeVariant(&dbv);
- if(match)
+ if (match)
return((HANDLE)(i + 1));
}
i++;
}
while(result == 0);
- return(0);
+ return 0;
}
HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType)
@@ -170,9 +170,9 @@ int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam) fCreate = true;
ShowRoom(si, WINDOW_VISIBLE, TRUE);
- if(lParam && fCreate) {
+ if (lParam && fCreate) {
SendMessage(si->hWnd, DM_ACTIVATEME, 0, 0);
- if(si->dat)
+ if (si->dat)
SetForegroundWindow(si->dat->pContainer->hwnd);
}
}
@@ -260,10 +260,10 @@ void CList_CreateGroup(TCHAR* group) g_Settings.hGroup = Clist_GroupExists(group);
- if(g_Settings.hGroup == 0) {
+ if (g_Settings.hGroup == 0) {
g_Settings.hGroup = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)group);
- if(g_Settings.hGroup) {
+ if (g_Settings.hGroup) {
CallService(MS_CLUI_GROUPADDED, (WPARAM)g_Settings.hGroup, 0);
CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)g_Settings.hGroup, 1);
}
diff --git a/plugins/TabSRMM/chat/log.cpp b/plugins/TabSRMM/chat/log.cpp index d0fcf2e299..70178ada75 100644 --- a/plugins/TabSRMM/chat/log.cpp +++ b/plugins/TabSRMM/chat/log.cpp @@ -770,7 +770,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) // ### RTF HEADER
- if(0 == mi->pszHeader)
+ if (0 == mi->pszHeader)
mi->pszHeader = Log_CreateRtfHeader(mi);
header = mi->pszHeader;
diff --git a/plugins/TabSRMM/chat/main.cpp b/plugins/TabSRMM/chat/main.cpp index b4d40e20ef..bf57bd0bb0 100644 --- a/plugins/TabSRMM/chat/main.cpp +++ b/plugins/TabSRMM/chat/main.cpp @@ -56,12 +56,12 @@ char *pszActiveWndModule = 0; int Chat_Load()
{
- if(M->GetByte("forceDisableMUC", 0)) {
+ if (M->GetByte("forceDisableMUC", 0)) {
PluginConfig.m_chat_enabled = false;
- return(0);
+ return 0;
}
g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
- if(CreateServiceFunctions()) {
+ if (CreateServiceFunctions()) {
HookEvents();
CreateHookableEvents();
OptionsInit();
diff --git a/plugins/TabSRMM/chat/manager.cpp b/plugins/TabSRMM/chat/manager.cpp index d1c2a27aa3..1859ade1a9 100644 --- a/plugins/TabSRMM/chat/manager.cpp +++ b/plugins/TabSRMM/chat/manager.cpp @@ -80,7 +80,7 @@ SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule) MODULEINFO *mi = MM_FindModule(pszModule);
- if(mi) {
+ if (mi) {
mi->idleTimeStamp = time(0);
SM_BroadcastMessage(pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
}
@@ -687,7 +687,7 @@ BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce) SM_MoveUser(pTemp->ptszID, pTemp->pszModule, ui->pszUID);
if (pTemp->hWnd) {
SendMessage(pTemp->hWnd, GC_UPDATENICKLIST, 0, 0);
- if(pTemp->dat)
+ if (pTemp->dat)
GetMyNick(pTemp->dat);
SendMessage(pTemp->hWnd, GC_UPDATESTATUSBAR, 0, 0);
}
@@ -1040,7 +1040,7 @@ BOOL MM_RemoveAll(void) MODULEINFO *pLast = m_ModList->next;
mir_free(m_ModList->pszModule);
mir_free(m_ModList->ptszModDispName);
- if(m_ModList->pszHeader)
+ if (m_ModList->pszHeader)
mir_free(m_ModList->pszHeader);
mir_free(m_ModList->crColors);
diff --git a/plugins/TabSRMM/chat/muchighlight.cpp b/plugins/TabSRMM/chat/muchighlight.cpp index 806a8544e8..dd06f27d74 100644 --- a/plugins/TabSRMM/chat/muchighlight.cpp +++ b/plugins/TabSRMM/chat/muchighlight.cpp @@ -38,16 +38,16 @@ void CMUCHighlight::cleanup()
{
- if(m_NickPatternString)
+ if (m_NickPatternString)
mir_free(m_NickPatternString);
- if(m_TextPatternString)
+ if (m_TextPatternString)
mir_free(m_TextPatternString);
m_TextPatternString = m_NickPatternString = 0;
- if(m_NickPatterns)
+ if (m_NickPatterns)
mir_free(m_NickPatterns);
- if(m_TextPatterns)
+ if (m_TextPatterns)
mir_free(m_TextPatterns);
m_iNickPatterns = m_iTextPatterns = 0;
@@ -58,18 +58,18 @@ void CMUCHighlight::init() {
DBVARIANT dbv = {0};
- if(m_fInitialized)
+ if (m_fInitialized)
cleanup(); // clean up first, if we were already initialized
m_fInitialized = true;
- if(0 == M->GetTString(0, "Chat", "HighlightWords", &dbv)) {
+ if (0 == M->GetTString(0, "Chat", "HighlightWords", &dbv)) {
m_TextPatternString = dbv.ptszVal;
_wsetlocale(LC_ALL, L"");
wcslwr(m_TextPatternString);
}
- if(0 == M->GetTString(0, "Chat", "HighlightNames", &dbv))
+ if (0 == M->GetTString(0, "Chat", "HighlightNames", &dbv))
m_NickPatternString = dbv.ptszVal;
m_dwFlags = M->GetByte("Chat", "HighlightEnabled", MATCH_TEXT);
@@ -86,7 +86,7 @@ void CMUCHighlight::init() void CMUCHighlight::tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr)
{
- if(tszString == 0)
+ if (tszString == 0)
return;
TCHAR *p = tszString;
@@ -133,8 +133,8 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF {
int result = 0, nResult = 0;
- if(pgce == 0 || m_Valid == false)
- return(0);
+ if (pgce == 0 || m_Valid == false)
+ return 0;
__try {
if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != 0) {
@@ -148,14 +148,14 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF UINT i = 0;
TCHAR *tszMe = ((psi && psi->pMe) ? mir_tstrdup(psi->pMe->pszNick) : 0);
- if(tszMe) {
+ if (tszMe) {
_wsetlocale(LC_ALL, L"");
wcslwr(tszMe);
}
- if(m_fHighlightMe && tszMe) {
+ if (m_fHighlightMe && tszMe) {
result = wcsstr(p, tszMe) ? MATCH_TEXT : 0;
- if(0 == m_iTextPatterns)
+ if (0 == m_iTextPatterns)
goto skip_textpatterns;
}
while(p && !result) {
@@ -175,7 +175,7 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF for(i = 0; i < m_iTextPatterns && !result; i++)
result = wildmatch(m_TextPatterns[i], p) ? MATCH_TEXT : 0;
- if(p1) {
+ if (p1) {
*p1 = ' ';
p = p1 + 1;
}
@@ -192,13 +192,13 @@ skip_textpatterns: #ifdef __HLT_PERFSTATS
M->stopTimer(0);
- if(psi && psi->dat) {
+ if (psi && psi->dat) {
mir_sntprintf(psi->dat->szStatusBar, 100, _T("PERF text match: %d ticks = %f msec (%d words, %d patterns)"), (int)M->getTicks(), M->getMsec(), words, m_iTextPatterns);
- if(psi->dat->pContainer->hwndStatus)
+ if (psi->dat->pContainer->hwndStatus)
::SendMessage(psi->dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)psi->dat->szStatusBar);
}
#endif
- if(tszMe)
+ if (tszMe)
mir_free(tszMe);
}
@@ -207,7 +207,7 @@ skip_textpatterns: */
if ((m_dwFlags & MATCH_NICKNAME) && (dwFlags & MATCH_NICKNAME) && pgce->ptszNick && m_iNickPatterns > 0) {
for(UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
- if(pgce->ptszNick)
+ if (pgce->ptszNick)
nResult = wildmatch(m_NickPatterns[i], pgce->ptszNick) ? MATCH_NICKNAME : 0;
if ((m_dwFlags & MATCH_UIN) && pgce->ptszUserInfo)
nResult = wildmatch(m_NickPatterns[i], pgce->ptszUserInfo) ? MATCH_NICKNAME : 0;
@@ -218,9 +218,9 @@ skip_textpatterns: }
__except(CGlobals::Ex_ShowDialog(GetExceptionInformation(), __FILE__, __LINE__, L"MUC_HIGHLIGHT_EXCEPTION", false)) {
m_Valid = false;
- return(0);
+ return 0;
}
- return(0);
+ return 0;
}
int CMUCHighlight::wildmatch(const TCHAR *pattern, const TCHAR *tszString) {
@@ -272,12 +272,12 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TranslateDialogDefault(hwndDlg);
- if(0 == M->GetTString(0, "Chat", "HighlightWords", &dbv)) {
+ if (0 == M->GetTString(0, "Chat", "HighlightWords", &dbv)) {
::SetDlgItemTextW(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, dbv.ptszVal);
::DBFreeVariant(&dbv);
}
- if(0 == M->GetTString(0, "Chat", "HighlightNames", &dbv)) {
+ if (0 == M->GetTString(0, "Chat", "HighlightNames", &dbv)) {
::SetDlgItemTextW(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, dbv.ptszVal);
::DBFreeVariant(&dbv);
}
@@ -326,14 +326,14 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t* szBuf = 0;
int iLen = ::GetWindowTextLengthW(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTNICKPATTERN));
- if(iLen) {
+ if (iLen) {
szBuf = reinterpret_cast<wchar_t *>(mir_alloc((iLen + 2) * sizeof(wchar_t)));
::GetDlgItemTextW(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, szBuf, iLen + 1);
M->WriteTString(0, "Chat", "HighlightNames",szBuf);
}
iLen = ::GetWindowTextLengthW(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN));
- if(iLen) {
+ if (iLen) {
szBuf = reinterpret_cast<TCHAR *>(mir_realloc(szBuf, sizeof(wchar_t) * (iLen + 2)));
::GetDlgItemTextW(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, szBuf, iLen + 1);
M->WriteTString(0, "Chat", "HighlightWords", szBuf);
@@ -345,7 +345,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L BYTE dwFlags = (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? MATCH_NICKNAME : 0) |
(::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? MATCH_TEXT : 0);
- if(dwFlags & MATCH_NICKNAME)
+ if (dwFlags & MATCH_NICKNAME)
dwFlags |= (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKUID) ? MATCH_UIN : 0);
M->WriteByte("Chat", "HighlightEnabled", dwFlags);
@@ -384,7 +384,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProcAdd(HWND hwndDlg, UINT msg, WPARAM wParam hFont = ::CreateFontIndirectW(&lf);
::SendDlgItemMessage(hwndDlg, IDC_ADDHIGHLIGHTTITLE, WM_SETFONT, (WPARAM)hFont, FALSE);
- if(the->uCmd == THighLightEdit::CMD_ADD) {
+ if (the->uCmd == THighLightEdit::CMD_ADD) {
Utils::showDlgControl(hwndDlg, IDC_ADDHIGHLIGHTEDITLIST, SW_HIDE);
::SetDlgItemTextW(hwndDlg, IDC_ADDHIGHLIGHTTITLE, TranslateT("Add user to highlight list"));
::SendDlgItemMessageW(hwndDlg, IDC_ADDHIGHLIGHTNAME, CB_INSERTSTRING, -1, (LPARAM)the->ui->pszNick);
@@ -404,14 +404,14 @@ INT_PTR CALLBACK CMUCHighlight::dlgProcAdd(HWND hwndDlg, UINT msg, WPARAM wParam HWND hwndChild = (HWND)lParam;
UINT id = ::GetDlgCtrlID(hwndChild);
- if(hwndChild == ::GetDlgItem(hwndDlg, IDC_ADDHIGHLIGHTTITLE))
+ if (hwndChild == ::GetDlgItem(hwndDlg, IDC_ADDHIGHLIGHTTITLE))
::SetTextColor((HDC)wParam, RGB(60, 60, 150));
::SetBkColor((HDC)wParam, ::GetSysColor(COLOR_WINDOW));
return (INT_PTR)::GetSysColorBrush(COLOR_WINDOW);
}
case WM_COMMAND: {
- if(LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
::DestroyWindow(hwndDlg);
break;
}
diff --git a/plugins/TabSRMM/chat/options.cpp b/plugins/TabSRMM/chat/options.cpp index 77f6cb0f82..94278328a5 100644 --- a/plugins/TabSRMM/chat/options.cpp +++ b/plugins/TabSRMM/chat/options.cpp @@ -259,7 +259,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfOrientation = 0;
wsprintfA(str, "Font%dSty", i);
style = M->GetByte(szMod, str, fol[j].defStyle);
- if(i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M->GetByte(0, SRMSGMOD_T, "inputFontFix", 1) == 1) {
+ if (i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M->GetByte(0, SRMSGMOD_T, "inputFontFix", 1) == 1) {
lf->lfWeight = FW_NORMAL;
lf->lfItalic = 0;
lf->lfUnderline = 0;
@@ -781,7 +781,7 @@ void RegisterFontServiceFonts() { fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
fid.deffontsettings.charset = lf.lfCharSet;
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
- if(i==IPFONTCOUNT-1){
+ if (i==IPFONTCOUNT-1){
_tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
_tcsncpy(fid.group, _T("TabSRMM"), SIZEOF(fid.group));
@@ -808,7 +808,7 @@ void RegisterFontServiceFonts() { _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
_tcsncpy(fid.backgroundGroup, _T("TabSRMM/Group Chats"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, _T("Group chat log background"), SIZEOF(fid.backgroundName));
- if(i == 18 || i == 19)
+ if (i == 18 || i == 19)
_tcsncpy(fid.backgroundName, _T("Userlist background"), SIZEOF(fid.backgroundName));
FontRegisterT(&fid);
}
@@ -850,7 +850,7 @@ void RegisterFontServiceFonts() { _tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting));
- if(_clrs[i].def & 0xff000000)
+ if (_clrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
else
cid.defcolour = _clrs[i].def;
@@ -867,7 +867,7 @@ void RegisterFontServiceFonts() { _tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting));
- if(_tabclrs[i].def & 0xff000000)
+ if (_tabclrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
else
cid.defcolour = _tabclrs[i].def;
@@ -1025,7 +1025,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s%s"), M->getChatLogPath(), p);
- if(PathFileExists(tszInitialDir))
+ if (PathFileExists(tszInitialDir))
ofn.lpstrInitialDir = tszInitialDir;
else {
mir_sntprintf(tszInitialDir, MAX_PATH, _T("%s"), M->getChatLogPath());
@@ -1192,7 +1192,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
break;
case WM_TIMER:
- if(IsWindow(hPathTip))
+ if (IsWindow(hPathTip))
KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
break;
case WM_DESTROY:
@@ -1247,7 +1247,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DWORD dwLogFlags = M->GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
for(int i = 0; _eventorder[i]; i++) {
- if(_eventorder[i] != GC_EVENT_HIGHLIGHT) {
+ if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
}
@@ -1279,7 +1279,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM dwPopupFlags = 0, dwLogFlags = 0;
for(int i = 0; _eventorder[i]; i++) {
- if(_eventorder[i] != GC_EVENT_HIGHLIGHT) {
+ if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
}
@@ -1391,7 +1391,7 @@ void LoadGlobalSettings(void) // nicklist
- if(g_Settings.UserListFont) {
+ if (g_Settings.UserListFont) {
DeleteObject(g_Settings.UserListFont);
DeleteObject(g_Settings.UserListHeadingsFont);
}
@@ -1426,7 +1426,7 @@ static void FreeGlobalSettings(void) mir_free(g_Settings.pszTimeStampLog);
mir_free(g_Settings.pszIncomingNick);
mir_free(g_Settings.pszOutgoingNick);
- if(g_Settings.UserListFont) {
+ if (g_Settings.UserListFont) {
DeleteObject(g_Settings.UserListFont);
DeleteObject(g_Settings.UserListHeadingsFont);
}
@@ -1451,10 +1451,10 @@ int OptionsInit(void) ZeroMemory(&g_Settings, sizeof(TMUCSettings));
g_Settings.NameFont = CreateFontIndirect(&lf);
g_Settings.iSplitterX = DBGetContactSettingWord(NULL, "Chat", "SplitterX", 105);
- if(g_Settings.iSplitterX <= 50)
+ if (g_Settings.iSplitterX <= 50)
g_Settings.iSplitterX = 105;
g_Settings.iSplitterY = DBGetContactSettingWord(NULL, "Chat", "splitY", 50);
- if(g_Settings.iSplitterY <= 20)
+ if (g_Settings.iSplitterY <= 20)
g_Settings.iSplitterY = 50;
g_Settings.hGroup = 0;
LoadGlobalSettings();
diff --git a/plugins/TabSRMM/chat/services.cpp b/plugins/TabSRMM/chat/services.cpp index 7f256f3d30..8a8800ed05 100644 --- a/plugins/TabSRMM/chat/services.cpp +++ b/plugins/TabSRMM/chat/services.cpp @@ -39,40 +39,26 @@ #include "../src/commonheaders.h"
// defs
-extern HICON hIcons[30];
-
-HANDLE hSendEvent;
-HANDLE hBuildMenuEvent;
-HANDLE hJoinMenuItem, hLeaveMenuItem;
-HANDLE g_hHookPrebuildMenu;
-CRITICAL_SECTION cs;
-
-static HANDLE hServiceRegister = NULL,
- hServiceNewChat = NULL,
- hServiceAddEvent = NULL,
- hServiceGetAddEventPtr = NULL,
- hServiceGetInfo = NULL,
- hServiceGetCount = NULL,
- hEventPrebuildMenu = NULL,
- hEventDoubleclicked = NULL,
- hEventJoinChat = NULL,
- hEventLeaveChat = NULL;
-
-#ifdef _WIN64
-
-#define SIZEOF_STRUCT_GCREGISTER_V1 40
-#define SIZEOF_STRUCT_GCWINDOW_V1 48
-#define SIZEOF_STRUCT_GCEVENT_V1 76
-#define SIZEOF_STRUCT_GCEVENT_V2 80
-
-#else
-
-#define SIZEOF_STRUCT_GCREGISTER_V1 28
-#define SIZEOF_STRUCT_GCWINDOW_V1 32
-#define SIZEOF_STRUCT_GCEVENT_V1 44
-#define SIZEOF_STRUCT_GCEVENT_V2 48
-
-#endif
+extern HICON hIcons[30];
+
+CRITICAL_SECTION cs;
+
+HANDLE hSendEvent;
+HANDLE hBuildMenuEvent;
+HANDLE hJoinMenuItem, hLeaveMenuItem;
+HANDLE g_hHookPrebuildMenu;
+
+static HANDLE
+ hServiceRegister = NULL,
+ hServiceNewChat = NULL,
+ hServiceAddEvent = NULL,
+ hServiceGetAddEventPtr = NULL,
+ hServiceGetInfo = NULL,
+ hServiceGetCount = NULL,
+ hEventPrebuildMenu = NULL,
+ hEventDoubleclicked = NULL,
+ hEventJoinChat = NULL,
+ hEventLeaveChat = NULL;
int Chat_ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
@@ -184,7 +170,7 @@ INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) if (gcr == NULL)
return GC_REGISTER_ERROR;
- if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
+ if (gcr->cbSize != sizeof(GCREGISTER))
return GC_REGISTER_WRONGVER;
EnterCriticalSection(&cs);
@@ -225,7 +211,7 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) if (gcw == NULL)
return GC_NEWSESSION_ERROR;
- if (gcw->cbSize != SIZEOF_STRUCT_GCWINDOW_V1)
+ if (gcw->cbSize != sizeof(GCSESSION))
return GC_NEWSESSION_WRONGVER;
EnterCriticalSection(&cs);
@@ -274,7 +260,8 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
if (si->hContact)
Chat_SetFilters(si);
- } else {
+ }
+ else {
SESSION_INFO* si2 = SM_FindSession(ptszID, gcw->pszModule);
if (si2) {
@@ -302,115 +289,116 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) static int DoControl(GCEVENT * gce, WPARAM wp)
{
- if (gce->pDest->iType == GC_EVENT_CONTROL) {
+ SESSION_INFO* si;
+
+ switch(gce->pDest->iType) {
+ case GC_EVENT_CONTROL:
switch (wp) {
case WINDOW_HIDDEN:
- {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- si->bInitDone = TRUE;
- SetActiveSession(si->ptszID, si->pszModule);
- if (si->hWnd)
- ShowRoom(si, wp, FALSE);
- }
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ si->bInitDone = TRUE;
+ SetActiveSession(si->ptszID, si->pszModule);
+ if (si->hWnd)
+ ShowRoom(si, wp, FALSE);
}
return 0;
- case WINDOW_MINIMIZE:
- case WINDOW_MAXIMIZE:
- case WINDOW_VISIBLE:
+ case WINDOW_MINIMIZE:
+ case WINDOW_MAXIMIZE:
+ case WINDOW_VISIBLE:
case SESSION_INITDONE:
- {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- si->bInitDone = TRUE;
- if (wp != SESSION_INITDONE || M->GetByte("Chat", "PopupOnJoin", 0) == 0)
- ShowRoom(si, wp, TRUE);
- return 0;
- } }
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ si->bInitDone = TRUE;
+ if (wp != SESSION_INITDONE || M->GetByte("Chat", "PopupOnJoin", 0) == 0)
+ ShowRoom(si, wp, TRUE);
+ return 0;
+ }
break;
- case SESSION_OFFLINE:
- SM_SetOffline(gce->pDest->ptszID, gce->pDest->pszModule);
- // fall through
+ case SESSION_OFFLINE:
+ SM_SetOffline(gce->pDest->ptszID, gce->pDest->pszModule);
+ // fall through
- case SESSION_ONLINE:
- SM_SetStatus(gce->pDest->ptszID, gce->pDest->pszModule, wp == SESSION_ONLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
- break;
+ case SESSION_ONLINE:
+ SM_SetStatus(gce->pDest->ptszID, gce->pDest->pszModule, wp == SESSION_ONLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
+ break;
case WINDOW_CLEARLOG:
- {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- LM_RemoveAll(&si->pLog, &si->pLogEnd);
- si->iEventCount = 0;
- si->LastTime = 0;
- }
- break;
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ si->iEventCount = 0;
+ si->LastTime = 0;
}
- case SESSION_TERMINATE:
- return SM_RemoveSession(gce->pDest->ptszID, gce->pDest->pszModule, (gce->dwFlags & GCEF_REMOVECONTACT) != 0);
+ break;
+
+ case SESSION_TERMINATE:
+ return SM_RemoveSession(gce->pDest->ptszID, gce->pDest->pszModule, (gce->dwFlags & GCEF_REMOVECONTACT) != 0);
}
SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
- }
+ break;
- else if (gce->pDest->iType == GC_EVENT_CHUID && gce->pszText)
- {
- SM_ChangeUID(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
- }
+ case GC_EVENT_CHUID:
+ if (gce->pszText)
+ SM_ChangeUID(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
+ break;
- else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->pszText)
- {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- replaceStr(&si->ptszName, gce->ptszText);
- if (si->hWnd)
- SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
+ case GC_EVENT_CHANGESESSIONAME:
+ if (gce->pszText) {
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ replaceStr(&si->ptszName, gce->ptszText);
+ if (si->hWnd)
+ SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
+ }
}
- }
+ break;
- else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ case GC_EVENT_SETITEMDATA:
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si)
si->dwItemData = gce->dwItemData;
- }
+ break;
- else if (gce->pDest->iType == GC_EVENT_GETITEMDATA) {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ case GC_EVENT_GETITEMDATA:
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
gce->dwItemData = si->dwItemData;
return si->dwItemData;
}
return 0;
- }
- else if (gce->pDest->iType == GC_EVENT_SETSBTEXT)
- {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+
+ case GC_EVENT_SETSBTEXT:
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
replaceStr(&si->ptszStatusbarText, gce->ptszText);
if (si->ptszStatusbarText)
M->WriteTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", "");
- if (si->hWnd) {
+ if (si->hWnd)
SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
- }
}
- }
- else if (gce->pDest->iType == GC_EVENT_ACK)
- {
+ break;
+
+ case GC_EVENT_ACK:
SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_ACKMESSAGE, 0, 0);
- }
- else if (gce->pDest->iType == GC_EVENT_SENDMESSAGE && gce->pszText)
- {
- SM_SendUserMessage(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText);
- }
- else if (gce->pDest->iType == GC_EVENT_SETSTATUSEX)
- {
+ break;
+
+ case GC_EVENT_SENDMESSAGE:
+ if (gce->pszText)
+ SM_SendUserMessage(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText);
+ break;
+
+ case GC_EVENT_SETSTATUSEX:
SM_SetStatusEx(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText, gce->dwItemData);
+ break;
+
+ default:
+ return 1;
}
- else return 1;
-
return 0;
}
@@ -431,7 +419,7 @@ static void AddUser(GCEVENT * gce) if (si->hWnd) {
SendMessage(si->hWnd, GC_UPDATENICKLIST, (WPARAM)0, (LPARAM)0);
- if(si->dat)
+ if (si->dat)
GetMyNick(si->dat);
}
}
@@ -440,19 +428,10 @@ static void AddUser(GCEVENT * gce) HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup)
{
- TCHAR *contactName = NULL, newcontactname[128];
- char *szProto, *szStatus;
- WORD wStatus;
- int newItem;
- HWND hwndNew = 0;
- struct TNewWindowData newData = {
- 0
- };
HANDLE hContact = si->hContact;
- HWND hwndTab;
-
if (M->FindWindow(hContact) != 0)
return 0;
+
if (hContact != 0 && M->GetByte("limittabs", 0) && !_tcsncmp(pContainer->szName, _T("default"), 6)) {
if ((pContainer = FindMatchingContainer(_T("default"), hContact)) == NULL) {
TCHAR szName[CONTAINER_NAMELEN + 1];
@@ -461,38 +440,39 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact);
}
}
+
+ TNewWindowData newData = { 0 };
newData.hContact = hContact;
newData.isWchar = 0;
newData.szInitialText = NULL;
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) newData.hContact, 0);
-
- ZeroMemory((void *)&newData.item, sizeof(newData.item));
+ memset(&newData.item, 0, sizeof(newData.item));
- contactName = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) newData.hContact, GCDNF_TCHAR);
+ TCHAR *contactName = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) newData.hContact, GCDNF_TCHAR);
/*
* cut nickname if larger than x chars...
*/
- if (contactName && lstrlen(contactName) > 0) {
+ TCHAR newcontactname[128];
+ if ( lstrlen(contactName) > 0) {
if (M->GetByte("cuttitle", 0))
CutContactName(contactName, newcontactname, safe_sizeof(newcontactname));
else {
lstrcpyn(newcontactname, contactName, safe_sizeof(newcontactname));
newcontactname[127] = 0;
}
- } else
- lstrcpyn(newcontactname, _T("_U_"), sizeof(newcontactname) / sizeof(TCHAR));
+ }
+ else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname));
- wStatus = szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE);
- szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) newData.hContact, 0);
+ WORD wStatus = szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE) newData.hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ char *szStatus = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord((HANDLE)newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
newData.item.pszText = newcontactname;
-
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
newData.item.iImage = 0;
- hwndTab = GetDlgItem(pContainer->hwnd, 1159);
+ HWND hwndTab = GetDlgItem(pContainer->hwnd, 1159);
// hide the active tab
if (pContainer->hwndActive && bActivateTab)
@@ -523,7 +503,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT }
}
- newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item);
+ int newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item);
SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0);
if (bActivateTab)
TabCtrl_SetCurSel(hwndTab, newItem);
@@ -534,10 +514,10 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT pContainer->iChilds++;
newData.bWantPopup = bWantPopup;
newData.hdbEvent = (HANDLE)si;
- hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), GetDlgItem(pContainer->hwnd, 1159), RoomWndProc, (LPARAM) & newData);
- if(pContainer->dwFlags & CNT_SIDEBAR) {
+ HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), GetDlgItem(pContainer->hwnd, 1159), RoomWndProc, (LPARAM) & newData);
+ if (pContainer->dwFlags & CNT_SIDEBAR) {
TWindowData *dat = (TWindowData *)GetWindowLongPtr(hwndNew, GWLP_USERDATA);
- if(dat)
+ if (dat)
pContainer->SideBar->addSession(dat, pContainer->iTabIndex);
}
SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
@@ -546,7 +526,8 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT if (bPopupContainer) {
SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetFocus(pContainer->hwndActive);
- } else {
+ }
+ else {
if (pContainer->dwFlags & CNT_NOFLASH)
SendMessage(pContainer->hwnd, DM_SETICON, 0, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
else
@@ -560,10 +541,10 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT GetWindowPlacement(pContainer->hwnd, &wp);
BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation
- if(wp.showCmd == SW_SHOWMAXIMIZED)
+ if (wp.showCmd == SW_SHOWMAXIMIZED)
ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
else {
- if(bPopupContainer)
+ if (bPopupContainer)
ShowWindow(pContainer->hwnd, SW_SHOWNORMAL);
else
ShowWindow(pContainer->hwnd, SW_SHOWMINNOACTIVE);
@@ -579,7 +560,8 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT SetForegroundWindow(pContainer->hwnd);
}
}
- if(PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M->GetByte("forceAeroPeek", 0))
+
+ if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M->GetByte("forceAeroPeek", 0))
CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING|MB_OK);
return hwndNew; // return handle of the new dialog
}
@@ -589,23 +571,25 @@ void ShowRoom(SESSION_INFO* si, WPARAM wp, BOOL bSetForeground) if (!si)
return;
- if (si->hWnd == NULL) {
- TCHAR szName[CONTAINER_NAMELEN + 2];
- struct TContainerData *pContainer = si->pContainer;
-
- szName[0] = 0;
- if (pContainer == NULL) {
- GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
- if (!g_Settings.OpenInDefault && !_tcscmp(szName, _T("default")))
- _tcsncpy(szName, _T("Chat Rooms"), CONTAINER_NAMELEN);
- szName[CONTAINER_NAMELEN] = 0;
- pContainer = FindContainerByName(szName);
- }
- if (pContainer == NULL)
- pContainer = CreateContainer(szName, FALSE, si->hContact);
- si->hWnd = CreateNewRoom(pContainer, si, TRUE, TRUE, FALSE);
- } else
+ if (si->hWnd != NULL) {
ActivateExistingTab(si->pContainer, si->hWnd);
+ return;
+ }
+
+ TCHAR szName[CONTAINER_NAMELEN + 2];
+ TContainerData *pContainer = si->pContainer;
+
+ szName[0] = 0;
+ if (pContainer == NULL) {
+ GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
+ if (!g_Settings.OpenInDefault && !_tcscmp(szName, _T("default")))
+ _tcsncpy(szName, _T("Chat Rooms"), CONTAINER_NAMELEN);
+ szName[CONTAINER_NAMELEN] = 0;
+ pContainer = FindContainerByName(szName);
+ }
+ if (pContainer == NULL)
+ pContainer = CreateContainer(szName, FALSE, si->hContact);
+ si->hWnd = CreateNewRoom(pContainer, si, TRUE, TRUE, FALSE);
}
INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
@@ -632,7 +616,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (gcd == NULL)
return GC_EVENT_ERROR;
- if (gce->cbSize != SIZEOF_STRUCT_GCEVENT_V1 && gce->cbSize != SIZEOF_STRUCT_GCEVENT_V2)
+ if (gce->cbSize != sizeof(GCEVENT))
return GC_EVENT_WRONGVER;
if (!IsEventSupported(gcd->iType))
@@ -665,90 +649,81 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) iRetVal = 0;
goto LBL_Exit;
- case GC_EVENT_CHUID:
- case GC_EVENT_CHANGESESSIONAME:
- case GC_EVENT_SETITEMDATA:
- case GC_EVENT_GETITEMDATA:
- case GC_EVENT_CONTROL:
- case GC_EVENT_SETSBTEXT:
- case GC_EVENT_ACK:
- case GC_EVENT_SENDMESSAGE :
- case GC_EVENT_SETSTATUSEX :
- iRetVal = DoControl(gce, wParam);
- goto LBL_Exit;
+ case GC_EVENT_CHUID:
+ case GC_EVENT_CHANGESESSIONAME:
+ case GC_EVENT_SETITEMDATA:
+ case GC_EVENT_GETITEMDATA:
+ case GC_EVENT_CONTROL:
+ case GC_EVENT_SETSBTEXT:
+ case GC_EVENT_ACK:
+ case GC_EVENT_SENDMESSAGE :
+ case GC_EVENT_SETSTATUSEX :
+ iRetVal = DoControl(gce, wParam);
+ goto LBL_Exit;
- case GC_EVENT_SETCONTACTSTATUS:
- iRetVal = SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
- goto LBL_Exit;
+ case GC_EVENT_SETCONTACTSTATUS:
+ iRetVal = SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
+ goto LBL_Exit;
- case GC_EVENT_TOPIC: {
- si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- if (gce->pszText) {
- replaceStr(&si->ptszTopic, RemoveFormatting(gce->ptszText));
- M->WriteTString(si->hContact, si->pszModule , "Topic", /*RemoveFormatting*/(si->ptszTopic));
- if (M->GetByte("Chat", "TopicOnClist", 1))
- M->WriteTString(si->hContact, "CList" , "StatusMsg", /*RemoveFormatting*/(si->ptszTopic));
- if(si->hWnd)
- SendMessage(si->hWnd, DM_INVALIDATEPANEL, 0, 0);
- }
+ case GC_EVENT_TOPIC:
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ if (gce->pszText) {
+ replaceStr(&si->ptszTopic, RemoveFormatting(gce->ptszText));
+ M->WriteTString(si->hContact, si->pszModule , "Topic", /*RemoveFormatting*/(si->ptszTopic));
+ if (M->GetByte("Chat", "TopicOnClist", 1))
+ M->WriteTString(si->hContact, "CList" , "StatusMsg", /*RemoveFormatting*/(si->ptszTopic));
+ if (si->hWnd)
+ SendMessage(si->hWnd, DM_INVALIDATEPANEL, 0, 0);
}
- break;
}
- case GC_EVENT_ADDSTATUS:
- SM_GiveStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
- if (!gce->bIsMe) {
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
- }
- break;
+ break;
- case GC_EVENT_REMOVESTATUS:
- SM_TakeStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
- if (!gce->bIsMe) {
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
- }
- break;
+ case GC_EVENT_ADDSTATUS:
+ SM_GiveStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
+ if (!gce->bIsMe)
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ break;
- case GC_EVENT_MESSAGE:
- case GC_EVENT_ACTION: {
- si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (!(gce->dwFlags & GC_UNICODE)) {
- fFreeText = TRUE;
- if (si)
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags, M->GetDword(si->hContact, "ANSIcodepage", 0));
- else
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
- }
- if (!gce->bIsMe && gce->pDest->pszID && gce->pszText) {
- if (si)
- bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME);
- }
- }
+ case GC_EVENT_REMOVESTATUS:
+ SM_TakeStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
+ if (!gce->bIsMe)
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
break;
- case GC_EVENT_NICK:
- SM_ChangeNick(gce->pDest->ptszID, gce->pDest->pszModule, gce);
- if (!gce->bIsMe) {
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
- }
+ case GC_EVENT_MESSAGE:
+ case GC_EVENT_ACTION:
+ si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (!(gce->dwFlags & GC_UNICODE)) {
+ fFreeText = TRUE;
+ if (si)
+ gce->ptszText = a2tf(gce->ptszText, gce->dwFlags, M->GetDword(si->hContact, "ANSIcodepage", 0));
+ else
+ gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
+ }
+ if (!gce->bIsMe && gce->pDest->pszID && gce->pszText && si)
+ bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME);
+ break;
- break;
+ case GC_EVENT_NICK:
+ SM_ChangeNick(gce->pDest->ptszID, gce->pDest->pszModule, gce);
+ if (!gce->bIsMe)
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ break;
- case GC_EVENT_JOIN:
- AddUser(gce);
- if (!gce->bIsMe) {
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
- }
- break;
+ case GC_EVENT_JOIN:
+ AddUser(gce);
+ if (!gce->bIsMe)
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ break;
- case GC_EVENT_PART:
- case GC_EVENT_QUIT:
- case GC_EVENT_KICK:
- bRemoveFlag = TRUE;
- if (!gce->bIsMe) {
- bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
- }
- break;
+ case GC_EVENT_PART:
+ case GC_EVENT_QUIT:
+ case GC_EVENT_KICK:
+ bRemoveFlag = TRUE;
+ if (!gce->bIsMe)
+ bIsHighlighted = g_Settings.Highlight->match(gce, 0, CMUCHighlight::MATCH_NICKNAME);
+ break;
}
// Decide which window (log) should have the event
@@ -773,7 +748,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!bRemoveFlag) {
iRetVal = 0;
goto LBL_Exit;
- } }
+ } }
// add to log
if (pWnd) {
@@ -806,7 +781,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!bRemoveFlag) {
iRetVal = 0;
goto LBL_Exit;
- } }
+ } }
if (bRemoveFlag)
iRetVal = (SM_RemoveUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID) == 0) ? 1 : 0;
@@ -858,11 +833,11 @@ int CreateServiceFunctions(void) {
PluginConfig.m_chat_enabled = false;
- if(ServiceExists(MS_GC_REGISTER)) {
+ if (ServiceExists(MS_GC_REGISTER)) {
LRESULT result = CWarning::show(CWarning::WARN_CHAT_ENABLED, CWarning::CWF_NOALLOWHIDE | MB_YESNOCANCEL | MB_ICONQUESTION);
- if(result == IDYES)
- M->WriteByte("PluginDisable", "chat.dll", 1);
- return(0);
+ if (result == IDYES)
+ M->WriteByte("PluginDisable", "chat.dll", 1);
+ return 0;
}
PluginConfig.m_chat_enabled = true;
@@ -877,7 +852,7 @@ int CreateServiceFunctions(void) hEventPrebuildMenu = CreateServiceFunction("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
hEventJoinChat = CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
hEventLeaveChat = CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
- return(1);
+ return 1;
}
void DestroyServiceFunctions(void)
@@ -905,4 +880,3 @@ void DestroyHookableEvents(void) DestroyHookableEvent(hSendEvent);
DestroyHookableEvent(hBuildMenuEvent);
}
-
diff --git a/plugins/TabSRMM/chat/tools.cpp b/plugins/TabSRMM/chat/tools.cpp index 04fba1aa40..f9b0bb786c 100644 --- a/plugins/TabSRMM/chat/tools.cpp +++ b/plugins/TabSRMM/chat/tools.cpp @@ -73,7 +73,7 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord, bool fToLower, bool fStripCR, TCHA TCHAR* szTemp = 0;
size_t _buflen = 0;
- if(0 == buf) {
+ if (0 == buf) {
szTemp = _szTemp;
_buflen = 20000;
} else {
@@ -124,8 +124,8 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord, bool fToLower, bool fStripCR, TCHA break;
}
} else {
- if(fStripCR) {
- if(0x0a == pszWord[i] || 0x0c == pszWord[i]) {
+ if (fStripCR) {
+ if (0x0a == pszWord[i] || 0x0c == pszWord[i]) {
szTemp[j++] = ' ';
i++;
continue;
@@ -136,7 +136,7 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord, bool fToLower, bool fStripCR, TCHA i++;
}
}
- if(fToLower) {
+ if (fToLower) {
_wsetlocale(LC_ALL, L"");
wcslwr(szTemp);
}
@@ -174,8 +174,8 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA if (HIWORD(wParam) == STN_CLICKED) {
SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)0);;
- if(si) {
- if(nen_options.maskActL & MASK_OPEN)
+ if (si) {
+ if (nen_options.maskActL & MASK_OPEN)
Chat_OpenPopup(si, hWnd);
else
Chat_DismissPopup(si, hWnd);
@@ -186,8 +186,8 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case WM_CONTEXTMENU: {
SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)0);
- if(si && si->hContact) {
- if(nen_options.maskActR & MASK_OPEN)
+ if (si && si->hContact) {
+ if (nen_options.maskActR & MASK_OPEN)
Chat_OpenPopup(si, hWnd);
else
Chat_DismissPopup(si, hWnd);
@@ -338,10 +338,10 @@ static BOOL DoPopup(SESSION_INFO* si, GCEVENT* gce, struct TWindowData* dat) if (dat && pContainer != 0) { // message window is open, need to check the container config if we want to see a popup nonetheless
if (nen_options.bWindowCheck) { // no popups at all for open windows... no exceptions
if (!PluginConfig.m_HideOnClose)
- return(0);
- if(pContainer->fHidden)
+ return 0;
+ if (pContainer->fHidden)
goto passed;
- return(0);
+ return 0;
}
if (pContainer->dwFlags & CNT_DONTREPORT && IsIconic(pContainer->hwnd)) // in tray counts as "minimised"
goto passed;
@@ -442,7 +442,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p) SESSION_INFO* si = SM_FindSessionByHCONTACT(p->hContact);
TWindowData* dat = 0;
- if(si == 0)
+ if (si == 0)
return;
if (si->hWnd) {
@@ -454,7 +454,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p) if (p->sound && Utils::mustPlaySound(si->dat))
SkinPlaySound(p->sound);
}
- else if(p->sound)
+ else if (p->sound)
SkinPlaySound(p->sound);
if (dat) {
@@ -473,7 +473,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p) SetTimer(si->hWnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
}
}
- if(dat->pWnd) {
+ if (dat->pWnd) {
dat->pWnd->updateIcon(p->hNotifyIcon);
dat->pWnd->setOverlayIcon(p->hNotifyIcon, true);
}
@@ -539,7 +539,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh params = (FLASH_PARAMS*)calloc(1, sizeof(FLASH_PARAMS));
params->hContact = si->hContact;
params->bInactive = TRUE;
- if(si->hWnd && si->dat) {
+ if (si->hWnd && si->dat) {
dat = si->dat;
if ((si->hWnd == si->dat->pContainer->hwndActive) && GetForegroundWindow() == si->dat->pContainer->hwnd)
params->bInactive = FALSE;
@@ -560,10 +560,10 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh /* TODO fix for 3.0 final !!! */
#if !defined(__DELAYED_FOR_3_1)
- if(g_Settings.CreateWindowOnHighlight && 0 == dat)
+ if (g_Settings.CreateWindowOnHighlight && 0 == dat)
wParamForHighLight = 1;
- if(dat && g_Settings.AnnoyingHighlight && params->bInactive && dat->pContainer->hwnd != GetForegroundWindow()) {
+ if (dat && g_Settings.AnnoyingHighlight && params->bInactive && dat->pContainer->hwnd != GetForegroundWindow()) {
wParamForHighLight = 2;
params->hWnd = dat->hwnd;
}
@@ -580,7 +580,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh // do blinking icons in tray
if (params->bInactive || !g_Settings.TrayIconInactiveOnly) {
DoTrayIcon(si, gce);
- if(params->iEvent == GC_EVENT_MESSAGE)
+ if (params->iEvent == GC_EVENT_MESSAGE)
fFlagUnread = true;
}
// stupid thing to not create multiple popups for a QUIT event for instance
@@ -687,9 +687,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh params->hNotifyIcon = hIcons[ICON_MESSAGE];
}
}
- if(dat && fFlagUnread) {
+ if (dat && fFlagUnread) {
dat->dwUnread++;
- if(dat->pWnd)
+ if (dat->pWnd)
dat->pWnd->Invalidate();
}
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_MUCFLASHWORKER, wParamForHighLight, (LPARAM)params);
@@ -1284,13 +1284,13 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) TCHAR *tszNow = MakeTimeStamp(_T("%a%d%m%Y"), tTime);
- if(_tcscmp(tszOldTimeStamp, tszNow)) {
+ if (_tcscmp(tszOldTimeStamp, tszNow)) {
_tcsncpy(tszOldTimeStamp, tszNow, 30);
tszOldTimeStamp[29] = 0;
fReparse = true;
}
- if(fReparse || 0 == si->pszLogFileName[0]) {
+ if (fReparse || 0 == si->pszLogFileName[0]) {
rva[0].lptzKey = _T("d");
rva[0].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%#d"), tTime));
// day 01-31
diff --git a/plugins/TabSRMM/chat/window.cpp b/plugins/TabSRMM/chat/window.cpp index 0925f5209b..668428cdf2 100644 --- a/plugins/TabSRMM/chat/window.cpp +++ b/plugins/TabSRMM/chat/window.cpp @@ -262,7 +262,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) }
}
- if(si->hwndFilter) {
+ if (si->hwndFilter) {
POINT pt;
RECT rcFilter;
@@ -275,14 +275,14 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) }
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if(dat->fIsAutosizingInput && dat->iInputAreaHeight == -1) {
+ if (dat->fIsAutosizingInput && dat->iInputAreaHeight == -1) {
dat->iInputAreaHeight = 0;
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REQUESTRESIZE, 0, 0);
}
#endif
dat->Panel->dismissConfig();
dat->dwUnread = 0;
- if(dat->pWnd) {
+ if (dat->pWnd) {
dat->pWnd->activateTab();
dat->pWnd->setOverlayIcon(0, true);
}
@@ -365,13 +365,13 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) }
*/
}
- if(M->isAero())
+ if (M->isAero())
InvalidateRect(hwndTab, NULL, FALSE);
- if(dat->pContainer->dwFlags & CNT_SIDEBAR)
+ if (dat->pContainer->dwFlags & CNT_SIDEBAR)
dat->pContainer->SideBar->setActiveItem(dat);
BB_SetButtonsPos(dat);
- if(dat->pWnd)
+ if (dat->pWnd)
dat->pWnd->Invalidate();
}
@@ -450,7 +450,7 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) GetClientRect(hwndDlg, &rcTabs);
TabHeight = rcTabs.bottom - rcTabs.top;
- if(dat->fIsAutosizingInput)
+ if (dat->fIsAutosizingInput)
Utils::showDlgControl(hwndDlg, IDC_SPLITTERY, SW_HIDE);
if (si->iType != GCW_SERVER) {
@@ -541,7 +541,7 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.bottom = urc->dlgNewSize.cy; // - 1 ;
msgBottom = urc->rcItem.bottom;
- if(dat->fIsAutosizingInput)
+ if (dat->fIsAutosizingInput)
urc->rcItem.top -= DPISCALEY_S(1);
msgTop = urc->rcItem.top;
@@ -578,13 +578,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, dat = (MESSAGESUBDATA *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if(mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
+ if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
GetKeyboardState(mwdat->kstate);
- if(mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
- return(0);
+ if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
+ return 0;
else {
mwdat->fkeyProcessed = false;
- return(0);
+ return 0;
}
}
switch (msg) {
@@ -675,24 +675,24 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
case WM_SYSKEYUP:
- if(wParam == VK_MENU) {
+ if (wParam == VK_MENU) {
ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_MESSAGE);
- return(0);
+ return 0;
}
break;
case WM_SYSKEYDOWN:
mwdat->fkeyProcessed = false;
- if(ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_MESSAGE)) {
+ if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_MESSAGE)) {
mwdat->fkeyProcessed = true;
- return(0);
+ return 0;
}
break;
case WM_SYSCHAR: {
- if(mwdat->fkeyProcessed) {
+ if (mwdat->fkeyProcessed) {
mwdat->fkeyProcessed = false; // preceeding key event has been processed by miranda hotkey service
- return(0);
+ return 0;
}
BOOL isMenu = GetKeyState(VK_MENU) & 0x8000;
@@ -715,7 +715,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, KbdState(mwdat, isShift, isCtrl, isAlt);
//MAD: sound on typing..
- if(PluginConfig.g_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam!=VK_ESCAPE&&!(wParam==VK_TAB&&PluginConfig.m_AllowTab))
+ if (PluginConfig.g_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam!=VK_ESCAPE&&!(wParam==VK_TAB&&PluginConfig.m_AllowTab))
SkinPlaySound("SoundOnTyping");
//MAD
@@ -733,24 +733,24 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_KEYDOWN, mwdat->dwFlags & MWF_LOG_RTL ? VK_RIGHT : VK_LEFT, 0);
return 0;
}
- if(isCtrl && !isAlt && !isShift) {
+ if (isCtrl && !isAlt && !isShift) {
MODULEINFO* mi = MM_FindModule(Parentsi->pszModule);
switch(wParam) {
case 0x09: // ctrl-i (italics)
- if(mi && mi->bItalics) {
+ if (mi && mi->bItalics) {
CheckDlgButton(hwndParent, IDC_ITALICS, IsDlgButtonChecked(hwndParent, IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
}
- return(0);
+ return 0;
case 0x02: // ctrl-b (bold)
- if(mi && mi->bBold) {
+ if (mi && mi->bBold) {
CheckDlgButton(hwndParent, IDC_CHAT_BOLD, IsDlgButtonChecked(hwndParent, IDC_CHAT_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
}
return 0;
case 0x20: // ctrl-space clear formatting
- if(mi && mi->bBold && mi->bItalics && mi->bUnderline) {
+ if (mi && mi->bBold && mi->bItalics && mi->bUnderline) {
CheckDlgButton(hwndParent, IDC_BKGCOLOR, BST_UNCHECKED);
CheckDlgButton(hwndParent, IDC_COLOR, BST_UNCHECKED);
CheckDlgButton(hwndParent, IDC_CHAT_BOLD, BST_UNCHECKED);
@@ -764,19 +764,19 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
return 0;
case 0x0c: // ctrl-l background color
- if(mi && mi->bBkgColor) {
+ if (mi && mi->bBkgColor) {
CheckDlgButton(hwndParent, IDC_BKGCOLOR, IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
}
return 0;
case 0x15: // ctrl-u underlined
- if(mi && mi->bUnderline) {
+ if (mi && mi->bUnderline) {
CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
}
return 0; // ctrl-k color
case 0x0b:
- if(mi && mi->bColor) {
+ if (mi && mi->bColor) {
CheckDlgButton(hwndParent, IDC_COLOR, IsDlgButtonChecked(hwndParent, IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
}
@@ -796,7 +796,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, KbdState(mwdat, isShift, isCtrl, isAlt);
//MAD: sound on typing..
- if(PluginConfig.g_bSoundOnTyping&&!isAlt&&wParam == VK_DELETE)
+ if (PluginConfig.g_bSoundOnTyping&&!isAlt&&wParam == VK_DELETE)
SkinPlaySound("SoundOnTyping");
//
if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
@@ -906,7 +906,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)pszText);
- if(start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':')
+ if (start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':')
start--;
while( start > 0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
@@ -915,7 +915,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end-1] != VK_TAB)
end ++;
- if(pszText[start] == '#')
+ if (pszText[start] == '#')
isRoom = TRUE;
else {
topicStart = (int)start;
@@ -965,7 +965,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, EM_SETSEL, start, end);
SendMessage(hwnd, EM_REPLACESEL, TRUE, (LPARAM)pszName);
}
- if(pszText)
+ if (pszText)
mir_free(pszText);
fCompleted = true;
}
@@ -1132,7 +1132,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (mi && mi->bUnderline) {
u = IsDlgButtonChecked(hwndParent, IDC_CHAT_UNDERLINE);
- if(cf.dwEffects & CFE_UNDERLINE && (cf.bUnderlineType & CFU_UNDERLINE || cf.bUnderlineType & CFU_UNDERLINEWORD)) {
+ if (cf.dwEffects & CFE_UNDERLINE && (cf.bUnderlineType & CFU_UNDERLINE || cf.bUnderlineType & CFU_UNDERLINEWORD)) {
if (u == BST_UNCHECKED )
CheckDlgButton(hwndParent, IDC_CHAT_UNDERLINE, BST_CHECKED);
}
@@ -1373,7 +1373,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR POINT pt={LOWORD(lParam), HIWORD(lParam)};
CheckCustomLink(hwnd, &pt, msg, wParam, lParam, TRUE);
}
- if(true || M->GetByte("autocopy", 0)) {
+ if (true || M->GetByte("autocopy", 0)) {
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel);
if (sel.cpMin != sel.cpMax) {
SendMessage(hwnd, WM_COPY, 0, 0);
@@ -1393,24 +1393,24 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_SYSKEYUP:
- if(wParam == VK_MENU) {
+ if (wParam == VK_MENU) {
ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_LOG);
- return(0);
+ return 0;
}
break;
case WM_SYSKEYDOWN:
mwdat->fkeyProcessed = false;
- if(ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_LOG)) {
+ if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_CHAT_LOG)) {
mwdat->fkeyProcessed = true;
- return(0);
+ return 0;
}
break;
case WM_SYSCHAR: {
- if(mwdat->fkeyProcessed) {
+ if (mwdat->fkeyProcessed) {
mwdat->fkeyProcessed = false;
- return(0);
+ return 0;
}
break;
}
@@ -1759,7 +1759,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, RECT rc, rcWnd;
THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
- if(parentdat && ui) {
+ if (parentdat && ui) {
HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
TranslateDialogDefault(hwnd);
GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
@@ -1987,13 +1987,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!dat->pContainer->settings->fPrivate)
psi->iSplitterY = g_Settings.iSplitterY;
else {
- if(M->GetByte("Chat", "SyncSplitter", 0))
+ if (M->GetByte("Chat", "SyncSplitter", 0))
psi->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23);
else
psi->iSplitterY = g_Settings.iSplitterY;
}
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if(dat->fIsAutosizingInput)
+ if (dat->fIsAutosizingInput)
psi->iSplitterY = GetDefaultMinimumInputHeight(dat);
#endif
dat->pWnd = 0;
@@ -2122,8 +2122,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar BOOL fNoCopy = TRUE;
const TCHAR* szNick = dat->cache->getNick();
- if(dat->bWasDeleted)
- return(0);
+ if (dat->bWasDeleted)
+ return 0;
dat->wStatus = si->wStatus;
@@ -2156,7 +2156,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break;
}
- if(dat->pWnd) {
+ if (dat->pWnd) {
dat->pWnd->updateTitle(dat->newtitle);
dat->pWnd->updateIcon(hIcon);
}
@@ -2186,8 +2186,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break;
case GC_UPDATESTATUSBAR:
- if(dat->bWasDeleted)
- return(0);
+ if (dat->bWasDeleted)
+ return 0;
if (dat->pContainer->hwndActive != hwndDlg || dat->pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || dat->szStatusBar[0])
break;
@@ -2207,15 +2207,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar x += GetTextPixelSize(mi->ptszModDispName, (HFONT)SendMessage(dat->pContainer->hwndStatus, WM_GETFONT, 0, 0), TRUE);
x += GetSystemMetrics(SM_CXSMICON);
- if(dat->Panel->isActive()) {
+ if (dat->Panel->isActive()) {
time_t now = time(0);
DWORD diff = (now - mi->idleTimeStamp) / 60;
if ((diff >= 1 && diff != mi->lastIdleCheck) || lParam) {
mi->lastIdleCheck = diff;
- if(diff == 0)
+ if (diff == 0)
mi->tszIdleMsg[0] = 0;
- else if(diff > 59) {
+ else if (diff > 59) {
DWORD hours = diff / 60;
DWORD minutes = diff % 60;
mir_sntprintf(mi->tszIdleMsg, 60, TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ?
@@ -2238,7 +2238,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText);
UpdateStatusBar(dat);
dat->Panel->Invalidate();
- if(dat->pWnd)
+ if (dat->pWnd)
dat->pWnd->Invalidate();
return TRUE;
}
@@ -2359,7 +2359,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU) {
- if(dat->Panel->isHovered()) {
+ if (dat->Panel->isHovered()) {
mis->itemHeight = 0;
mis->itemWidth = 6;
return(TRUE);
@@ -2375,7 +2375,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU) {
- if(dat->Panel->isHovered()) {
+ if (dat->Panel->isHovered()) {
DrawMenuItem(dis, (HICON)dis->itemData, 0);
return(TRUE);
}
@@ -2491,7 +2491,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_CONTEXTMENU:{
//mad
DWORD idFrom=GetDlgCtrlID((HWND)wParam);
- if(idFrom>=MIN_CBUTTONID&&idFrom<=MAX_CBUTTONID)
+ if (idFrom>=MIN_CBUTTONID&&idFrom<=MAX_CBUTTONID)
BB_CustomButtonClick(dat,idFrom,(HWND) wParam,1);
}break;
//
@@ -2612,7 +2612,7 @@ LABEL_SHOWWINDOW: dat->Panel->setHeight(pt.y + 2);
dat->panelWidth = -1;
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
- if(M->isAero())
+ if (M->isAero())
InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
SendMessage(hwndDlg, WM_SIZE, DM_SPLITTERMOVED, 0);
break;
@@ -2659,7 +2659,7 @@ LABEL_SHOWWINDOW: case DM_SPLITTERGLOBALEVENT: {
DM_SplitterGlobalEvent(dat, wParam, lParam);
- return(0);
+ return 0;
}
case GC_SHOWCOLORCHOOSER: {
@@ -2718,22 +2718,22 @@ LABEL_SHOWWINDOW: message.lParam = lp;
message.wParam = wp;
- if(msg == WM_SYSKEYUP) {
- if(wp == VK_MENU) {
+ if (msg == WM_SYSKEYUP) {
+ if (wp == VK_MENU) {
if (!dat->fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
dat->pContainer->MenuBar->autoShow();
}
return(_dlgReturn(hwndDlg, 0));
}
- if(msg == WM_MOUSEMOVE) {
+ if (msg == WM_MOUSEMOVE) {
POINT pt;
GetCursorPos(&pt);
DM_DismissTip(dat, pt);
dat->Panel->trackMouse(pt);
break;
}
- if(msg == WM_KEYDOWN) {
+ if (msg == WM_KEYDOWN) {
if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_PASTESPECIAL, CF_TEXTT, 0);
((MSGFILTER *) lParam)->msg = WM_NULL;
@@ -2743,18 +2743,18 @@ LABEL_SHOWWINDOW: }
}
- if(msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
+ if (msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
dat->pContainer->MenuBar->Cancel();
if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
- if(DM_GenericHotkeysCheck(&message, dat)) {
+ if (DM_GenericHotkeysCheck(&message, dat)) {
dat->fkeyProcessed = true;
return(_dlgReturn(hwndDlg, 1));
}
LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC));
- if(mim_hotkey_check)
+ if (mim_hotkey_check)
dat->fkeyProcessed = true;
switch(mim_hotkey_check) { // nothing (yet) FIXME
case TABSRMM_HK_CHANNELMGR:
@@ -2768,7 +2768,7 @@ LABEL_SHOWWINDOW: SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_SHOWNICKLIST, BN_CLICKED), 0);
return(_dlgReturn(hwndDlg, 1));
case TABSRMM_HK_MUC_SHOWSERVER:
- if(si->iType != GCW_SERVER)
+ if (si->iType != GCW_SERVER)
DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", (LPARAM)NULL);
return(_dlgReturn(hwndDlg, 1));
default:
@@ -2776,7 +2776,7 @@ LABEL_SHOWWINDOW: }
}
- if(msg == WM_KEYDOWN && wp == VK_TAB) {
+ if (msg == WM_KEYDOWN && wp == VK_TAB) {
if (((NMHDR *)lParam)->idFrom == IDC_CHAT_LOG) {
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
return(_dlgReturn(hwndDlg, 1));
@@ -2896,7 +2896,7 @@ LABEL_SHOWWINDOW: }
case EN_REQUESTRESIZE: {
- if(pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
+ if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
REQRESIZE *rr = (REQRESIZE *)lParam;
DM_HandleAutoSizeRequest(dat, rr);
}
@@ -3084,7 +3084,7 @@ LABEL_SHOWWINDOW: POINT tmp; //+ Protogenes
POINTS cur; //+ Protogenes
GetCursorPos(&tmp); //+ Protogenes
- if(dat->Panel->isHovered())
+ if (dat->Panel->isHovered())
dat->Panel->handleClick(tmp);
else {
cur.x = (SHORT)tmp.x; //+ Protogenes
@@ -3112,7 +3112,7 @@ LABEL_SHOWWINDOW: case WM_COMMAND:
//mad
- if(LOWORD(wParam)>=MIN_CBUTTONID&&LOWORD(wParam)<=MAX_CBUTTONID){
+ if (LOWORD(wParam)>=MIN_CBUTTONID&&LOWORD(wParam)<=MAX_CBUTTONID){
BB_CustomButtonClick(dat,LOWORD(wParam) ,GetDlgItem(hwndDlg,LOWORD(wParam)),0);
break;
}
@@ -3176,14 +3176,14 @@ LABEL_SHOWWINDOW: ptszText = Chat_DoRtfToTags(pszRtf, si);
DoTrimMessage(ptszText);
- if(mi && mi->bAckMsg) {
+ if (mi && mi->bAckMsg) {
Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, FALSE);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0);
} else SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
Utils::enableDlgControl(hwndDlg, IDOK, FALSE);
- if(ptszText[0] == '/' || si->iType == GCW_SERVER)
+ if (ptszText[0] == '/' || si->iType == GCW_SERVER)
fSound = false;
DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, (LPARAM)NULL);
mi->idleTimeStamp = time(0);
@@ -3403,7 +3403,7 @@ LABEL_SHOWWINDOW: LONG cx = rcClient.right - rcClient.left;
LONG cy = rcClient.bottom - rcClient.top;
- if(CMimAPI::m_haveBufferedPaint)
+ if (CMimAPI::m_haveBufferedPaint)
hbp = CSkin::InitiateBufferedPaint(hdc, rcClient, hdcMem);
else {
hdcMem = CreateCompatibleDC(hdc);
@@ -3411,7 +3411,7 @@ LABEL_SHOWWINDOW: hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
}
- if(CSkin::m_skinEnabled && !fAero) {
+ if (CSkin::m_skinEnabled && !fAero) {
CSkin::SkinDrawBG(hwndDlg, dat->pContainer->hwnd, dat->pContainer, &rcClient, hdcMem);
for (i = 0; i < 3; i++) {
item = &SkinItems[item_ids[i]];
@@ -3432,7 +3432,7 @@ LABEL_SHOWWINDOW: else {
CSkin::FillBack(hdcMem, &rcClient);
- if(M->isAero()) {
+ if (M->isAero()) {
LONG temp = rcClient.bottom;
rcClient.bottom = dat->Panel->isActive() ? dat->Panel->getHeight() + 5 : 5;
FillRect(hdcMem, &rcClient, (HBRUSH)GetStockObject(BLACK_BRUSH));
@@ -3449,7 +3449,7 @@ LABEL_SHOWWINDOW: if (!CSkin::m_skinEnabled)
CSkin::RenderToolbarBG(dat, hdcMem, rcClient);
- if(hbp)
+ if (hbp)
CSkin::FinalizeBufferedPaint(hbp, &rcClient);
else {
BitBlt(hdc, 0, 0, cx, cy, hdcMem, 0, 0, SRCCOPY);
@@ -3459,7 +3459,7 @@ LABEL_SHOWWINDOW: }
if (!dat->fLimitedUpdate)
SetAeroMargins(dat->pContainer);
- return(1);
+ return 1;
}
case WM_NCPAINT:
@@ -3475,12 +3475,12 @@ LABEL_SHOWWINDOW: case DM_SETINFOPANEL:
CInfoPanel::setPanelHandler(dat, wParam, lParam);
- return(0);
+ return 0;
case DM_INVALIDATEPANEL:
- if(dat->Panel)
+ if (dat->Panel)
dat->Panel->Invalidate(true);
- return(0);
+ return 0;
case WM_RBUTTONUP: {
POINT pt;
@@ -3491,7 +3491,7 @@ LABEL_SHOWWINDOW: GetCursorPos(&pt);
- if(dat->Panel->invokeConfigDialog(pt))
+ if (dat->Panel->invokeConfigDialog(pt))
break;
subMenu = GetSubMenu(dat->pContainer->hMenuContext, 0);
@@ -3525,10 +3525,10 @@ LABEL_SHOWWINDOW: case WM_CLOSE:
if (wParam == 0 && lParam == 0) {
- if(PluginConfig.m_EscapeCloses == 1) {
+ if (PluginConfig.m_EscapeCloses == 1) {
SendMessage(dat->pContainer->hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
return(TRUE);
- } else if(PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
+ } else if (PluginConfig.m_HideOnClose && PluginConfig.m_EscapeCloses == 2) {
ShowWindow(dat->pContainer->hwnd, SW_HIDE);
return(TRUE);
}
@@ -3630,7 +3630,7 @@ LABEL_SHOWWINDOW: if (dat->dwFlags & MWF_WASBACKGROUNDCREATE)
break;
if (dat->pContainer->hwndActive == hwndDlg && PluginConfig.m_AutoLocaleSupport && dat->hContact != 0 && dat->pContainer->hwnd == GetForegroundWindow() && dat->pContainer->hwnd == GetActiveWindow()) {
- if(lParam)
+ if (lParam)
dat->hkl = (HKL)lParam;
if (dat->hkl)
@@ -3656,8 +3656,8 @@ LABEL_SHOWWINDOW: dat->dwFlags &= ~MWF_WASBACKGROUNDCREATE;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
- if(PluginConfig.m_AutoLocaleSupport) {
- if(dat->hkl == 0)
+ if (PluginConfig.m_AutoLocaleSupport) {
+ if (dat->hkl == 0)
DM_LoadLocale(dat);
else
PostMessage(hwndDlg, DM_SETLOCALE, 0, 0);
@@ -3707,7 +3707,7 @@ LABEL_SHOWWINDOW: //mad: bb-api
case DM_BBNEEDUPDATE:{
- if(lParam)
+ if (lParam)
CB_ChangeButton(hwndDlg,dat,(CustomButtonData*)lParam);
else
BB_InitDlgButtons(dat);
@@ -3716,7 +3716,7 @@ LABEL_SHOWWINDOW: }break;
case DM_CBDESTROY:{
- if(lParam)
+ if (lParam)
CB_DestroyButton(hwndDlg,dat,(DWORD)wParam,(DWORD)lParam);
else
CB_DestroyAllButtons(hwndDlg,dat);
@@ -3756,18 +3756,18 @@ LABEL_SHOWWINDOW: case DM_SAVEMESSAGELOG:
DM_SaveLogAsRTF(dat);
- return(0);
+ return 0;
case DM_CHECKAUTOHIDE:
DM_CheckAutoHide(dat, wParam, lParam);
- return(0);
+ return 0;
case WM_NCDESTROY:
if (dat) {
memset((void *)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
PostMessage(dat->pContainer->hwnd, WM_SIZE, 0, 1);
delete dat->Panel;
- if(dat->pContainer->dwFlags & CNT_SIDEBAR)
+ if (dat->pContainer->dwFlags & CNT_SIDEBAR)
dat->pContainer->SideBar->removeSession(dat);
free(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
@@ -3800,7 +3800,7 @@ LABEL_SHOWWINDOW: if (!dat->fIsAutosizingInput)
DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
- if(dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat))
+ if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat))
DBWriteContactSettingWord(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);
DM_FreeTheme(dat);
@@ -3825,7 +3825,7 @@ LABEL_SHOWWINDOW: BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0);
dat->iTabID = -1;
}
- if(dat->pWnd) {
+ if (dat->pWnd) {
delete dat->pWnd;
dat->pWnd = 0;
}
|