diff --git a/world/net/place/threads.c b/world/net/place/threads.c
index c161668..35338b7 100644
--- a/world/net/place/threads.c
+++ b/world/net/place/threads.c
@@ -267,17 +267,15 @@ setSubject(id, thread) {
// TODO: topic uebergeben
addEntry(text, unick, thread) {
- mapping* entries;
+ int id = sizeof(_thread);
mapping newentry = ([
- "text" : text,
- "author" : unick,
- "date" : time(),
- "thread" : thread || "",
+ "id": id,
+ "text": text,
+ "author": unick,
+ "date": time(),
+ "thread": thread || "",
]);
- entries = _thread || ({ });
- entries += ({ newentry });
- int id = sizeof(entries) - 1;
- _thread = entries;
+ _thread += ({ newentry });
save();
castmsg(ME, "_notice_thread_entry",
thread ?
@@ -528,23 +526,18 @@ displayMain(last) {
}
#endif
-htmlEntries(array(mapping) entries, int last, int js, string chan, string submit) {
- P3((">> threads:htmlentries(%O, %O)\n", entries, last))
- string t;
- string ht = "";
+htmlEntries(array(mapping) entries, int js, string chan, string submit) {
+ P3((">> threads:htmlentries(%O, %O, %O, %O)\n", entries, js, chan, submit))
+ string t, ht = "";
+ string id_prefix = chan ? chan + "-" : "";
if (js) ht +=
"\n";
- string id_prefix = chan ? chan + "-" : "";
- mapping item;
- int n = 0;
- int id;
- // reverse order
- for (id = sizeof(entries) - 1; id >= 0; id--) {
- P3((">>> entries[%O]: %O\n", id, entries[id]))
- unless (item = entries[id]) continue;
+ foreach (mapping item : entries) {
+ P3((">>> item: %O\n", item))
+ unless (item) continue;
t = htquote(item["text"]);
t = replace(t, "\n", "
\n");
@@ -559,48 +552,45 @@ htmlEntries(array(mapping) entries, int last, int js, string chan, string submit
ht +=
"