aboutsummaryrefslogtreecommitdiff
path: root/webclient
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-04 14:40:38 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-04 14:40:38 +0200
commit3c95917352dfd8ae43768003207e1bb1e80a7376 (patch)
treeaff622cb75266898baef8f7eba721b44448e9477 /webclient
parent191fc6cf55df805d36555a26177da0eac65b6261 (diff)
Send msgids in 'send' response and '_push message'
Diffstat (limited to 'webclient')
-rw-r--r--webclient/client.html8
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;
}