diff options
author | minus <minus@mnus.de> | 2015-08-26 23:49:38 +0200 |
---|---|---|
committer | minus <minus@mnus.de> | 2015-08-26 23:49:38 +0200 |
commit | 2289029fabe919c670e19ed24baeac74846bc7b3 (patch) | |
tree | adc18bd99038b2716829feaad5c69b4d93e96296 /sway | |
parent | 357af228d693e64b4ac62ef472b3df65fd25348c (diff) |
added json-c lib and implemented IPC get_version
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -12,6 +12,7 @@ #include <sys/ioctl.h> #include <fcntl.h> #include <ctype.h> +#include <json-c/json.h> #include "ipc.h" #include "log.h" #include "config.h" @@ -226,6 +227,18 @@ void ipc_client_handle_command(struct ipc_client *client) { free(json); break; } + case IPC_GET_VERSION: + { + json_object *json = json_object_new_object(); + json_object_object_add(json, "human_readable", json_object_new_string(SWAY_GIT_VERSION)); + json_object_object_add(json, "major", json_object_new_int(0)); + json_object_object_add(json, "minor", json_object_new_int(0)); + json_object_object_add(json, "patch", json_object_new_int(1)); + const char *json_string = json_object_to_json_string(json); + ipc_send_reply(client, json_string, (uint32_t) strlen(json_string)); + json_object_put(json); // free + break; + } default: sway_log(L_INFO, "Unknown IPC command type %i", client->current_command); ipc_client_disconnect(client); |