Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

51
LINES

< > BotCompany Repo | #1026286 // IPTV Multi-Comm Client v2 [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (15797L/85K).

1  
!7
2  
3  
cmodule MultiCommClient > DynMultiComm {
4  
  switchable S password;
5  
  
6  
  transient S botID = #1026281;
7  
  
8  
  start {
9  
    considerAllActive = true;
10  
    dm_reloadOnFieldChange('password);
11  
  }
12  
  
13  
  enhanceFrame { minFrameSize(f, 300, 300); }
14  
  
15  
  visualize {
16  
    if (empty(password) || !testPassword()) {
17  
      JPasswordField pw = centerTextField(jpassword(password));
18  
      ret jfullcenter(withCenteredTitle("Please enter password:",
19  
        onEnter(pw, r {
20  
          setField(password := gtt(pw));
21  
        })));
22  
    }
23  
24  
    ret awtEveryAndNow(super.visualize(), 10.0, r loadCustomersAndMessages);
25  
  }
26  
  
27  
  bool testPassword() {
28  
    S result = print(queryBackend("testAuth"));
29  
    bool ok = startsWith(result, "OK");
30  
    if (!ok)
31  
      infoBox("Password check failed: " + result);
32  
    ret ok;
33  
  }
34  
  
35  
  S queryBackend(S uri, O... params) {
36  
    ret postPage(rawBotLink(botID, uri), paramsPlus(params, _pass := password));
37  
  }
38  
  
39  
  void loadCustomers q {
40  
    importAllConceptsOfType(Customer,
41  
      print("customers", unstructureList(queryBackend("activeCustomers"))), debug := true);
42  
  }
43  
  
44  
  void loadCustomersAndMessages q {
45  
    L l = unstructureList(queryBackend("activeCustomersAndMsgs"));
46  
    importAllConceptsOfType(Customer, instancesOf Customer(l));
47  
    importAllConceptsOfType(Message,
48  
      map(instancesOf Message(l),
49  
        msg -> { msg.customer = getConcept(Customer, msg.customer.id); ret msg; }));
50  
  }
51  
}

Author comment

Began life as a copy of #1026282

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026286
Snippet name: IPTV Multi-Comm Client v2 [dev.]
Eternal ID of this version: #1026286/14
Text MD5: b86315505d386621d227279c46364e88
Transpilation MD5: d4db23e2b57c1030905a8215e6f76184
Author: stefan
Category: javax / comm
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-12-12 00:46:54
Source code size: 1465 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 254 / 541
Version history: 13 change(s)
Referenced in: [show references]