diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-27 13:29:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-27 13:29:32 +0000 |
commit | 7d5177b035aed270dc6e9f4e7a2692597abb9230 (patch) | |
tree | c80c6709509cb888f1c298327cea36ffe35987a0 /protocols/IRCG/src/userinfo.cpp | |
parent | 74d73e97add44364f5f000d23e79b2f12fc8833d (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@7913 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IRCG/src/userinfo.cpp')
-rw-r--r-- | protocols/IRCG/src/userinfo.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index b693d06d9e..7ed1fc12a0 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -42,144 +42,144 @@ struct UserDetailsDlgProcParam INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- UserDetailsDlgProcParam* p = ( UserDetailsDlgProcParam* )GetWindowLongPtr( m_hwnd, GWLP_USERDATA );
+ UserDetailsDlgProcParam *p = (UserDetailsDlgProcParam*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
- p = new UserDetailsDlgProcParam( NULL, ( HANDLE )lParam );
- SetWindowLongPtr( m_hwnd, GWLP_USERDATA, ( LPARAM )p );
+ p = new UserDetailsDlgProcParam(NULL, (HANDLE)lParam);
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LPARAM)p);
break;
case WM_NOTIFY:
- if ((( LPNMHDR )lParam )->idFrom == 0 && (( LPNMHDR )lParam )->code == PSN_PARAMCHANGED ) {
- p->ppro = ( CIrcProto* )(( PSHNOTIFY* )lParam )->lParam;
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_PARAMCHANGED) {
+ p->ppro = (CIrcProto*)((PSHNOTIFY*)lParam)->lParam;
DBVARIANT dbv;
- BYTE bAdvanced = p->ppro->getByte( p->hContact, "AdvancedMode", 0);
+ BYTE bAdvanced = p->ppro->getByte(p->hContact, "AdvancedMode", 0);
- TranslateDialogDefault( m_hwnd);
+ TranslateDialogDefault(m_hwnd);
- CheckDlgButton( m_hwnd, IDC_RADIO1, bAdvanced?BST_UNCHECKED:BST_CHECKED);
- CheckDlgButton( m_hwnd, IDC_RADIO2, bAdvanced?BST_CHECKED:BST_UNCHECKED);
- EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), bAdvanced);
+ CheckDlgButton(m_hwnd, IDC_RADIO1, bAdvanced ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_RADIO2, bAdvanced ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), bAdvanced);
- if ( !bAdvanced ) {
- SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
- if ( !p->ppro->getTString( p->hContact, "Default", &dbv)) {
- SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
+ if (!bAdvanced) {
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
}
}
else {
- SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
- if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv)) {
- SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
db_free(&dbv);
- } }
+ }
+ }
- if ( !p->ppro->getTString( p->hContact, "UUser", &dbv)) {
- SetDlgItemText( m_hwnd, IDC_USER, dbv.ptszVal);
+ if (!p->ppro->getTString(p->hContact, "UUser", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_USER, dbv.ptszVal);
db_free(&dbv);
}
- if ( !p->ppro->getTString( p->hContact, "UHost", &dbv)) {
- SetDlgItemText( m_hwnd, IDC_HOST, dbv.ptszVal);
+ if (!p->ppro->getTString(p->hContact, "UHost", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_HOST, dbv.ptszVal);
db_free(&dbv);
}
- ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
break;
case WM_COMMAND:
- if (( LOWORD(wParam) == IDC_WILDCARD || LOWORD(wParam) == IDC_USER || LOWORD(wParam) == IDC_HOST ) &&
- ( HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ if ((LOWORD(wParam) == IDC_WILDCARD || LOWORD(wParam) == IDC_USER || LOWORD(wParam) == IDC_HOST) &&
+ (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return true;
- EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), true);
- EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON2), true);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON), true);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON2), true);
- if ( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON ) {
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON) {
TCHAR temp[500];
- GetDlgItemText( m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
- DBVARIANT dbv;
-
- BYTE bAdvanced = IsDlgButtonChecked( m_hwnd, IDC_RADIO1)?0:1;
- if ( bAdvanced ) {
- if ( GetWindowTextLength(GetDlgItem( m_hwnd, IDC_WILDCARD)) == 0 ||
- GetWindowTextLength(GetDlgItem( m_hwnd, IDC_USER)) == 0 ||
- GetWindowTextLength(GetDlgItem( m_hwnd, IDC_HOST)) == 0)
- {
- MessageBox( NULL, TranslateT(STR_ERROR2), TranslateT("IRC error"), MB_OK|MB_ICONERROR);
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+
+ BYTE bAdvanced = IsDlgButtonChecked(m_hwnd, IDC_RADIO1) ? 0 : 1;
+ if (bAdvanced) {
+ if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_WILDCARD)) == 0 ||
+ GetWindowTextLength(GetDlgItem(m_hwnd, IDC_USER)) == 0 ||
+ GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HOST)) == 0) {
+ MessageBox(NULL, TranslateT(STR_ERROR2), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return FALSE;
}
- if ( !p->ppro->getTString( p->hContact, "Default", &dbv )) {
+ DBVARIANT dbv;
+ if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
CMString S = _T(STR_ERROR);
S += _T(" (");
S += dbv.ptszVal;
S += _T(")");
- if (( lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
- MessageBox( NULL, TranslateTS( S.c_str()), TranslateT( "IRC error" ), MB_OK | MB_ICONERROR );
- db_free( &dbv );
+ if ((lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
+ MessageBox(NULL, TranslateTS(S.c_str()), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
+ db_free(&dbv);
return FALSE;
}
- db_free( &dbv );
+ db_free(&dbv);
}
- GetDlgItemText( m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
- if ( lstrlen( GetWord(temp, 0).c_str()))
- p->ppro->setTString( p->hContact, "UWildcard", GetWord(temp, 0).c_str());
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+ if (lstrlen(GetWord(temp, 0).c_str()))
+ p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
- db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
}
- p->ppro->setByte( p->hContact, "AdvancedMode", bAdvanced);
+ p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
- GetDlgItemText( m_hwnd, IDC_USER, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_USER, temp, SIZEOF(temp));
if (lstrlen(GetWord(temp, 0).c_str()))
- p->ppro->setTString( p->hContact, "UUser", GetWord(temp, 0).c_str());
+ p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
- db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
- GetDlgItemText( m_hwnd, IDC_HOST, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_HOST, temp, SIZEOF(temp));
if (lstrlen(GetWord(temp, 0).c_str()))
- p->ppro->setTString( p->hContact, "UHost", GetWord(temp, 0).c_str());
+ p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
- db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
- EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON), FALSE);
}
- if ( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON2 ) {
- if ( IsDlgButtonChecked( m_hwnd, IDC_RADIO2 ))
- SetDlgItemTextA( m_hwnd, IDC_WILDCARD, "");
- SetDlgItemTextA( m_hwnd, IDC_HOST, "" );
- SetDlgItemTextA( m_hwnd, IDC_USER, "" );
- db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
- db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
- db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
- EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE );
- EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON2), FALSE );
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON2) {
+ if (IsDlgButtonChecked(m_hwnd, IDC_RADIO2))
+ SetDlgItemTextA(m_hwnd, IDC_WILDCARD, "");
+ SetDlgItemTextA(m_hwnd, IDC_HOST, "");
+ SetDlgItemTextA(m_hwnd, IDC_USER, "");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset(p->hContact, p->ppro->m_szModuleName, "UHost");
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON), FALSE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BUTTON2), FALSE);
}
- if ( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO1 ) {
- SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO1) {
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
DBVARIANT dbv;
- if ( !p->ppro->getTString( p->hContact, "Default", &dbv )) {
- SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- db_free( &dbv );
+ if (!p->ppro->getTString(p->hContact, "Default", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
+ db_free(&dbv);
}
- EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), FALSE );
+ EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), FALSE);
}
- if ( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO2 ) {
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RADIO2) {
DBVARIANT dbv;
- SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
- if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv )) {
- SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- db_free( &dbv );
+ SetDlgItemText(m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
+ if (!p->ppro->getTString(p->hContact, "UWildcard", &dbv)) {
+ SetDlgItemText(m_hwnd, IDC_WILDCARD, dbv.ptszVal);
+ db_free(&dbv);
}
- EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), true);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_WILDCARD), true);
}
break;
}
@@ -190,19 +190,19 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)lParam;
char *szProto = GetContactProto(hContact);
- if ( !hContact || !szProto || lstrcmpiA( szProto, m_szModuleName ))
+ if (!hContact || !szProto || lstrcmpiA(szProto, m_szModuleName))
return 0;
- if ( isChatRoom(hContact))
+ if (isChatRoom(hContact))
return 0;
- if ( getByte( hContact, "DCC", 0) != 0)
+ if (getByte(hContact, "DCC", 0) != 0)
return 0;
DBVARIANT dbv;
- if ( !getTString( hContact, "Default", &dbv )) {
- if ( IsChannel( dbv.ptszVal )) {
- db_free( &dbv );
+ if (!getTString(hContact, "Default", &dbv)) {
+ if (IsChannel(dbv.ptszVal)) {
+ db_free(&dbv);
return 0;
}
db_free(&dbv);
@@ -212,7 +212,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) odp.flags = ODPF_DONTTRANSLATE;
odp.pszTitle = m_szModuleName;
odp.hIcon = NULL;
- odp.dwInitParam = ( LPARAM )this;
+ odp.dwInitParam = (LPARAM)this;
odp.hInstance = hInst;
odp.position = -1900000000;
odp.pfnDlgProc = UserDetailsDlgProc;
|