]> git.scottworley.com Git - reliable-chat/blobdiff - webclient/rc.html
/nick requires an argument
[reliable-chat] / webclient / rc.html
index 7f3e8d1bfaaca05d536bbe3a1cfc9b0004b5bf11..4a956ea608bee4cbcb76a00a25cd90b65d863617 100644 (file)
                font-size: 85%;
                text-align: right;
        }
+       .status {
+               color: #dd8;
+       }
+       .local.self {
+               color: #d8d;
+       }
+       .self {
+               color: #8d8;
+       }
+       .me {
+               color: #bbd;
+       }
        .servercount {
                margin-right: -0.5em;
                font-size: 70%;
                        type = "status";
                } else if (/^\* /.test(message.Text)) {
                        type = "me";
+               } else if (/^-!- /.test(message.Text)) {
+                       type = "local";
                } else {
                        type = "text";
                }
                        "?id=" + encodeURIComponent(message.ID) +
                        "&text=" + encodeURIComponent(message.Text);
                for (var i in servers) {
-                       var uri = rcserverbase(servers[i]) + path;
-                       var img = document.createElement("img");
-                       img.setAttribute("src", uri);
-                       d.appendChild(img);
+                       var xhr = new XMLHttpRequest();
+                       xhr.open("POST", rcserverbase(servers[i]) + path);
+                       xhr.send();
                }
        }
 
                                        rcaddmessagetoUI({'Text': '-!- Your nick is already ' + rcnick(), 'ServerTimes': {}});
                                        return;
                                }
-                               message = "*** " + rcnick() + " is now known as " + rest;
-                               rcsetnick(rest);
+                               if (rest) {
+                                       message = "*** " + rcnick() + " is now known as " + rest;
+                                       rcsetnick(rest);
+                               } else {
+                                       rcaddmessagetoUI({'Text': '-!- /nick requires an argument', 'ServerTimes': {}});
+                                       return;
+                               }
                        } else {
                                rcaddmessagetoUI({'Text': '-!- No such command: ' + command, 'ServerTimes': {}});
                                return;