diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-28 22:20:11 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-28 22:20:11 +0200 |
commit | c33d258dd9645ba07ea9b5ef8a2fa924d771d228 (patch) | |
tree | a67a63eaf3281a87f1c920674ac901499172f3f4 /webclient | |
parent | faa129e7f4ea98df702141c334dc8e869c0ca673 (diff) |
webclient: Bug fixes
Diffstat (limited to 'webclient')
-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; |