!7 cmodule MultiCommClient > DynMultiComm { switchable S password; transient S botID = #1026281; start { considerAllActive = true; dm_reloadOnFieldChange('password); } enhanceFrame { minFrameSize(f, 300, 300); } visualize { if (empty(password) || !testPassword()) { JPasswordField pw = centerTextField(jpassword(password)); ret jfullcenter(withCenteredTitle("Please enter password:", onEnter(pw, r { setField(password := gtt(pw)); }))); } ret awtEveryAndNow(super.visualize(), 10.0, r loadCustomersAndMessages); } bool testPassword() { S result = print(queryBackend("testAuth")); bool ok = startsWith(result, "OK"); if (!ok) infoBox("Password check failed: " + result); ret ok; } S queryBackend(S uri, O... params) { ret postPage(rawBotLink(botID, uri), paramsPlus(params, _pass := password)); } void loadCustomers q { importAllConceptsOfType(Customer, print("customers", unstructureList(queryBackend("activeCustomers"))), debug := true); } void loadCustomersAndMessages q { L l = unstructureList(queryBackend("activeCustomersAndMsgs")); importAllConceptsOfType(Customer, instancesOf Customer(l)); importAllConceptsOfType(Message, map(instancesOf Message(l), msg -> { msg.customer = getConcept(Customer, msg.customer.id); ret msg; })); } }