changeset 226:127142e02526

Irccd: fix invalid properties in ServerInfo::request
author David Demelier <markand@malikania.fr>
date Fri, 15 Jul 2016 10:54:56 +0200
parents 277d92d29a3d
children 7a6553094512
files lib/irccd/cmd-server-info.cpp
diffstat 1 files changed, 2 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lib/irccd/cmd-server-info.cpp	Thu Jul 14 15:11:36 2016 +0200
+++ b/lib/irccd/cmd-server-info.cpp	Fri Jul 15 10:54:56 2016 +0200
@@ -49,11 +49,7 @@
 
 nlohmann::json ServerInfo::request(Irccdctl &, const CommandRequest &args) const
 {
-    return nlohmann::json::object({
-        { "server",     args.args()[0] },
-        { "target",     args.args()[1] },
-        { "channel",    args.args()[2] }
-    });
+    return {{ "server", args.args()[0] }};
 }
 
 nlohmann::json ServerInfo::exec(Irccd &irccd, const nlohmann::json &request) const
@@ -68,6 +64,7 @@
     response.push_back({"nickname", server->nickname()});
     response.push_back({"username", server->username()});
     response.push_back({"realname", server->realname()});
+    response.push_back({"channels", server->channels() });
 
     // Optional stuff.
     if (server->flags() & Server::Ipv6)
@@ -77,14 +74,6 @@
     if (server->flags() & Server::SslVerify)
         response.push_back({"sslVerify", true});
 
-    // Channel list.
-    auto channels = nlohmann::json::array();
-
-    for (const auto &c : server->channels())
-        channels.push_back(c.name);
-
-    response.push_back({"channels", std::move(channels)});
-
     return response;
 }