From 3c95917352dfd8ae43768003207e1bb1e80a7376 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 4 Jul 2020 14:40:38 +0200 Subject: Send msgids in 'send' response and '_push message' --- webclient/client.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'webclient/client.html') diff --git a/webclient/client.html b/webclient/client.html index fce719d..ab10cbc 100644 --- a/webclient/client.html +++ b/webclient/client.html @@ -112,7 +112,8 @@ function reconnect(){ if(id=="_push"){ if(type=="message"){ var r=spl.word[2],u=spl.word[3],t=new Date(+spl.word[4]/1000); - addRoomEntry(r,"message",[u,t,spl.rest[5]]); + // Ignore msgid at word[5] + addRoomEntry(r,"message",[u,t,spl.rest[6]]); } else if(type=="invite"){ var r=spl.word[2]; roomlist.push(r); @@ -135,6 +136,7 @@ function reconnect(){ var obj; if(type=="ok")fn(true); else if(type=="error")fn(null,spl.rest[2]); + else if(type=="number")fn(+spl.rest[2]); else if(type=="name")fn(spl.rest[2]); else if(type=="list")fn(spl.word.slice(3)); else if(type=="history"){ @@ -421,8 +423,8 @@ function sendMessage(roomid,text){ return; } var sentAs=username,msg=text.replace(/\n/g,""); - net_send("send "+roomid+" "+msg,function(ok,err){ - if(ok){ + net_send("send "+roomid+" "+msg,function(msgid,err){ + if(msgid!=null){ addRoomEntry(roomid,"message",[sentAs,new Date().getTime(),msg]); return; } -- cgit v1.2.3-54-g00ecf