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)

1  
static S botAppendToMechList_mode(S name, S text, S mode) {
2  
  if (empty(name) || empty(text)) ret "";
3  
  
4  
  ifclass VirtualMechLists
5  
    O writeMode = mechMode().writeMode;
6  
    if (writeMode cast VirtualMechLists) {
7  
      if (eq(mode, 'uniqCI))
8  
        text = lines(listMinusSet(tlft(text), asCISet(tlft(writeMode.mL_raw(name)))));
9  
      if (empty(text)) ret "No change";
10  
      mech_notifyBusOfChange(name);
11  
      print("Adding to mech list " + name + ":");
12  
      printIndent(text);
13  
      writeMode.append(name, text);
14  
      mechList_clearCache(name);
15  
      ret name + ": Changed";
16  
    }
17  
  endif
18  
  
19  
  S result = postPageSilently("http://butter.botcompany.de:8080/mech/raw/bot-list-append", arrayPlus(muricaCredentials(), +name, +text, +mode));
20  
  if (!swic(result, "No change")) {
21  
    if (eq(mechMode().readMode, 'localCopies)) {
22  
      print("Appending to local list copy: " + name);
23  
      appendToLocalMechListCopy(name, text);
24  
    }
25  
    mech_notifyBusOfChange(name);
26  
    mechList_clearCache(name);
27  
  }
28  
  //infoBox(name + ": " + result);
29  
  ret result;
30  
}
31  
32  
static S botAppendToMechList_mode(S name, Collection<S> lines, S mode) {
33  
  if (empty(lines)) ret "";
34  
  ret botAppendToMechList_mode(name, lines(lines), mode);
35  
}

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: 668 / 1195
Version history: 11 change(s)
Referenced in: [show references]