diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-04 14:40:38 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-04 14:40:38 +0200 |
commit | 3c95917352dfd8ae43768003207e1bb1e80a7376 (patch) | |
tree | aff622cb75266898baef8f7eba721b44448e9477 /webclient/client.html | |
parent | 191fc6cf55df805d36555a26177da0eac65b6261 (diff) |
Send msgids in 'send' response and '_push message'
Diffstat (limited to 'webclient/client.html')
-rw-r--r-- | webclient/client.html | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |