From 19ceccdab1cb11f74d8f402429cea54ddcb183d6 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 5 Jul 2020 18:16:59 +0200 Subject: server/protocol: Include inviter username in _push invite --- command.c | 4 +++- protocol.md | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/command.c b/command.c index a7d5b02..4ace92b 100644 --- a/command.c +++ b/command.c @@ -188,11 +188,13 @@ static struct cmd_retval cmd_invite(struct conn_data *data,const char *tag,const db_add_member(roomid,user2); + const char *inviter_username=db_get_username(data->userid); + const char *username=args[1]; char *joinbuf=NULL; i64 joinbuflen=asprintf(&joinbuf,"_push join %s %s\n",roomname,username); char *invitebuf=NULL; - i64 invitebuflen=asprintf(&invitebuf,"_push invite %s\n",roomname); + i64 invitebuflen=asprintf(&invitebuf,"_push invite %s %s\n",roomname,inviter_username); event_emit_join(make_timestamp(),username,roomname); diff --git a/protocol.md b/protocol.md index d4c544b..346bfe4 100644 --- a/protocol.md +++ b/protocol.md @@ -182,8 +182,9 @@ are listed below. - `_push message ` - Sent to all sessions of all members of a room in which a message is posted, except the session that sent the message. -- `_push invite ` - - Sent to all sessions of the invited user after an `invite` command. +- `_push invite ` + - Sent to all sessions of the invited user after an `invite` command. The + `` parameter indicates who invited you to the given room. - `_push join ` - Sent to all sessions of all members of a room (except the session sending the `invite` command) in which a new user entered. -- cgit v1.2.3-54-g00ecf