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

51
LINES

< > BotCompany Repo | #1026282 // IPTV Multi-Comm Client [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).

!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; }));
  }
}

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: #1026282
Snippet name: IPTV Multi-Comm Client [dev.]
Eternal ID of this version: #1026282/18
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:48:13
Source code size: 1465 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 462
Version history: 17 change(s)
Referenced in: [show references]