From c33d258dd9645ba07ea9b5ef8a2fa924d771d228 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 28 Mar 2017 22:20:11 +0200 Subject: webclient: Bug fixes --- webclient/client.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'webclient') 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 "]); + addRoomEntry(roomid,"error",["Usage: /"+cmd+" "]); 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; -- cgit v1.2.3-70-g09d2