summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-17 18:26:56 +0100
committerwm4 <wm4@nowhere>2014-03-17 18:26:56 +0100
commit637664d95ad5e2ad72b91998dc4685bf0fe6cdeb (patch)
tree86845d85012850a58b213c7f4046b4a855dd5a2a /player/command.c
parent422af1b948135e422a13e5d58bef32e4ee38f172 (diff)
downloadmpv-637664d95ad5e2ad72b91998dc4685bf0fe6cdeb.tar.bz2
mpv-637664d95ad5e2ad72b91998dc4685bf0fe6cdeb.tar.xz
command, lua: change script_message semantics
Change script_message to broadcast the message to all clients. Add a new script_message_to command, which does what the old script_message command did. This is intended as simplification, although it might lead to chaos too.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index 0af012bb16..e15d3db54e 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3370,7 +3370,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
}
- case MP_CMD_SCRIPT_MESSAGE: {
+ case MP_CMD_SCRIPT_MESSAGE_TO: {
mpv_event_client_message *event = talloc_ptrtype(NULL, event);
*event = (mpv_event_client_message){0};
for (int n = 1; n < cmd->nargs; n++) {
@@ -3385,6 +3385,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
break;
}
+ case MP_CMD_SCRIPT_MESSAGE: {
+ const char *args[MP_CMD_MAX_ARGS];
+ mpv_event_client_message event = {.args = args};
+ for (int n = 0; n < cmd->nargs; n++)
+ event.args[event.num_args++] = cmd->args[n].v.s;
+ mp_client_broadcast_event(mpctx, MPV_EVENT_CLIENT_MESSAGE, &event);
+ break;
+ }
#if HAVE_SYS_MMAN_H
case MP_CMD_OVERLAY_ADD: