MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / OptionsHandleCommand

Function OptionsHandleCommand

src/windows/OptionsDialog.cpp:308–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308INT_PTR OptionsHandleCommand(HWND hwndParent, HWND hWnd, int pageNum, UINT uMsg, WPARAM wParam, LPARAM lParam)
309{
310 if (LOWORD(wParam) == IDOK)
311 return EndDialog(hWnd, IDOK);
312
313 switch (pageNum)
314 {
315 case PG_ACCOUNT_AND_PRIVACY:
316 {
317 switch (LOWORD(wParam))
318 {
319 case IDC_REVEALEMAIL: {
320 Profile* pProfile = GetDiscordInstance()->GetProfile();
321 HWND hwndText = GetDlgItem(hWnd, IDC_EMAIL_DISPLAY);
322 LPCTSTR lpctstr = ConvertCppStringToTString(pProfile->m_email);
323 SetWindowText(hwndText, lpctstr);
324 free((void*)lpctstr);
325 break;
326 }
327 case IDC_LOG_OUT: {
328 if (MessageBox(hWnd, TmGetTString(IDS_LOG_OUT_MESSAGE), TmGetTString(IDS_PROGRAM_NAME), MB_YESNO | MB_ICONQUESTION) == IDYES)
329 {
330 // Log them out!
331 if (hWnd != hwndParent)
332 EndDialog(hWnd, 0);
333 EndDialog(hwndParent, OPTIONS_RESULT_LOGOUT);
334 return TRUE;
335 }
336 break;
337 }
338 case IDC_SDM_LEVEL0:
339 GetSettingsManager()->SetExplicitFilter(FILTER_NONE);
340 GetSettingsManager()->FlushSettings();
341 break;
342 case IDC_SDM_LEVEL1:
343 GetSettingsManager()->SetExplicitFilter(FILTER_EXCEPTFRIENDS);
344 GetSettingsManager()->FlushSettings();
345 break;
346 case IDC_SDM_LEVEL2:
347 GetSettingsManager()->SetExplicitFilter(FILTER_TOTAL);
348 GetSettingsManager()->FlushSettings();
349 break;
350 case IDC_ENABLE_DMS:
351 {
352 bool updateAllServers = MessageBox(
353 hwndParent,
354 TmGetTString(IDS_DMBLOCK_APPLY_RETROACTIVELY),
355 TmGetTString(IDS_PROGRAM_NAME),
356 MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2
357 ) == IDYES;
358
359 bool isChecked = IsDlgButtonChecked(hWnd, IDC_ENABLE_DMS);
360
361 std::vector<Snowflake> blocklist;
362 if (updateAllServers)
363 {
364 if (!isChecked)
365 GetDiscordInstance()->GetGuildIDs(blocklist, false);

Callers 2

OptionsChildDialogProcFunction · 0.85
DialogProcFunction · 0.85

Calls 15

GetDiscordInstanceFunction · 0.85
GetSettingsManagerFunction · 0.85
GetLocalSettingsFunction · 0.85
eImageAlignmentEnum · 0.85
GetProfileMethod · 0.80
SetExplicitFilterMethod · 0.80
FlushSettingsMethod · 0.80
GetGuildIDsMethod · 0.80
SetGuildDMBlocklistMethod · 0.80
SetDMBlockDefaultMethod · 0.80
SetMessageStyleMethod · 0.80

Tested by

no test coverage detected