AmendHub

Download:

jcs

/

wifi_da

/

amendments

/

11

window: Don't use passphrase dialog for networks not needing auth


jcs made amendment 11 about 1 year ago
--- window.c Fri Oct 20 23:34:09 2023 +++ window.c Sun Oct 22 12:14:42 2023 @@ -331,11 +331,16 @@ window_mousedown(Point p) new_net = PopUpMenuSelect(ssid_menu, r.top + 1, r.left + 1, selitem); DeleteMenu((*ssid_menu)->menuID); + if (hiword(new_net) == 0 || loword(new_net) == selitem) + goto menu_done; - if (hiword(new_net) != 0 && loword(new_net) != selitem) { - net = &wifi_menu_networks[loword(new_net) - 1]; + net = &wifi_menu_networks[loword(new_net) - 1]; + + memset(&wjr, 0, sizeof(wjr)); + strlcpy(wjr.ssid, net->ssid, sizeof(wjr.ssid)); + + if (net->flags & WIFI_NETWORK_FLAG_AUTH) { strlcpy(ssid, net->ssid, sizeof(ssid)); - CtoPstr(ssid); ParamText(ssid, "\p", "\p", "\p"); PtoCstr(ssid); @@ -366,26 +371,25 @@ window_mousedown(Point p) break; } - if (hit == ok) { - //DEBUG_LOG(("pass is \"%s\"", pass_storage)); - - memset(&wjr, 0, sizeof(wjr)); - strlcpy(wjr.ssid, ssid, sizeof(wjr.ssid)); - strlcpy(wjr.key, pass_storage, sizeof(wjr.key)); - + if (hit != ok) { PasswordDialogFieldFinish(); DisposDialog(dg); - - scsi_wifi_join(wifi_scsi_id, &wjr); - - /* force an update of the list */ - scsi_wifi_info(wifi_scsi_id, &wifi_cur_info); - update_wifi_ssid_list(false); - } else { - PasswordDialogFieldFinish(); - DisposDialog(dg); + goto menu_done; } + + //DEBUG_LOG(("pass is \"%s\"", pass_storage)); + strlcpy(wjr.key, pass_storage, sizeof(wjr.key)); + + PasswordDialogFieldFinish(); + DisposDialog(dg); } - + + scsi_wifi_join(wifi_scsi_id, &wjr); + + /* force an update of the list */ + scsi_wifi_info(wifi_scsi_id, &wifi_cur_info); + update_wifi_ssid_list(false); + +menu_done: SetPort(savePort); }