diff options
Diffstat (limited to 'webclient/client.html')
-rw-r--r-- | webclient/client.html | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/webclient/client.html b/webclient/client.html index 7072ed1..3e7beb7 100644 --- a/webclient/client.html +++ b/webclient/client.html @@ -93,7 +93,7 @@ function reconnect(){ if(id=="_push"){ if(type=="message"){ var r=spl.word[2],u=spl.word[3]; - addRoomEntry(r,"message",[u,+spl.rest[3],spl.rest[4]]); + addRoomEntry(r,"message",[u,new Date().getTime(),spl.rest[4]]); } else { alert("Unknown push message type '"+type+"'!"); } @@ -282,18 +282,20 @@ function executeCommand(roomid,text){ case "register": case "login": if(spl.word.length<3){ - addRoomEntry(roomid,"error",["Usage: /login <username> <password>"]); + addRoomEntry(roomid,"error",["Usage: /"+cmd+" <username> <password>"]); break; } creds=[spl.word[1],spl.rest[2]]; net_send(cmd+" "+creds[0]+" "+creds[1],function(ok,err){ - if(ok){ + if(err){ + addRoomEntry(roomid,"error",["Unable to "+cmd+": "+err]); + } else if(cmd=="register"){ + addRoomEntry(roomid,"notice",["Successfully registered user '"+creds[0]+"'"]); + } else { username=creds[0]; addRoomEntry(roomid,"notice",["Logged in as user '"+creds[0]+"'"]); updateStatus(); fetchRoomList(); - } else { - addRoomEntry(roomid,"error",["Unable to "+cmd+": "+err]); } }); break; |