diff --git a/doc/protocol.rst b/doc/protocol.rst index ddecab279..88742f9d2 100644 --- a/doc/protocol.rst +++ b/doc/protocol.rst @@ -1354,6 +1354,9 @@ additional services. New messages are indicated by the ``message`` idle event. +If your MPD instance has multiple partitions, note that +client-to-client messages are local to the current partition. + :command:`subscribe {NAME}` Subscribe to a channel. The channel is created if it does not exist already. The name may consist of diff --git a/src/command/MessageCommands.cxx b/src/command/MessageCommands.cxx index 8fd63d6ba..c38bc4050 100644 --- a/src/command/MessageCommands.cxx +++ b/src/command/MessageCommands.cxx @@ -78,7 +78,12 @@ handle_channels(Client &client, gcc_unused Request args, Response &r) assert(args.empty()); std::set channels; + + const auto &partition = client.GetPartition(); for (const auto &c : *client.GetInstance().client_list) { + if (&c.GetPartition() != &partition) + continue; + const auto &subscriptions = c.GetSubscriptions(); channels.insert(subscriptions.begin(), subscriptions.end()); @@ -119,8 +124,11 @@ handle_send_message(Client &client, Request args, Response &r) bool sent = false; const ClientMessage msg(channel_name, message_text); + + const auto &partition = client.GetPartition(); for (auto &c : *client.GetInstance().client_list) - if (c.PushMessage(msg)) + if (&c.GetPartition() == &partition && + c.PushMessage(msg)) sent = true; if (sent)