summaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-04-03 20:02:59 +0200
committerMax Kellermann <max@musicpd.org>2019-04-03 20:16:08 +0200
commita9cb12b745c099edef622ed5dd1a84852a1bc699 (patch)
tree29fd4dc57723205eeb0e80ac93799482d91764a6 /src/command
parent380f73c1129d75dab75bd22c6aededa7e9c3716c (diff)
Client: make almost all attributes `private`
Diffstat (limited to 'src/command')
-rw-r--r--src/command/MessageCommands.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/command/MessageCommands.cxx b/src/command/MessageCommands.cxx
index 78f7f3790..fd3592fb0 100644
--- a/src/command/MessageCommands.cxx
+++ b/src/command/MessageCommands.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2018 The Music Player Daemon Project
+ * Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -78,9 +78,11 @@ handle_channels(Client &client, gcc_unused Request args, Response &r)
assert(args.empty());
std::set<std::string> channels;
- for (const auto &c : *client.GetInstance().client_list)
- channels.insert(c.subscriptions.begin(),
- c.subscriptions.end());
+ for (const auto &c : *client.GetInstance().client_list) {
+ const auto &subscriptions = c.GetSubscriptions();
+ channels.insert(subscriptions.begin(),
+ subscriptions.end());
+ }
for (const auto &channel : channels)
r.Format("channel: %s\n", channel.c_str());
@@ -94,13 +96,10 @@ handle_read_messages(Client &client,
{
assert(args.empty());
- while (!client.messages.empty()) {
- const ClientMessage &msg = client.messages.front();
-
+ client.ConsumeMessages([&r](const auto &msg){
r.Format("channel: %s\nmessage: %s\n",
msg.GetChannel(), msg.GetMessage());
- client.messages.pop_front();
- }
+ });
return CommandResult::OK;
}