From e69dca0ea3ae985737c4bf7470653feccea02f0a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Jul 2012 18:55:34 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1050 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MyDetails/data.cpp | 2 +- plugins/MyDetails/frame.cpp | 43 +++++---- plugins/MyDetails/mydetails.cpp | 204 ++++++++++++++++++---------------------- plugins/MyDetails/options.cpp | 6 +- 4 files changed, 114 insertions(+), 141 deletions(-) diff --git a/plugins/MyDetails/data.cpp b/plugins/MyDetails/data.cpp index 8a01c94c72..75fe7dba9c 100644 --- a/plugins/MyDetails/data.cpp +++ b/plugins/MyDetails/data.cpp @@ -221,7 +221,7 @@ void Protocol::SetStatus(int aStatus) pCount = 0; CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&protos); for (i=0;itype!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue; + if (protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue; pCount += 1; } // END From commomstatus.cpp (KeepStatus) diff --git a/plugins/MyDetails/frame.cpp b/plugins/MyDetails/frame.cpp index 0eb58aa391..6977a4f55a 100644 --- a/plugins/MyDetails/frame.cpp +++ b/plugins/MyDetails/frame.cpp @@ -183,7 +183,7 @@ void InitFrames() void DeInitFrames() { - if(ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME) && frame_id != -1) + if (ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME) && frame_id != -1) { CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)frame_id, 0); } @@ -224,8 +224,7 @@ int CreateFrame() { HDC hdc = GetDC(NULL); - for (int i = 0 ; i < NUM_FONTS ; i++ ) - { + for (int i = 0 ; i < NUM_FONTS ; i++) { ZeroMemory(&font_id[i], sizeof(font_id[i])); font_id[i].cbSize = sizeof(FontID); @@ -287,7 +286,7 @@ int CreateFrame() if (DBGetContactSettingByte(NULL, "MyDetails", "ForceHideFrame", 0)) { int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0); - if(flags & F_VISIBLE) + if (flags & F_VISIBLE) CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0); DBDeleteContactSetting(NULL, "MyDetails", "ForceHideFrame"); @@ -296,7 +295,7 @@ int CreateFrame() if (DBGetContactSettingByte(NULL, "MyDetails", "ForceShowFrame", 0)) { int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0); - if(!(flags & F_VISIBLE)) + if (!(flags & F_VISIBLE)) CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0); DBDeleteContactSetting(NULL, "MyDetails", "ForceShowFrame"); @@ -341,7 +340,7 @@ int CreateFrame() menu.pszService= MODULE_NAME "/ShowHideMyDetails"; hMenuShowHideFrame = Menu_AddMainMenuItem(&menu); - if(DBGetContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) + if (DBGetContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) { ShowWindow(hwnd_container, SW_SHOW); FixMainMenu(); @@ -557,7 +556,7 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) iccex.dwSize = sizeof(iccex); iccex.dwICC = ICC_BAR_CLASSES; - if(!InitCommonControlsEx(&iccex)) + if (!InitCommonControlsEx(&iccex)) return NULL; /* CREATE A TOOLTIP WINDOW */ @@ -673,7 +672,7 @@ void CalcRectangles(HWND hwnd) if (ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS) && frame_id != -1) { int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0); - if(flags & F_UNCOLLAPSED) + if (flags & F_UNCOLLAPSED) { RECT rf; GetClientRect(hwnd, &rf); @@ -693,7 +692,7 @@ void CalcRectangles(HWND hwnd) GetWindowRect(parent, &rp_window); GetWindowRect(hwnd, &r_window); int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top); - if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) + if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) diff += (r_window.top - rp_window.top); SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); @@ -964,7 +963,7 @@ void CalcRectangles(HWND hwnd) text_left = r.left; // Away msg? - if(proto->CanGetStatusMsg()) + if (proto->CanGetStatusMsg()) { data->draw_away_msg = true; @@ -987,7 +986,7 @@ void CalcRectangles(HWND hwnd) text_left = r.left; // Listening to - if(proto->ListeningToEnabled() && proto->GetStatus() > ID_STATUS_OFFLINE) + if (proto->ListeningToEnabled() && proto->GetStatus() > ID_STATUS_OFFLINE) { data->draw_listening_to = true; @@ -1082,7 +1081,7 @@ void CalcRectangles(HWND hwnd) GetWindowRect(parent, &rp_window); GetWindowRect(hwnd, &r_window); int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top); - if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) + if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) diff += (r_window.top - rp_window.top); SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); @@ -1091,7 +1090,7 @@ void CalcRectangles(HWND hwnd) else if (IsWindowVisible(hwnd) && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0); - if(flags & F_VISIBLE) + if (flags & F_VISIBLE) { CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), (LPARAM)(size)); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW | FU_FMPOS)); @@ -1552,7 +1551,7 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL); - if(ret) + if (ret) CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret),MPCF_MAINMENU),(LPARAM)NULL); } @@ -1571,7 +1570,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto mii.cbSize = sizeof(mii); - if(!IsWinVer98Plus()) + if (!IsWinVer98Plus()) mii.fMask = MIIM_TYPE; else mii.fMask = MIIM_STRING; @@ -1608,7 +1607,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL); - if(ret) + if (ret) CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret),MPCF_MAINMENU),(LPARAM)NULL); /* @@ -1647,7 +1646,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL); DestroyMenu(menu); - if(ret) + if (ret) { proto->SetStatus(ret); } @@ -1772,7 +1771,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { RECT r; - if(GetUpdateRect(hwnd, &r, FALSE)) + if (GetUpdateRect(hwnd, &r, FALSE)) { PAINTSTRUCT ps; @@ -2559,7 +2558,7 @@ int ShowFrameFunc(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0); - if(!(flags & F_VISIBLE)) + if (!(flags & F_VISIBLE)) CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0); } else @@ -2604,7 +2603,7 @@ void FixMainMenu() mi.cbSize = sizeof(CLISTMENUITEM); mi.flags = CMIM_NAME; - if(MyDetailsFrameVisible()) + if (MyDetailsFrameVisible()) mi.pszName = Translate("Hide My Details"); else mi.pszName = Translate("Show My Details"); @@ -2621,7 +2620,7 @@ void RedrawFrame() // { // data->recalc_rectangles = true; - if(frame_id == -1) + if (frame_id == -1) { InvalidateRect(hwnd_container, NULL, TRUE); } @@ -2802,7 +2801,7 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) if (proto != NULL) PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM) proto->name, 0); } - else if(!strcmp(cws->szSetting,"MyHandle") + else if (!strcmp(cws->szSetting,"MyHandle") || !strcmp(cws->szSetting,"UIN") || !strcmp(cws->szSetting,"Nick") || !strcmp(cws->szSetting,"FirstName") diff --git a/plugins/MyDetails/mydetails.cpp b/plugins/MyDetails/mydetails.cpp index 83007d10dc..23ec9d8b0c 100644 --- a/plugins/MyDetails/mydetails.cpp +++ b/plugins/MyDetails/mydetails.cpp @@ -243,18 +243,14 @@ static int MainUninit(WPARAM wParam, LPARAM lParam) static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch ( msg ) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - SendMessage(GetDlgItem(hwndDlg, IDC_NICKNAME), EM_LIMITTEXT, - MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE - 1, 0); - - return TRUE; - } - - case WMU_SETDATA: + switch ( msg ) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SendMessage(GetDlgItem(hwndDlg, IDC_NICKNAME), EM_LIMITTEXT, + MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE - 1, 0); + return TRUE; + + case WMU_SETDATA: { int proto_num = (int)wParam; @@ -283,12 +279,11 @@ static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); } - else - { + else { Protocol *proto = protocols->Get(proto_num); - char tmp[128]; - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Nickname for %s"), proto->description); + TCHAR tmp[128]; + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s"), proto->description); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)tmp); @@ -301,15 +296,15 @@ static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname); SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, - min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); + min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); } return TRUE; } - case WM_COMMAND: - switch(wParam) { - case IDOK: + case WM_COMMAND: + switch(wParam) { + case IDOK: { TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, SIZEOF(tmp)); @@ -323,36 +318,33 @@ static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, L DestroyWindow(hwndDlg); break; } - case IDCANCEL: - DestroyWindow(hwndDlg); - break; - } - break; - - case WM_CLOSE: + case IDCANCEL: DestroyWindow(hwndDlg); break; + } + break; - case WM_DESTROY: - InterlockedExchange(&nickname_dialog_open, 0); - break; + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + InterlockedExchange(&nickname_dialog_open, 0); + break; } - + return FALSE; } static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) { - char * proto = (char *)lParam; + char *proto = (char*)lParam; int proto_num = -1; - if (proto != NULL) - { + if (proto != NULL) { int i; - for (i = 0 ; i < protocols->GetSize() ; i++) - { - if (_stricmp(protocols->Get(i)->name, proto) == 0) - { + for (i = 0 ; i < protocols->GetSize() ; i++) { + if (_stricmp(protocols->Get(i)->name, proto) == 0) { proto_num = i; break; } @@ -366,8 +358,7 @@ static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) } - if ( !nickname_dialog_open) - { + if ( !nickname_dialog_open) { InterlockedExchange(&nickname_dialog_open, 1); hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE( IDD_SETNICKNAME ), NULL, DlgProcSetNickname ); @@ -419,12 +410,9 @@ static int PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam) return 0; } - else - { + else { Protocol *protocol = protocols->Get(proto); - - if (protocol != NULL) - { + if (protocol != NULL) { lstrcpyn(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE); return 0; } @@ -433,7 +421,6 @@ static int PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam) } } - // Set avatar ///////////////////////////////////////////////////////////////////////////////////// static int PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) @@ -476,7 +463,7 @@ static int PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) static int PluginCommand_SetMyAvatar(WPARAM wParam,LPARAM lParam) { - char * proto = (char *)wParam; + char *proto = (char*)wParam; if (proto != NULL) { for (int i = 0 ; i < protocols->GetSize() ; i++) { if (_stricmp(protocols->Get(i)->name, proto) == 0) { @@ -513,8 +500,6 @@ int Status2SkinIcon(int status) return SKINICON_STATUS_OFFLINE; } - - static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) { TCHAR* ret = (TCHAR*)lParam; @@ -531,9 +516,9 @@ static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) return 0; } - + for (int i = 0 ; i < protocols->GetSize() ; i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if ( _stricmp(protocols->Get(i)->name, proto) == 0) { if ( !protocols->Get(i)->CanGetAvatar()) return -2; @@ -543,7 +528,7 @@ static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) lstrcpyn(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE); else ret[0] = '\0'; - + return 0; } } @@ -553,19 +538,16 @@ static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) static LRESULT CALLBACK StatusMsgEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) { - case WM_CHAR: - { - if(wParam == 0x0a && (GetKeyState(VK_CONTROL) & 0x8000) != 0) { - PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); - return 0; - } - - break; + switch (msg) { + case WM_CHAR: + if (wParam == 0x0a && (GetKeyState(VK_CONTROL) & 0x8000) != 0) { + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); + return 0; } + break; } - return CallWindowProc((WNDPROC) GetWindowLong(hwnd, GWL_USERDATA), hwnd, msg, wParam, lParam); + return CallWindowProc((WNDPROC) GetWindowLong(hwnd, GWL_USERDATA), hwnd, msg, wParam, lParam); } struct SetStatusMessageData { @@ -575,23 +557,20 @@ struct SetStatusMessageData { static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch ( msg ) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - SendMessage(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), EM_LIMITTEXT, - MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE - 1, 0); + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SendMessage(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), EM_LIMITTEXT, + MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE - 1, 0); - WNDPROC old_proc = (WNDPROC) SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), - GWL_WNDPROC, (LONG) StatusMsgEditSubclassProc); + WNDPROC old_proc = (WNDPROC) SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), + GWL_WNDPROC, (LONG) StatusMsgEditSubclassProc); - SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA, (long) old_proc); + SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA, (long) old_proc); - return TRUE; - } + return TRUE; - case WMU_SETDATA: + case WMU_SETDATA: { SetStatusMessageData *data = (SetStatusMessageData *) malloc(sizeof(SetStatusMessageData)); data->status = (int)wParam; @@ -599,20 +578,17 @@ static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wPar SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) data); - if (data->proto_num >= 0) - { + if (data->proto_num >= 0) { Protocol *proto = protocols->Get(data->proto_num); HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); - if (hIcon != NULL) - { + if (hIcon != NULL) { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); DestroyIcon(hIcon); } - char title[256]; - mir_snprintf(title, sizeof(title), Translate("Set My Status Message for %s"), - proto->description); + TCHAR title[256]; + mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Status Message for %s"), proto->description); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title); SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg()); @@ -621,9 +597,9 @@ static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wPar { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(Status2SkinIcon(data->status))); - char title[256]; - mir_snprintf(title, sizeof(title), Translate("Set My Status Message for %s"), - CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, data->status, 0)); + TCHAR title[256]; + mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Status Message for %s"), + CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, data->status, GSMDF_TCHAR)); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title); SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status)); @@ -637,46 +613,44 @@ static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wPar return TRUE; } - case WM_COMMAND: - switch(wParam) + case WM_COMMAND: + switch(wParam) { + case IDOK: { - case IDOK: - { - TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp)); + TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp)); - SetStatusMessageData *data = (SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA); + SetStatusMessageData *data = (SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA); - if (data->proto_num >= 0) - protocols->Get(data->proto_num)->SetStatusMsg(tmp); - else if (data->status == 0) - protocols->SetStatusMsgs(tmp); - else - protocols->SetStatusMsgs(data->status, tmp); + if (data->proto_num >= 0) + protocols->Get(data->proto_num)->SetStatusMsg(tmp); + else if (data->status == 0) + protocols->SetStatusMsgs(tmp); + else + protocols->SetStatusMsgs(data->status, tmp); - DestroyWindow(hwndDlg); - break; - } - case IDCANCEL: - { - DestroyWindow(hwndDlg); - break; - } + DestroyWindow(hwndDlg); } break; - case WM_CLOSE: + case IDCANCEL: DestroyWindow(hwndDlg); break; - - case WM_DESTROY: - SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_WNDPROC, - GetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA)); - free((SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA)); - InterlockedExchange(&status_msg_dialog_open, 0); - break; + } + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_WNDPROC, + GetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA)); + free((SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA)); + InterlockedExchange(&status_msg_dialog_open, 0); + break; } - + return FALSE; } diff --git a/plugins/MyDetails/options.cpp b/plugins/MyDetails/options.cpp index e879e078b7..5e4db774cf 100644 --- a/plugins/MyDetails/options.cpp +++ b/plugins/MyDetails/options.cpp @@ -118,18 +118,18 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { case WM_INITDIALOG: { - if(!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER)) + if (!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER)) { EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR_L),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR),FALSE); } - if(!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS)) + if (!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS)) { EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),FALSE); } - if(!IsDlgButtonChecked(hwndDlg,IDC_SHOW_PROTO_NAME)) + if (!IsDlgButtonChecked(hwndDlg,IDC_SHOW_PROTO_NAME)) { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_CYCLE_PROTO_BUTTON),FALSE); } -- cgit v1.2.3