src/crypto.c: possible fix for memory leak related
[citadel.git] / webcit / static / instant_messenger.html
index 6d12105baab548530427372f05b00034535db7f1..1db2b4a2e3a8ddd8dc4f69cc3844e7a9868a9b7a 100644 (file)
@@ -4,7 +4,7 @@
        <script type="text/javascript" src="prototype.js"></script>
        <script type="text/javascript" src="wclib.js"></script>
 </head>
-<body>
+<body onLoad='FetchNewMsgs();'>
 
 <div id="thetop" style="position:fixed;width:100%;height:15%;top:0%;left:0%">
 <div id="spacer1" style="background:#aaaaaa"><br></div>
@@ -32,7 +32,7 @@ function SendSomething(which_div, sendform, recipient) {
        // Clear the box
        document.forms[sendform].elements['sendthis'].value = '';
 
-       // Write it to the window
+       // Write it to the tab
        $(which_div).innerHTML = $(which_div).innerHTML
                                + '<b>'
                                + '<font color=\"#FF0000\">'
@@ -42,6 +42,9 @@ function SendSomething(which_div, sendform, recipient) {
                                + thetext
                                + '<br />\n';
 
+       // Scroll to the bottom of the tab
+       $('main').scrollTop = 999999;
+
        // Send the text to the server
        parms = 'r=' + Math.random()
                + '&g_cmd=SEXP ' + recipient + '|' + thetext;
@@ -52,6 +55,9 @@ function SendSomething(which_div, sendform, recipient) {
                }
        );
 
+       // Refocus to the text box
+       document.forms[sendform].elements['sendthis'].focus();
+
        // Don't submit the form
        return false;
 }
@@ -108,14 +114,18 @@ function ShowNewMsg(gexp_xmlresponse) {
                          $('main').innerHTML
                        + '<div id=\"tab_' + which_div + '\" style=\"display:none;cursor:pointer\">'
                        + '<div id=\"' + which_div + '\">'
+                       + '<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />'
+                       + '<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />'
                        + '</div>'
-                       + '<div id=\"response_' + which_div + '\">'
+                       + '<div align=\"center\" id=\"response_'
+                       + which_div + '\" style=\"background:#ddddee\">'
                        + '<br><form method=\"post\" action=\"null\" name=\"sendform_' + which_div + '\" '
                        + 'onSubmit=\"return SendSomething(\'' + which_div + '\', \'sendform_'
                        + which_div + '\', \'' + sender + '\');\">'
-                       + '<input type=\"text\" size=\"80\" maxlength=\"80\" name=\"sendthis\">'
+                       + '<img src=\"citadelchat_16x.gif\">&nbsp;'
+                       + '<input type=\"text\" size=\"72\" maxlength=\"72\" name=\"sendthis\">'
                        + '</form>'
-                       + '</div>'
+                       + '<br></div>'
                        + '</div>\n';
                $('tab_bar').innerHTML =
                          $('tab_bar').innerHTML
@@ -141,7 +151,13 @@ function ShowNewMsg(gexp_xmlresponse) {
                                + '<br />\n';
 
        // Scroll to the bottom of the tab
-       $(which_div).scrolltop = $(which_div).scrollHeight - $(which_div).clientHeight;
+       $('main').scrollTop = 999999;
+
+       // Refocus to the send box
+       document.forms['sendform_'+which_div].elements['sendthis'].focus();
+
+       // Keep trying for new messages until the server tells us to stop.
+       FetchNewMsgs();
 }
 
 // This is called periodically to check for new incoming messages
@@ -184,7 +200,7 @@ function GrabMyName(greg_xmlresponse) {
 
 
 // Cause FetchNewMsgs() to be called periodically.
-new PeriodicalExecuter(FetchNewMsgs, 3);
+new PeriodicalExecuter(FetchNewMsgs, 10);
 
 </script>