]> git.scottworley.com Git - reliable-chat/blobdiff - webclient/rc.html
rcaddmessagetohistory() accepts a message object
[reliable-chat] / webclient / rc.html
index 2bb1610ac7930e2c03f0a46fcc5345dc15814589..8f69921f4241c678fc0d565045b6abb6699b882d 100644 (file)
@@ -79,9 +79,9 @@
   <script type="text/javascript"><!--//--><![CDATA[//><!--
        var servers = ['chkno.net', 'rc2.chkno.net', 'echto.net', 'the-wes.com', 'vibrantlogic.com'];
 
-       var session = Math.random();
-       var since = {};
-       var seen = {};
+       var session = Math.random();  // For outgoing message IDs
+       var since = {};  // server -> time: For fetch?since=
+       var seen = {};  // seen_key -> true
 
        function rcnick() {
                var nick = localStorage.getItem("nick");
 
        function rcaddmessagetohistory(message) {
                var d = document.createElement("div");
-               d.appendChild(document.createTextNode(message));
+               d.appendChild(document.createTextNode(message.Text));
                var h = document.getElementById("history");
                h.appendChild(d);
                window.scrollTo(0, document.body.scrollHeight);
                        var seen_key = make_seen_key(messages[i]['ID'], messages[i]['Text']);
                        if (!(seen_key in seen)) {
                                seen[seen_key] = true;
-                               rcaddmessagetohistory(messages[i]['Text']);
+                               rcaddmessagetohistory(messages[i]);
                                for (var i in servers) {
                                        rcchangeserverstatus(servers[i], "sad");
                                }
                        message = "<" + rcnick() + "> " + input;
                }
 
-               var d = rcaddmessagetohistory(message);
+               var d = rcaddmessagetohistory({'Text': message});
                rcsend(d, message);
        }