From 9d21406d68ebdce18110431fb24c9963dcc44373 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 16 Mar 2017 21:42:24 +0100 Subject: Send new messages to every fd of user --- command.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index 0f2cd06..bf6c29d 100644 --- a/command.c +++ b/command.c @@ -212,10 +212,13 @@ static bool cmd_send(struct conn_data *data,const char *tag,const char **args){ struct db_user_list members=db_get_members(roomid); for(i64 i=0;ifd){ - send_push(fd,"message",args[1]); - // TODO: unregister and close users that aren't reachable anymore; maybe ping instead? + i64 nfds; + const int *fds=userdata_online(members.list[i].id,&nfds); + if(nfds<=0)continue; + for(i64 j=0;jfd){ + send_push(fds[j],"message",args[1]); + } } } -- cgit v1.2.3-54-g00ecf