aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-05 18:16:59 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-05 18:16:59 +0200
commit19ceccdab1cb11f74d8f402429cea54ddcb183d6 (patch)
tree988678a98778f81f2a5e3a95a5543d6adbf7b9dd
parentb0197c73ed4ee3babb85982d589863404853f915 (diff)
server/protocol: Include inviter username in _push invite
-rw-r--r--command.c4
-rw-r--r--protocol.md5
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 <roomname:word> <user:word> <timestamp:i64> <msgid:i64> <message:string...>`
- 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 <roomname:word>`
- - Sent to all sessions of the invited user after an `invite` command.
+- `_push invite <roomname:word> <user:word>`
+ - Sent to all sessions of the invited user after an `invite` command. The
+ `<user>` parameter indicates who invited you to the given room.
- `_push join <roomname:word> <user:word>`
- Sent to all sessions of all members of a room (except the session sending
the `invite` command) in which a new user entered.