aboutsummaryrefslogtreecommitdiff
path: root/firebase.c
diff options
context:
space:
mode:
Diffstat (limited to 'firebase.c')
-rw-r--r--firebase.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/firebase.c b/firebase.c
index 6244882..5221af7 100644
--- a/firebase.c
+++ b/firebase.c
@@ -16,11 +16,13 @@ static void write_field(FILE *f,const char *key,const char *value){
fprintf(f," %s %zu %s",key,strlen(value),value);
}
-static void token_send(const char *token,const char *room,const char *user,const char *msg){
+static void token_send(const char *token,const char *to_user,const char *room,const char *user,const char *msg){
+ fprintf(stderr,"token_send(%s,%s,%s,%s,%s)\n",token,to_user,room,user,msg);
fprintf(js_write,"message");
write_field(js_write,"token",token);
write_field(js_write,"room",room);
write_field(js_write,"user",user);
+ write_field(js_write,"to_user",to_user);
write_field(js_write,"message",msg);
fprintf(js_write,"\n");
fflush(js_write);
@@ -67,7 +69,7 @@ static void script_output_listener(FILE *js_read){
continue;
invalid_line:
- fprintf(stderr,"firebase thread: Invalid line form js script: <%s>\n",line);
+ fprintf(stderr,"firebase thread: Invalid line from js script: <%s>\n",line);
}
}
@@ -130,7 +132,7 @@ void firebase_send_message(const char *room,i64 roomid,const char *user,const ch
if(userdata_is_active(members.list[i].id))continue;
struct db_strings_list tokens=db_user_tokens(members.list[i].id);
for(i64 j=0;j<tokens.count;j++){
- token_send(tokens.list[j],room,user,msg);
+ token_send(tokens.list[j],members.list[i].name,room,user,msg);
}
db_nullify_strings_list(tokens);
}