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

35
LINES

< > BotCompany Repo | #1015775 // botAppendToMechList_mode - add with special mode (uniq, uniqCI)

JavaX fragment (include)

static S botAppendToMechList_mode(S name, S text, S mode) {
  if (empty(name) || empty(text)) ret "";
  
  ifclass VirtualMechLists
    O writeMode = mechMode().writeMode;
    if (writeMode cast VirtualMechLists) {
      if (eq(mode, 'uniqCI))
        text = lines(listMinusSet(tlft(text), asCISet(tlft(writeMode.mL_raw(name)))));
      if (empty(text)) ret "No change";
      mech_notifyBusOfChange(name);
      print("Adding to mech list " + name + ":");
      printIndent(text);
      writeMode.append(name, text);
      mechList_clearCache(name);
      ret name + ": Changed";
    }
  endif
  
  S result = postPageSilently("http://butter.botcompany.de:8080/mech/raw/bot-list-append", arrayPlus(muricaCredentials(), +name, +text, +mode));
  if (!swic(result, "No change")) {
    if (eq(mechMode().readMode, 'localCopies)) {
      print("Appending to local list copy: " + name);
      appendToLocalMechListCopy(name, text);
    }
    mech_notifyBusOfChange(name);
    mechList_clearCache(name);
  }
  //infoBox(name + ": " + result);
  ret result;
}

static S botAppendToMechList_mode(S name, Collection<S> lines, S mode) {
  if (empty(lines)) ret "";
  ret botAppendToMechList_mode(name, lines(lines), mode);
}

Author comment

Began life as a copy of #1014246

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1015775
Snippet name: botAppendToMechList_mode - add with special mode (uniq, uniqCI)
Eternal ID of this version: #1015775/12
Text MD5: 48234f7bf422e9788c62f155bc2230d7
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-20 17:16:09
Source code size: 1248 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 991
Version history: 11 change(s)
Referenced in: [show references]