sclass ELPost { S text; int suggestionIndex; // Which suggestion was taken? S suggester; S chatTime; } static L<ELPost> scanEventLogForPosts(S progID, S dialogName) { ret scanEventLogForPosts(getProgramFile(progID, dialogName)); } // dialogDir can also be the log file static L<ELPost> scanEventLogForPosts(File dialogDir) { if (dialogDir == null) null; L<L> l = scanLog_safeUnstructure(fileFromDir(dialogDir, "event.log")); new L<ELPost> data; for i over l: pcall { L a = l.get(i), prev = get(l, i-1); if (firstIs(a, "Posting")) { Map map = cast get(a, 2); S text = getString(map, "Text").trim(); if (eq(text, "!delete")) { removeLast(data); continue; } new ELPost post; post.text = text; post.chatTime = getString(a, 1); pcall { if (prev != null && firstIs(prev, "Suggestion chosen")) { Map m = getMap(prev, 2); S suggestion = getString(m, "Suggestion"); if (eq(suggestion, post.text)) { post.suggestionIndex = toInt(get(m, "Row")); post.suggester = getString(m, "Suggester"); } } } data.add(post); } } ret data; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1003901 | 
| Snippet name: | scanEventLogForPosts | 
| Eternal ID of this version: | #1003901/1 | 
| Text MD5: | a3e6b13fa8af56daae497ba741bbea0a | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2016-08-13 19:13:44 | 
| Source code size: | 1227 bytes / 40 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 789 / 797 | 
| Referenced in: | [show references] |